Go to the documentation of this file.
38 long current_time = time(NULL);
49 && (
map->tmpname != NULL)
50 && (strncmp(
map->path,
"/random", 7))) {
56 fprintf(fp,
"%s:%s:%ld:0:0:%d:0:%d\n",
map->path,
map->tmpname,
57 (
map->reset_time == (uint32_t)-1 ? -1 :
map->reset_time-current_time),
74 int do_los, darkness, lock;
78 if (!(fp = fopen(
buf,
"r"))) {
102 sscanf(
tmp[2],
"%u:%d:%d:%hu:%d:%d\n", &
map->reset_time, &lock, &lock, &
map->difficulty, &do_los, &darkness);
105 map->darkness = darkness;
116 map->reset_time += sec;
140 LOG(
llevError,
"Tried to swap out map which was not in memory.\n");
148 LOG(
llevDebug,
"Wanted to swap out map with player.\n");
155 if (!
map->fixed_resettime)
163 if (
map->reset_time <=
seconds() &&
map->reset_group == NULL) {
166 LOG(
llevDebug,
"Resetting map %s instead of swapping it.\n",
map->path);
178 "Failed to swap map %s!",
map->path);
183 map->timeout = 60 +
rndm(0, 30);
209 if (
map->timeout > 1) {
211 }
else if (num_to_swap > 0 &&
map->timeout == 1) {
253 && (
map->tmpname != NULL)
254 && (current_time >=
map->reset_time);
269 if (
map->reset_group == NULL) {
315 if ((
m->unique ||
m->is_template) &&
m->in_memory ==
MAP_SWAPPED) {
316 LOG(
llevDebug,
"Resetting unique or template map %s.\n",
m->path);
mapstruct * get_linked_map(void)
int swap_map(mapstruct *map)
#define SAVE_ERROR_NOT_IN_MEMORY
void clean_tmp_map(mapstruct *m)
#define QUERY_FLAG(xyz, p)
void set_map_timeout(mapstruct *oldmap)
bool map_can_reset(const mapstruct *map, long current_time)
EXTERN mapstruct * first_map
static event_registration m
int of_close(OutputFile *of)
void flush_old_maps(void)
EXTERN player * first_player
static void write_map_log(void)
int rndm(int min, int max)
void free_map(mapstruct *m)
static bool map_can_reset_no_group(const mapstruct *map, long current_time)
void delete_map(mapstruct *m)
size_t split_string(char *str, char *array[], size_t array_size, char sep)
#define MSG_TYPE_ADMIN_LOADSAVE
int players_on_map(mapstruct *m, int show_all)
int save_map(mapstruct *m, int flag)
void pets_attempt_follow(object *for_owner, int force)
void LOG(LogLevel logLevel, const char *format,...)
FILE * of_open(OutputFile *of, const char *fname)
void set_map_reset_time(mapstruct *map)
#define SAVE_ERROR_PLAYER
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
void events_execute_global_event(int eventcode,...)
void check_active_maps(void)