Crossfire Client, Trunk
init.c File Reference
#include "client.h"
#include "mapdata.h"
#include "metaserver.h"
#include "p_cmd.h"
+ Include dependency graph for init.c:

Go to the source code of this file.

Macros

#define FREE_AND_CLEAR(xyz)   { free(xyz); xyz=NULL; }
 

Functions

void client_init ()
 
void client_reset ()
 
static void init_config ()
 
static void init_paths ()
 
void reset_player_data ()
 
static void reset_vars_common ()
 
void SendAddMe (ClientSocket csock)
 
void SendVersion (ClientSocket csock)
 
void VersionCmd (char *data, int len)
 

Variables

const char *const config_names [CONFIG_NUMS]
 
gint16 use_config [CONFIG_NUMS]
 
gint16 want_config [CONFIG_NUMS]
 

Detailed Description

Functions for initializing the client.

Definition in file init.c.

Macro Definition Documentation

◆ FREE_AND_CLEAR

#define FREE_AND_CLEAR (   xyz)    { free(xyz); xyz=NULL; }

Definition at line 43 of file init.c.

Function Documentation

◆ client_init()

void client_init ( )

Called ONCE during client startup to initialize configuration and other variables to reasonable defaults. Future resets (i.e. after a connection) should use client_reset() instead.

Definition at line 187 of file init.c.

References Player_Struct::below, FaceSets_struct::comment, cpl, exp_table, exp_table_max, FaceSets_struct::extension, face_info, Face_Information_struct::facesets, FaceSets_struct::fallback, FaceSets_struct::fullname, init_commands(), init_config(), init_paths(), last_used_skills, map_item(), MAX_FACE_SETS, MAX_SKILL, ms_init(), Player_Struct::ob, Face_Information_struct::old_bmaps_checksum, player_item(), FaceSets_struct::prefix, reset_vars_common(), FaceSets_struct::size, skill_names, and Face_Information_struct::want_faceset.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ client_reset()

void client_reset ( )

Clear client variables between connections to different servers. This MUST be called AFTER client_init() because that performs some allocations.

Definition at line 242 of file init.c.

References Face_Information_struct::bmaps_checksum, classes, FaceSets_struct::comment, FaceSets_struct::extension, face_info, Face_Information_struct::facesets, FaceSets_struct::fallback, free_all_race_class_info(), FREE_AND_CLEAR, FaceSets_struct::fullname, MAX_FACE_SETS, MAX_SKILL, motd, news, num_classes, num_races, Face_Information_struct::old_bmaps_checksum, FaceSets_struct::prefix, races, reset_vars_common(), rules, serverloginmethod, FaceSets_struct::size, skill_names, used_classes, and used_races.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_config()

◆ init_paths()

static void init_paths ( )
static

Definition at line 80 of file init.c.

References cache_dir, and config_dir.

Referenced by client_init().

+ Here is the caller graph for this function:

◆ reset_player_data()

void reset_player_data ( )

Reset player experience data.

Definition at line 229 of file init.c.

References cpl, MAX_SKILL, Stat_struct::skill_exp, Stat_struct::skill_level, and Player_Struct::stats.

Referenced by PlayerCmd(), and reset_vars_common().

+ Here is the caller graph for this function:

◆ reset_vars_common()

◆ SendAddMe()

void SendAddMe ( ClientSocket  csock)

Definition at line 76 of file init.c.

References cs_print_string(), and ClientSocket::fd.

Referenced by client_negotiate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendVersion()

void SendVersion ( ClientSocket  csock)

Definition at line 71 of file init.c.

References cs_print_string(), ClientSocket::fd, VERSION_CS, VERSION_INFO, and VERSION_SC.

Referenced by client_negotiate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ VersionCmd()

void VersionCmd ( char *  data,
int  len 
)

Definition at line 45 of file init.c.

References ClientSocket::cs_version, csocket, LOG(), LOG_DEBUG, LOG_WARNING, ClientSocket::sc_version, VERSION_CS, and VERSION_SC.

+ Here is the call graph for this function:

Variable Documentation

◆ config_names

const char* const config_names[CONFIG_NUMS]
Initial value:
= {
NULL, "download_all_images", "echo_bindings",
"fasttcpsend", "command_window", "cacheimages", "fog_of_war", "iconscale",
"mapscale", "popups", "displaymode", "showicon", "tooltips", "sound", "splitinfo",
"split", "show_grid", "lighting", "trim_info_window",
"map_width", "map_height", "foodbeep", "darkness", "port",
"grad_color_bars", "resistances", "smoothing", "nosplash",
"auto_apply_container", "mapscroll", "sign_popups", "message_timestamping", "auto_afk",
"inv_menu"
}

See common/init.c - number mapping used when loading/saving the values.

Definition at line 30 of file init.c.

Referenced by config_load(), config_load_legacy(), and save_defaults().

◆ use_config

gint16 use_config[CONFIG_NUMS]

Definition at line 41 of file init.c.

Referenced by init_config().

◆ want_config