 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
39 long current_time =
time(NULL);
51 && (strncmp(map->
path,
"/random", 7))) {
57 fprintf(fp,
"%s:%s:%ld:0:0:%d:0:%d\n", map->
path, map->
tmpname,
75 int do_los, darkness, lock;
79 if (!(fp = fopen(
buf,
"r"))) {
103 sscanf(tmp[2],
"%u:%d:%d:%hu:%d:%d\n", &map->
reset_time, &lock, &lock, &map->
difficulty, &do_los, &darkness);
141 LOG(
llevError,
"Tried to swap out map which was not in memory.\n");
149 LOG(
llevDebug,
"Wanted to swap out map with player.\n");
179 "Failed to swap map %s!", map->
path);
207 for (map =
first_map; map != NULL; map = next) {
213 }
else if (num_to_swap > 0 && map->
timeout == 1) {
242 && (show_all || !pl->
hidden))
318 LOG(
llevDebug,
"Resetting unique or template map %s.\n",
m->path);
player * next
Pointer to next player, NULL if this is last.
player * first_player
First player.
struct Settings settings
Global settings.
static void write_map_log(void)
Writes out information on all the temporary maps.
uint8_t recycle_tmp_maps
Re-use tmp maps.
@ llevError
Problems requiring server admin to fix.
uint16_t difficulty
What level the player should be to play here.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
int of_close(OutputFile *of)
Closes an output file.
FILE * of_open(OutputFile *of, const char *fname)
Opens an output file.
#define QUERY_FLAG(xyz, p)
same as sound ncom command like but with extra the client want tick commands so it knows animation timing the client wants to be informed of pickup mode changes Mode will be sent when the player successfully logs and afterward any time the value is but over time
#define SAVE_ERROR_NOT_IN_MEMORY
Map to swap isn't in memory.
char * tmpname
Name of temporary file.
object * ob
The object representing the player.
void set_map_timeout(mapstruct *oldmap)
Enable swapping for the given map.
#define MAP_IN_MEMORY
Map is fully loaded.
struct mapstruct * map
Pointer to the map in which this object is present.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
#define NDI_ALL_DMS
Inform all logged in DMs.
uint32_t hidden
If True, player (DM) is hidden from view.
int rndm(int min, int max)
Returns a number between min and max.
char path[HUGE_BUF]
Filename of the map.
#define SAVE_ERROR_PLAYER
Player on map to save.
#define FLAG_REMOVED
Object is not in any map or invenory.
static event_registration m
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.
int swap_map(mapstruct *map)
Swaps a map to disk.
void read_map_log(void)
Reads temporary maps information from disk.
size_t split_string(char *str, char *array[], size_t array_size, char sep)
Splits a string delimited by passed in sep value into characters into an array of strings.
mapstruct * first_map
First map.
void check_active_maps(void)
Finds maps in memory to swap.
void clean_tmp_map(mapstruct *m)
Removse the temporary file used by the map.
#define EVENT_MAPRESET
A map is resetting.
void free_map(mapstruct *m)
Frees everything allocated by the given mapstructure.
sstring reset_group
For reset purpose, all maps in the same group reset at the same time.
void delete_map(mapstruct *m)
Frees the map, including the mapstruct.
#define SAVE_MODE_NORMAL
No special handling.
mapstruct * get_linked_map(void)
Allocates, initialises, and returns a pointer to a mapstruct, linked through first_map.
long seconds(void)
Return wall clock time in seconds.
#define MAX_BUF
Used for all kinds of things.
#define MSG_TYPE_ADMIN_LOADSAVE
load/save operations
void set_map_reset_time(mapstruct *map)
Updates the map's timeout.
void pets_attempt_follow(object *for_owner, int force)
Check pets so they try to follow their master around the world.
#define NDI_UNIQUE
Print immediately, don't buffer.
void flush_old_maps(void)
Reset maps that need to, remove their swap file.
uint32_t in_memory
Combination of IN_MEMORY_xxx flags.
#define MAP_SWAPPED
Map spaces have been saved to disk.
int32_t timeout
Swapout is set to this.
static bool map_can_reset_no_group(const mapstruct *map, long current_time)
Returns whether a map can be reset, without taking its reset group into account.
int players_on_map(mapstruct *m, int show_all)
Returns the count of players on a map, calculated from player list.
int save_map(mapstruct *m, int flag)
Saves a map to file.
mapstruct * next
Next map, linked list.
uint32_t reset_time
Server time when map gets reset, seconds since epoch.
uint8_t darkness
Indicates level of darkness of map.
#define SAVE_ERROR_OK
No error.
#define MAP_MAXRESET
MAP_MAXRESET is the maximum time a map can have before being reset.
uint32_t fixed_resettime
If true, reset time is not affected by players entering/exiting map.
void events_execute_global_event(int eventcode,...)
Execute a global event.
@ llevDebug
Only for debugging purposes.
const char * localdir
Read/write data files.