Crossfire Server, Branches 1.12
R18729
|
Go to the source code of this file.
Functions | |
void | check_active_maps (void) |
void | flush_old_maps (void) |
static mapstruct * | map_least_timeout (const char *except_level) |
int | players_on_map (mapstruct *m, int show_all) |
void | read_map_log (void) |
void | swap_below_max (const char *except_level) |
int | swap_map (mapstruct *map) |
static void | write_map_log (void) |
All those functions deal with swapping maps to disk to claim memory space.
Definition in file swap.c.
void check_active_maps | ( | void | ) |
Finds maps in memory to reset.
Definition at line 206 of file swap.c.
References first_map, mapdef::in_memory, MAP_IN_MEMORY, mapdef::next, swap_map(), and mapdef::timeout.
Referenced by server_main().
void flush_old_maps | ( | void | ) |
Removes tmp-files of maps which are going to be reset next time they are visited. This is very useful if the tmp-disk is very full.
Definition at line 305 of file swap.c.
References clean_tmp_map(), delete_map(), EVENT_MAPRESET, execute_global_event(), first_map, mapdef::in_memory, mapdef::is_template, llevDebug, LOG(), MAP_IN_MEMORY, MAP_SWAPPED, mapdef::next, mapdef::path, players_on_map(), seconds(), set_map_timeout(), mapdef::timeout, mapdef::tmpname, TRUE, and mapdef::unique.
Referenced by block_until_new_connection(), command_reset(), and do_specials().
|
static |
Returns the map with the lowest timeout variable (not 0).
except_level | path of map to ignore for reset. Musn't be NULL. |
Definition at line 232 of file swap.c.
References first_map, mapdef::in_memory, MAP_IN_MEMORY, MAP_MAXTIMEOUT, mapdef::next, mapdef::path, and mapdef::timeout.
Referenced by swap_below_max().
int players_on_map | ( | mapstruct * | m, |
int | show_all | ||
) |
Returns the count of players on a map, calculated from player list.
m | map we want the count of players on. |
show_all | if true, show everyone. If not, don't show hidden players (dms) |
Definition at line 287 of file swap.c.
References first_player, FLAG_REMOVED, pl::hidden, obj::map, pl::next, pl::ob, and QUERY_FLAG.
Referenced by flush_old_maps(), and map_info().
void read_map_log | ( | void | ) |
Reads temporary maps information from disk.
Will LOG() in case of error.
Definition at line 83 of file swap.c.
References mapdef::darkness, mapdef::difficulty, get_linked_map(), mapdef::in_memory, llevDebug, Settings::localdir, LOG(), MAP_MAXRESET, MAP_SWAPPED, MAX_BUF, mapdef::path, mapdef::reset_time, seconds(), settings, snprintf(), strdup_local(), mapdef::timeout, and mapdef::tmpname.
Referenced by init().
void swap_below_max | ( | const char * | except_level | ) |
Tries to swap out maps which are still in memory, because of MAP_TIMEOUT until used objects is below MAX_OBJECTS or there are no more maps to swap.
except_level | path of map to ignore for reset. Musn't be NULL. |
Definition at line 253 of file swap.c.
References llevDebug, LOG(), map_least_timeout(), MAX_OBJECTS, nrofallocobjects, nroffreeobjects, mapdef::path, swap_map(), and mapdef::timeout.
Referenced by enter_map().
int swap_map | ( | mapstruct * | map | ) |
Swaps a map to disk.
After calling this function, the map will be:
map | map to swap. |
Definition at line 146 of file swap.c.
References delete_map(), draw_ext_info_format(), EVENT_MAPRESET, execute_global_event(), first_player, mapdef::fixed_resettime, FLAG_REMOVED, free_map(), mapdef::in_memory, llevDebug, llevError, LOG(), obj::map, MAP_IN_MEMORY, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOADSAVE, NDI_ALL_DMS, NDI_RED, NDI_UNIQUE, pl::next, mapdef::next, pl::ob, mapdef::path, QUERY_FLAG, Settings::recycle_tmp_maps, remove_all_pets(), mapdef::reset_time, SAVE_ERROR_NOT_IN_MEMORY, SAVE_ERROR_OK, SAVE_ERROR_PLAYER, save_map(), SAVE_MODE_NORMAL, seconds(), set_map_reset_time(), settings, TRUE, and write_map_log().
Referenced by check_active_maps(), clean_tmp_files(), command_reset(), set_map_timeout(), and swap_below_max().
|
static |
Writes out information on all the temporary maps. It is called by swap_map().
Will LOG() in case of error.
Definition at line 46 of file swap.c.
References mapdef::darkness, mapdef::difficulty, first_map, mapdef::in_memory, llevError, Settings::localdir, LOG(), MAP_IN_MEMORY, MAX_BUF, mapdef::next, mapdef::path, mapdef::reset_time, settings, snprintf(), and mapdef::tmpname.
Referenced by swap_map().