@ -88,6 +88,36 @@ int map_way_add_to_hash (struct map_hash *mh, struct map_way *mw) {
} ;
/*
* append the way without checking for it ' s size or double entry , no update done
*/
int map_way_append_to_hash ( struct map_hash * mh , struct map_way * mw ) {
int size ;
struct map_way * w = mh - > ways ;
/* check if the hash pos and the waypos are valid */
if ( mw - > p_cnt > 0 ) if ( map_geo2igeo ( mw - > p [ 0 ] . lon ) ! = mh - > pos . ilon | |
map_geo2igeo ( mw - > p [ 0 ] . lat ) ! = mh - > pos . ilat ) {
d_printf ( " p[0]:%d,%d mhpos:%d,%d way does not bleong to hash. " , __FUNCTION__ , map_geo2igeo ( mw - > p [ 0 ] . lon ) , map_geo2igeo ( mw - > p [ 0 ] . lat ) , mh - > pos . ilon , mh - > pos . ilat ) ;
errorexit ( - 1 ) ;
}
/* check if the first element is already the one we want to update */
mh - > ways = ( struct map_way * ) map_hash_getfree_aligned ( mh , POINTERALIGNMENT ) ;
/* copy the way data to the free entry
* calc size and set free entry to it ' s new place */
size = map_way_getsize ( mw ) ;
map_way_copy ( mh - > ways , mw ) ;
mh - > ways - > next = w ;
mh - > free = mh - > free + size ;
mh - > wayscnt + + ;
SETFLAG ( mh - > status , MS_changed ) ;
return 1 ;
} ;
/******************************************************************************
* Add / Update way information
* - load / get hash table