Crossfire Server, Trunk
|
#include "global.h"
#include <string.h>
#include "object.h"
#include "output_file.h"
#include "sproto.h"
#include "stats.h"
Go to the source code of this file.
Functions | |
void | check_active_maps (void) |
void | flush_old_maps (void) |
bool | map_can_reset (const mapstruct *map, long current_time) |
static bool | map_can_reset_no_group (const mapstruct *map, long current_time) |
int | players_on_map (mapstruct *m, int show_all) |
void | read_map_log (void) |
int | swap_map (mapstruct *map) |
static void | write_map_log (void) |
Functions that deal with swapping maps to disk to reclaim memory.
Definition in file swap.cpp.
void check_active_maps | ( | void | ) |
Finds maps in memory to swap.
Definition at line 201 of file swap.cpp.
References first_map, disinfect::map, MAP_IN_MEMORY, give::next, and swap_map().
Referenced by server_main().
void flush_old_maps | ( | void | ) |
Reset maps that need to, remove their swap file. This is very useful if the tmp-disk is very full.
Definition at line 291 of file swap.cpp.
References clean_tmp_map(), delete_map(), EVENT_MAPRESET, events_execute_global_event(), first_map, llevDebug, LOG(), m, map_can_reset(), MAP_IN_MEMORY, MAP_SWAPPED, players_on_map(), seconds(), set_map_timeout(), and TRUE.
Referenced by command_reset(), do_specials(), and START_TEST().
bool map_can_reset | ( | const mapstruct * | map, |
long | current_time | ||
) |
Returns whether a map can be reset, including all other maps in the same reset group.
map | map to consider. |
current_time | current time. |
Definition at line 266 of file swap.cpp.
References first_map, disinfect::map, map_can_reset_no_group(), mapstruct::next, and mapstruct::reset_group.
Referenced by flush_old_maps().
|
static |
Returns whether a map can be reset, without taking its reset group into account.
map | map to consider. |
current_time | current time. |
Definition at line 253 of file swap.cpp.
References disinfect::map, and MAP_SWAPPED.
Referenced by map_can_reset().
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 234 of file swap.cpp.
References first_player, FLAG_REMOVED, m, altar_valkyrie::pl, and QUERY_FLAG.
Referenced by flush_old_maps().
void read_map_log | ( | void | ) |
Reads temporary maps information from disk.
Will LOG() in case of error.
Definition at line 71 of file swap.cpp.
References buf, get_linked_map(), llevDebug, Settings::localdir, LOG(), disinfect::map, MAP_MAXRESET, MAP_SWAPPED, MAX_BUF, safe_strncpy, seconds(), settings, split_string(), strdup_local, and Ice::tmp.
Referenced by init().
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 136 of file swap.cpp.
References delete_map(), draw_ext_info_format(), EVENT_MAPRESET, events_execute_global_event(), first_player, FLAG_REMOVED, free_map(), llevDebug, llevError, LOG(), disinfect::map, MAP_IN_MEMORY, maps_swapped_total, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOADSAVE, NDI_ALL_DMS, NDI_RED, NDI_UNIQUE, pets_attempt_follow(), altar_valkyrie::pl, QUERY_FLAG, Settings::recycle_tmp_maps, altar_valkyrie::res, rndm(), 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(), and command_reset().
|
static |
Writes out information on all the temporary maps. It is called by swap_map().
Will LOG() in case of error.
Definition at line 34 of file swap.cpp.
References buf, first_map, Settings::localdir, disinfect::map, MAP_IN_MEMORY, MAX_BUF, of_close(), of_open(), and settings.
Referenced by swap_map().