32 "physical ",
"magic ",
"fire ",
"electricity ",
"cold ",
"confusion ",
"acid ",
33 "drain ",
"weaponmagic ",
"ghosthit ",
"poison ",
"slow ",
"paralyze ",
34 "turn_undead ",
"fear ",
"cancellation ",
"deplete ",
"death ",
"chaos ",
35 "counterspell ",
"godpower ",
"holyword ",
"blind ",
"internal ",
"life_stealing ",
41 "physical",
"magic",
"fire",
"electricity",
"cold",
"confusion",
"acid",
42 "drain",
"weapon magic",
"ghost hit",
"poison",
"slow",
"paralyze",
43 "turn undead",
"fear",
"cancellation",
"deplete",
"death",
"chaos",
44 "counterspell",
"god power",
"holy word",
"blind",
"internal",
"life stealing",
50 "armour",
"resist magic",
"resist fire",
"resist electricity",
"resist cold",
51 "resist confusion",
"resist acid",
"resist drain",
52 "resist weaponmagic",
"resist ghosthit",
"resist poison",
"resist slow",
53 "resist paralyzation",
"resist turn undead",
"resist fear",
54 "resist cancellation",
"resist depletion",
"resist death",
"resist chaos",
55 "resist counterspell",
"resist god power",
"resist holy word",
56 "resist blindness",
"resist internal",
"resist life stealing",
62 "#FF15CD",
"#930C76",
"red",
"blue",
"#2CFFFF", NULL, NULL, NULL, NULL, NULL,
"green", NULL, NULL,
63 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
71 "physical",
"magic",
"fire",
"electricity",
"cold",
"confusion",
"acid",
72 "draining",
"weapon magic",
"ghosts",
"poison",
"slow",
"paralyze",
73 "turn undead",
"fear",
"cancellation",
"depletion",
"death attacks",
"chaos",
74 "counterspell",
"god power",
"holy word",
"blinding attacks",
"internal",
75 "life stealing",
"disease" 143 .log_callback =
nullptr,
148 .localdir = LOCALDIR,
176 .who_wiz_format = { 0 },
181 .meta_server = { 0 },
184 .meta_comment = { 0 },
189 .worldmaptilesizex = 0,
190 .worldmaptilesizey = 0,
192 .emergency_mapname =
nullptr,
196 .item_power_factor = 1.0,
203 .no_player_stealing = 1,
204 .create_home_portals = 0,
205 .personalized_blessings = 1,
206 .pk_max_experience = 5000000,
207 .pk_max_experience_percent = 10,
208 .allow_denied_spells_writing = 0,
209 .allow_broken_converters = 0,
211 .log_timestamp_format =
nullptr,
212 .starting_stat_min = 3,
213 .starting_stat_max = 18,
214 .starting_stat_points = 85,
215 .roll_stat_points = 115,
217 .special_break_map = 1,
218 .ignore_plugin_compatibility = 0,
219 .account_block_create = 0,
220 .account_trusted_host =
nullptr,
223 .ignore_assets_errors = 0,
224 .assets_tracker =
nullptr,
225 .fatal_hook =
nullptr,
226 .stat_file =
nullptr,
279 snprintf(filename,
sizeof(filename),
"%s/%s/.emergency", settings.
datadir, settings.
mapdir);
280 fp = fopen(filename,
"r");
282 while (fgets(tmpbuf,
MAX_BUF-1, fp)) {
283 if (tmpbuf[0] ==
'#')
287 tmpbuf[strlen(tmpbuf)-1] = 0;
290 }
else if (online == 1) {
292 }
else if (online == 2) {
301 LOG(
llevError,
"Online read partial data from %s\n", filename);
343 LOG(
llevError,
"Assets errors, please fix and restart.\n");
358 cp = getenv(
"CROSSFIRE_LIBDIR");
361 cp = getenv(
"CROSSFIRE_LOCALDIR");
364 cp = getenv(
"CROSSFIRE_PLAYERDIR");
367 cp = getenv(
"CROSSFIRE_MAPDIR");
370 cp = getenv(
"CROSSFIRE_UNIQUEDIR");
373 cp = getenv(
"CROSSFIRE_TEMPLATEDIR");
376 cp = getenv(
"CROSSFIRE_TMPDIR");
399 setvbuf(
logfile, NULL, _IOLBF, 0);
411 first_artifactlist = NULL;
438 free(attack_mess[msg][attack].buf1);
439 free(attack_mess[msg][attack].buf2);
440 free(attack_mess[msg][attack].buf3);
490 LOG(
llevError,
"Unable to continue without initial map.\n");
495 LOG(
llevError,
"Legacy map must have a 'slaying' field!\n");
500 LOG(
llevError,
"Can not find object of type MAP subtype MAP_TYPE_DEFAULT.\n");
501 LOG(
llevError,
"Are the archetype files up to date? Can not continue.\n");
515 snprintf(filename,
sizeof(filename),
"%s/clockdata", settings.
localdir);
530 static int has_been_done = 0;
537 snprintf(filename,
sizeof(filename),
"%s/clockdata", settings.
localdir);
538 fp = fopen(filename,
"r");
546 if (fscanf(fp,
"%lu", &
todtick) == 1) {
550 LOG(
llevError,
"Couldn't parse todtick, using default value 0\n");
566 int mess = -1,
level;
567 int mode = 0, total = 0;
571 if (*buf ==
'#' || *buf ==
'\0')
580 cp = buf + strspn(buf,
" \t");
582 if (strncmp(cp,
"TYPE:", 5) == 0) {
583 p = strtok(buf,
":");
584 p = strtok(NULL,
":");
587 free(attack_mess[mess][
level].buf1);
588 free(attack_mess[mess][
level].buf2);
589 free(attack_mess[mess][
level].buf3);
600 p = strtok(buf,
"=");
602 p = strtok(NULL,
"=");
603 free(attack_mess[mess][
level].buf1);
610 }
else if (mode == 2) {
611 p = strtok(buf,
"=");
613 p = strtok(NULL,
"=");
614 free(attack_mess[mess][
level].buf2);
621 }
else if (mode == 3) {
622 p = strtok(buf,
"=");
624 p = strtok(NULL,
"=");
625 free(attack_mess[mess][
level].buf3);
636 LOG(
llevDebug,
"attackmsg %s: %d messages in %d categories\n", filename, total, mess+1);
std::vector< materialtype_t * > materials
const char *const change_resist_msg[NROFATTACKS]
These are the descriptions of the resistances displayed when a player puts on/takes off an item...
#define STAT_LOSS_ON_DEATH
char first_map_path[MAX_BUF]
The start-level.
int ignore_assets_errors
If set then go on running even if there are errors in assets.
void init_experience(void)
This loads the experience table from the exp_table file.
#define SPELL_FAILURE_EFFECTS
#define BALANCED_STAT_LOSS
#define AT_ELECTRICITY
Can also ignite objects (8)
#define SPELLPOINT_LEVEL_DEPEND
unsigned long todtick
Game world time, in in-game hours.
FILE * logfile
Used by server/daemon.c.
#define DEATH_PENALTY_RATIO
void init_objects(void)
Sets up and initialises the linked list of free and used objects.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
void i18n_init(void)
Initializes the i18n subsystem.
#define PERMANENT_EXPERIENCE_RATIO
long nroferrors
If it exceeds MAX_ERRORS, call fatal()
#define ARMOR_SPEED_IMPROVEMENT
void init_library(void)
It is vital that init_library() is called by any functions using this library.
player * first_player
First player.
#define EMERGENCY_MAPPATH
These define the players starting map and location on that map, and where emergency saves are defined...
const char * playerdir
Where the player files are.
#define MAP_TYPE_DEFAULT
If no map is specified, where character starts.
#define MAP_TYPE_LEGACY
For old character creation method.
sstring add_string(const char *str)
Share a string.
struct Statistics statistics
Merged spell statistics.
long trying_emergency_save
True when emergency_save() is reached.
std::vector< region * > all_regions
#define TMPDIR
Your tmp-directory should be large enough to hold the uncompressed map-files for all who are playing...
#define ARMOR_SPEED_LINEAR
#define AT_COLD
Can freeze objects into ice cubes (16)
void assets_init()
Init assets-related variables.
void init_attackmess(BufferReader *reader, const char *filename)
Initializes the attack messages.
#define ARMOR_MAX_ENCHANT
#define SPELL_ENCUMBRANCE
Global type definitions and header inclusions.
#define DEATH_PENALTY_LEVEL
void init_globals(void)
Initialises all global variables.
char * longname
Official title of the region, this might be defined to be the same as name.
void init_block(void)
initialises the array used by the LOS routines.
const char * logfilename
Logfile to use.
uint16_t emergency_y
Coordinates to use on that map.
static void init_emergency_mappath(void)
This loads the emergency map information from a .emergency file in the map directory.
AssetsManager * getManager()
sstring blocks_prayer
For update_position() mostly.
long nrofartifacts
Only used in malloc_info().
const char *const spellpathnames[NRSPELLPATHS]
Perhaps not the best place for this, but needs to be in some file in the common area so that standalo...
#define ARMOR_WEIGHT_LINEAR
const char *const attacktype_desc[NROFATTACKS]
Short description of names of the attacktypes.
FILE * of_open(OutputFile *of, const char *fname)
Opens an output file.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
This is used for various performance tracking statistics, or just how often certain events are done...
const char * tmpdir
Directory to use for temporary files.
void free_globals(void)
Cleans all memory allocated for global variables.
const char *const resist_color[NROFATTACKS]
Colors to add to the resistances for media tags.
int exiting
True if the game is about to exit.
void clear_friendly_list(void)
Totally clear the friendly list.
char * name
Shortend name of the region as maps refer to it.
#define RESET_LOCATION_TIME
By selecting the following, whenever a player does a backup save (with the 'save' command)...
artifactlist * first_artifactlist
First artifact.
This represents all archetypes for one particular object type.
mapstruct * first_map
First map.
#define AT_FIRE
Can ignite objects (4)
struct Settings settings
Global settings.
#define PLAYERDIR
If you want the players to be able to save their characters between games, define SAVE_PLAYER and set...
const char * templatedir
Directory for the template map.
void free_experience(void)
Frees experience-related memory.
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
#define AT_PHYSICAL
Basic attack (1)
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
void write_todclock(void)
Write out the current time to the file so time does not reset every time the server reboots...
#define MAX_BUF
Used for all kinds of things.
#define NRSPELLPATHS
Number of spell paths.
void delete_map(mapstruct *m)
Frees the map, including the mapstruct.
size_t strlcpy(char *dst, const char *src, size_t size)
Portable implementation of strlcpy(3).
archetype * get_archetype_by_type_subtype(int type, int subtype)
Retrieves an archetype by type and subtype.
const char * uniquedir
Directory for the unique items.
#define CSPORT
CSPORT is the port used for the new client/server code.
long nrofallowedstr
Only used in malloc_info().
const char * datadir
Read only data files.
char * jailmap
Where a player that is arrested in this region should be imprisoned.
#define AT_POISON
Some damage each turn thereafter (1024)
static void init_dynamic(void)
Initializes first_map_path from the archetype collection, and check that some required archetype actu...
Chaos_Attacks ATTACKS[22]
Some local definitions for shuffle_attack().
Object structure, the core of Crossfire.
const char * localdir
Read/write data files.
Only for debugging purposes.
const char * mapdir
Where the map files are.
#define AT_SLOW
Speed is reduced (2048)
int of_close(OutputFile *of)
Closes an output file.
archetype * empty_archetype
Nice to have fast access to it.
char * msg
The description of the region.
char first_map_ext_path[MAX_BUF]
Path used for per-race start maps.
Functions for creating text output files.
#define AT_MAGIC
All magic spells, but not prayers (2)
#define MAPDIR
These defines tells where, relative to LIBDIR, the maps, the map-index, highscore files and directori...
#define UNIQUE_DIR
Directory to use for unique items.
#define ARMOR_WEIGHT_REDUCTION
#define MOTD
Defining MEMORY_DEBUG disables Crossfire's object allocator, which allocates OBJ_EXPAND objects at a ...
const char *const resist_save[NROFATTACKS]
Attack types.
C function wrappers to interact with assets.
const char *const resist_plus[NROFATTACKS]
Attack types to show to the player.
char * bufferreader_next_line(BufferReader *br)
Return the next line in the buffer, as separated by a newline.
static void init_defaults(void)
Initialises global variables which can be changed by options.
Attack messages structure.
static void init_clocks(void)
Initializes the gametime and TOD counters Called by init_library().
char * emergency_mapname
Map to return players to in emergency.
#define AT_CONFUSION
Movement/attack directions become random (32)
#define FREE_AND_CLEAR(xyz)
Free the pointer and then set it to NULL.
mapstruct * ready_map_name(const char *name, int flags)
Makes sure the given map is loaded and swapped in.
static void init_environ(void)
Initializes values from the environmental variables.
#define SET_FRIENDLY_FIRE
void init_stats()
This loads statistic bonus/penalties from the stat_bonus file.
attackmess_t attack_mess[NROFATTACKMESS][MAXATTACKMESS]
void init_hash_table(void)
Initialises the hash-table used by the shared string library.
object clone
An object from which to do object_copy()
void assets_free()
Free all assets-related memory.
#define AT_PARALYZE
Speed is reduced to zero (4096)