version 1.3 | | version 1.4 |
---|
| | |
/* | | /* |
* static char *rcsid_swap_c = | | * static char *rcsid_swap_c = |
* "$Id: swap.c,v 1.3 2000/12/04 00:40:05 cvs Exp $"; | | * "$Id: swap.c,v 1.4 2001/02/12 07:11:11 cvs Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
if (!QUERY_FLAG(map->map_object, FLAG_STAND_STILL)) | | if (!QUERY_FLAG(map->map_object, FLAG_STAND_STILL)) |
set_map_reset_time(map); | | set_map_reset_time(map); |
| | |
| | /* If it is immediate reset time, don't bother saving it - just get |
| | * rid of it right away. |
| | */ |
| | if (map->reset_time <= seconds()) { |
| | mapstruct *oldmap = map; |
| | |
| | LOG(llevDebug,"Resetting map %s.\n",map->path); |
| | map = map->next; |
| | delete_map(oldmap); |
| | return; |
| | } |
| | |
if (new_save_map (map, 0) == -1) { | | if (new_save_map (map, 0) == -1) { |
LOG(llevError, "Failed to swap map %s.\n", map->path); | | LOG(llevError, "Failed to swap map %s.\n", map->path); |
/* need to reset the in_memory flag so that delete map will also | | /* need to reset the in_memory flag so that delete map will also |
| | |
* This is very useful if the tmp-disk is very full. | | * This is very useful if the tmp-disk is very full. |
*/ | | */ |
void flush_old_maps() { | | void flush_old_maps() { |
#ifdef MAP_RESET /* No need to flush them if there are no resets */ | | |
| | |
mapstruct *m, *oldmap; | | mapstruct *m, *oldmap; |
long sec; | | long sec; |
| | |
| | |
m= first_map; | | m= first_map; |
while (m) { | | while (m) { |
| | /* There can be cases (ie death) where a player leaves a map and the timeout |
| | * is not set so it isn't swapped out. |
| | */ |
| | if ((m->in_memory == MAP_IN_MEMORY) && (m->timeout==0) && |
| | !players_on_map(m)) { |
| | set_map_timeout(m); |
| | } |
| | #ifdef MAP_RESET /* No need to flush them if there are no resets */ |
if(m->in_memory != MAP_SWAPPED || m->tmpname == NULL || | | if(m->in_memory != MAP_SWAPPED || m->tmpname == NULL || |
sec < m->reset_time) { | | sec < m->reset_time) { |
m = m->next; | | m = m->next; |
| | |
m = m->next; | | m = m->next; |
delete_map(oldmap); | | delete_map(oldmap); |
} | | } |
} | | |
#endif | | #endif |
} | | } |
| | } |