… | |
… | |
68 | { |
68 | { |
69 | FILE *fp; |
69 | FILE *fp; |
70 | maptile *map; |
70 | maptile *map; |
71 | char buf[MAX_BUF], *cp, *cp1; |
71 | char buf[MAX_BUF], *cp, *cp1; |
72 | int do_los, darkness, lock; |
72 | int do_los, darkness, lock; |
73 | long sec = seconds (); |
73 | long sec = time (0); |
74 | |
|
|
75 | |
74 | |
76 | sprintf (buf, "%s/temp.maps", settings.localdir); |
75 | sprintf (buf, "%s/temp.maps", settings.localdir); |
77 | if (!(fp = fopen (buf, "r"))) |
76 | if (!(fp = fopen (buf, "r"))) |
78 | { |
77 | { |
79 | LOG (llevDebug, "Could not open %s for reading\n", buf); |
78 | LOG (llevDebug, "Could not open %s for reading\n", buf); |
… | |
… | |
145 | set_map_reset_time (map); |
144 | set_map_reset_time (map); |
146 | |
145 | |
147 | /* If it is immediate reset time, don't bother saving it - just get |
146 | /* If it is immediate reset time, don't bother saving it - just get |
148 | * rid of it right away. |
147 | * rid of it right away. |
149 | */ |
148 | */ |
150 | if (map->reset_time <= (uint32) seconds ()) |
149 | if (map->reset_time <= (uint32) time (0)) |
151 | { |
150 | { |
152 | LOG (llevDebug, "Resetting map %s.\n", map->path); |
151 | LOG (llevDebug, "Resetting map %s.\n", map->path); |
153 | INVOKE_MAP (RESET, map); |
152 | INVOKE_MAP (RESET, map); |
154 | delete_map (map); |
153 | delete_map (map); |
155 | return; |
154 | return; |
… | |
… | |
239 | void |
238 | void |
240 | flush_old_maps (void) |
239 | flush_old_maps (void) |
241 | { |
240 | { |
242 | |
241 | |
243 | maptile *m, *oldmap; |
242 | maptile *m, *oldmap; |
244 | uint32 sec; |
243 | uint32 sec = time (0); |
245 | |
|
|
246 | sec = seconds (); |
|
|
247 | |
244 | |
248 | m = first_map; |
245 | m = first_map; |
249 | while (m) |
246 | while (m) |
250 | { |
247 | { |
251 | /* There can be cases (ie death) where a player leaves a map and the timeout |
248 | /* There can be cases (ie death) where a player leaves a map and the timeout |
252 | * is not set so it isn't swapped out. |
249 | * is not set so it isn't swapped out. |
253 | */ |
250 | */ |
254 | if ((m->in_memory == MAP_IN_MEMORY) && (m->timeout == 0) && !players_on_map (m, TRUE)) |
251 | if ((m->in_memory == MAP_IN_MEMORY) && (m->timeout == 0) && !players_on_map (m, TRUE)) |
255 | { |
|
|
256 | set_map_timeout (m); |
252 | set_map_timeout (m); |
257 | } |
|
|
258 | |
253 | |
259 | /* per player unique maps are never really reset. However, we do want |
254 | /* per player unique maps are never really reset. However, we do want |
260 | * to perdiocially remove the entries in the list of active maps - this |
255 | * to perdiocially remove the entries in the list of active maps - this |
261 | * generates a cleaner listing if a player issues the map commands, and |
256 | * generates a cleaner listing if a player issues the map commands, and |
262 | * keeping all those swapped out per player unique maps also has some |
257 | * keeping all those swapped out per player unique maps also has some |