--- deliantra/server/common/map.c 2006/02/22 19:08:43 1.5 +++ deliantra/server/common/map.c 2006/04/01 15:39:58 1.10 @@ -40,6 +40,9 @@ extern int nrofallocobjects,nroffreeobjects; +void (*load_original_map_callback)(mapstruct *map); +void (*load_temporary_map_callback)(mapstruct *map); +void (*clean_temporary_map_callback)(mapstruct *map); /* * Returns the mapstruct which has a name matching the given argument. @@ -589,14 +592,12 @@ */ void save_objects (mapstruct *m, FILE *fp, FILE *fp2, int flag) { int i, j = 0,unique=0; - object *op, *otmp; + object *op; /* first pass - save one-part objects */ for(i = 0; i < MAP_WIDTH(m); i++) for (j = 0; j < MAP_HEIGHT(m); j++) { unique=0; - for(op = get_map_ob (m, i, j); op; op = otmp) { - otmp = op->above; - + for(op = get_map_ob (m, i, j); op; op = op->above) { if (QUERY_FLAG(op,FLAG_IS_FLOOR) && QUERY_FLAG(op, FLAG_UNIQUE)) unique=1; @@ -678,7 +679,7 @@ fatal(OUT_OF_MEMORY); } -/* Creatures and returns a map of the specific size. Used +/* Create and returns a map of the specific size. Used * in random map code and the editor. */ mapstruct *get_empty_map(int sizex, int sizey) { @@ -1051,6 +1052,8 @@ if (!MAP_DIFFICULTY(m)) MAP_DIFFICULTY(m)=calculate_difficulty(m); set_map_reset_time(m); + if (load_original_map_callback) + load_original_map_callback(m); return (m); } @@ -1100,6 +1103,8 @@ load_objects (m, fp, 0); close_and_delete(fp, comp); m->in_memory=MAP_IN_MEMORY; + if (load_temporary_map_callback) + load_temporary_map_callback(m); return m; } @@ -1145,7 +1150,7 @@ /* This goes through map 'm' and removed any unique items on the map. */ static void delete_unique_items(mapstruct *m) { - int i,j,unique=0; + int i,j,unique; object *op, *next; for(i=0; itmpname == NULL) return; + if (clean_temporary_map_callback) + clean_temporary_map_callback (m); (void) unlink(m->tmpname); } @@ -1696,9 +1703,9 @@ /* inform all players on the map */ if (change>0) - new_info_map(NDI_BLACK, m,"It becomes darker."); + new_info_map(NDI_BLACK|NDI_UNIQUE, m,"It becomes darker."); else - new_info_map(NDI_BLACK, m,"It becomes brighter."); + new_info_map(NDI_BLACK|NDI_UNIQUE, m,"It becomes brighter."); /* Do extra checking. since m->darkness is a unsigned value, * we need to be extra careful about negative values.