1 | /* |
1 | /* |
2 | * static char *rcsid_swap_c = |
2 | * static char *rcsid_swap_c = |
3 | * "$Id: swap.c,v 1.1.1.1 2006/02/03 07:14:41 root Exp $"; |
3 | * "$Id: swap.c,v 1.5 2006/08/13 17:16:05 elmex dead $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
146 | |
146 | |
147 | /* If it is immediate reset time, don't bother saving it - just get |
147 | /* If it is immediate reset time, don't bother saving it - just get |
148 | * rid of it right away. |
148 | * rid of it right away. |
149 | */ |
149 | */ |
150 | if (map->reset_time <= seconds()) { |
150 | if (map->reset_time <= seconds()) { |
151 | mapstruct *oldmap = map; |
|
|
152 | |
|
|
153 | LOG(llevDebug,"Resetting map %s.\n",map->path); |
151 | LOG(llevDebug,"Resetting map %s.\n",map->path); |
154 | /* Lauwenmark : Here we handle the MAPRESET global event */ |
152 | /* Lauwenmark : Here we handle the MAPRESET global event */ |
155 | execute_global_event(EVENT_MAPRESET, map->path); |
153 | execute_global_event(EVENT_MAPRESET, map); |
156 | map = map->next; |
|
|
157 | delete_map(oldmap); |
154 | delete_map(map); |
158 | return; |
155 | return; |
159 | } |
156 | } |
160 | |
157 | |
161 | if (new_save_map (map, 0) == -1) { |
158 | if (new_save_map (map, 0) == -1) { |
162 | LOG(llevError, "Failed to swap map %s.\n", map->path); |
159 | LOG(llevError, "Failed to swap map %s.\n", map->path); |
… | |
… | |
164 | * free the objects with it. |
161 | * free the objects with it. |
165 | */ |
162 | */ |
166 | map->in_memory = MAP_IN_MEMORY; |
163 | map->in_memory = MAP_IN_MEMORY; |
167 | delete_map(map); |
164 | delete_map(map); |
168 | } else { |
165 | } else { |
|
|
166 | execute_global_event(EVENT_MAPOUT, map); |
169 | free_map(map,1); |
167 | free_map(map,1); |
170 | } |
168 | } |
171 | |
169 | |
172 | if (settings.recycle_tmp_maps == TRUE) |
170 | if (settings.recycle_tmp_maps == TRUE) |
173 | write_map_log(); |
171 | write_map_log(); |
… | |
… | |
292 | m = m->next; |
290 | m = m->next; |
293 | } |
291 | } |
294 | else { |
292 | else { |
295 | LOG(llevDebug,"Resetting map %s.\n",m->path); |
293 | LOG(llevDebug,"Resetting map %s.\n",m->path); |
296 | /* Lauwenmark : Here we handle the MAPRESET global event */ |
294 | /* Lauwenmark : Here we handle the MAPRESET global event */ |
297 | execute_global_event(EVENT_MAPRESET, m->path); |
295 | execute_global_event(EVENT_MAPRESET, m); |
298 | clean_tmp_map(m); |
296 | clean_tmp_map(m); |
299 | oldmap = m; |
297 | oldmap = m; |
300 | m = m->next; |
298 | m = m->next; |
301 | delete_map(oldmap); |
299 | delete_map(oldmap); |
302 | } |
300 | } |