Crossfire Server, Trunk  1.75.0
init.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2014 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
19 #include "global.h"
20 
21 #include <stdlib.h>
22 #include <string.h>
23 
24 #include "object.h"
25 #include "output_file.h"
26 
27 #include "assets.h"
28 #include "AssetsManager.h"
29 
31 const char *const resist_save[NROFATTACKS] = {
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 ",
36  "disease "
37 };
38 
40 const char *const attacktype_desc[NROFATTACKS] = {
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",
45  "disease"
46 };
47 
49 const char *const resist_plus[NROFATTACKS] = {
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",
57  "resist diseases"
58 };
59 
61 const char *const resist_color[NROFATTACKS] = {
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,
64 };
65 
70 const char *const change_resist_msg[NROFATTACKS] = {
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"
76 };
77 
79 
82  { AT_PHYSICAL, 0 },
83  { AT_PHYSICAL, 0 }, /*face = explosion*/
84  { AT_PHYSICAL, 0 },
85  { AT_MAGIC, 1 },
86  { AT_MAGIC, 1 }, /* face = last-burnout */
87  { AT_MAGIC, 1 },
88  { AT_FIRE, 2 },
89  { AT_FIRE, 2 }, /* face = fire.... */
90  { AT_FIRE, 2 },
91  { AT_ELECTRICITY, 3 },
92  { AT_ELECTRICITY, 3 }, /* ball_lightning */
93  { AT_ELECTRICITY, 3 },
94  { AT_COLD, 4 },
95  { AT_COLD, 4 }, /* face=icestorm*/
96  { AT_COLD, 4 },
97  { AT_CONFUSION, 5 },
98  { AT_POISON, 7 },
99  { AT_POISON, 7 }, /* face = acid sphere. generator */
100  { AT_POISON, 7 }, /* poisoncloud face */
101  { AT_SLOW, 8 },
102  { AT_PARALYZE, 9 },
103  { AT_FEAR, 10 }
104 };
105 
108 std::vector<region *> all_regions;
114 FILE *logfile;
115 int exiting;
123 long ob_count;
124 
125 const char *undead_name; /* Used in hit_player() in main.c */
128 std::vector<materialtype_t *> materials;
129 
130 static void init_environ(void);
131 static void init_defaults(void);
132 static void init_dynamic(void);
133 static void init_clocks(void);
134 
135 /*
136  * Default values for settings.
137  * Anything with non-zero defaults in include/global.h must be set here.
138  */
139 struct Settings settings = {
140  .logfilename = nullptr,
141  .csport = CSPORT,
142  .debug = llevInfo,
143  .log_callback = nullptr,
144  .dumpvalues = 0,
145  .dumparg = nullptr,
146  .confdir = CONFDIR,
147  .datadir = DATADIR,
148  .localdir = LOCALDIR,
149  .playerdir = PLAYERDIR,
150  .mapdir = MAPDIR,
151  .regions = REGIONS,
152  .uniquedir = UNIQUE_DIR,
153  .templatedir = TEMPLATE_DIR,
154  .tmpdir = TMPDIR,
155  .stat_loss_on_death = STAT_LOSS_ON_DEATH,
156  .pk_luck_penalty = PK_LUCK_PENALTY,
157  .permanent_exp_ratio = PERMANENT_EXPERIENCE_RATIO,
158  .death_penalty_ratio = DEATH_PENALTY_RATIO,
159  .death_penalty_level = DEATH_PENALTY_LEVEL,
160  .balanced_stat_loss = BALANCED_STAT_LOSS,
161  .not_permadeth = NOT_PERMADETH,
162  .simple_exp = SIMPLE_EXP,
163  .reset_loc_time = RESET_LOCATION_TIME,
164  .set_title = SET_TITLE,
165  .resurrection = RESURRECTION,
166  .search_items = SEARCH_ITEMS,
167  .spell_encumbrance = SPELL_ENCUMBRANCE,
168  .spell_failure_effects = SPELL_FAILURE_EFFECTS,
169  .casting_time = CASTING_TIME,
170  .real_wiz = REAL_WIZ,
171  .recycle_tmp_maps = RECYCLE_TMP_MAPS,
172  .always_show_hp = ALWAYS_SHOW_HP,
173  .spellpoint_level_depend = SPELLPOINT_LEVEL_DEPEND,
174  .set_friendly_fire = SET_FRIENDLY_FIRE,
175  .who_format = { 0 },
176  .who_wiz_format = { 0 },
177  .motd = MOTD,
178  .rules = "rules",
179  .news = "news",
180  .meta_on = false,
181  .meta_server = { 0 },
182  .meta_host = { 0 },
183  .meta_port = 0,
184  .meta_comment = { 0 },
185  .worldmapstartx = 0,
186  .worldmapstarty = 0,
187  .worldmaptilesx = 0,
188  .worldmaptilesy = 0,
189  .fastclock = 0,
190  .emergency_mapname = nullptr,
191  .emergency_x = EMERGENCY_X,
192  .emergency_y = EMERGENCY_Y,
193  .max_level = 0,
194  .item_power_factor = 1.0,
195  /* Armor enchantment stuff */
196  .armor_max_enchant = ARMOR_MAX_ENCHANT,
197  .armor_weight_reduction = ARMOR_WEIGHT_REDUCTION,
198  .armor_weight_linear = ARMOR_WEIGHT_LINEAR,
199  .armor_speed_improvement = ARMOR_SPEED_IMPROVEMENT,
200  .armor_speed_linear = ARMOR_SPEED_LINEAR,
201  .no_player_stealing = 1,
202  .create_home_portals = 0,
203  .personalized_blessings = 1,
204  .pk_max_experience = 5000000,
205  .pk_max_experience_percent = 10,
206  .allow_denied_spells_writing = 0,
207  .allow_broken_converters = 0,
208  .log_timestamp = 0,
209  .log_timestamp_format = nullptr,
210  .starting_stat_min = 3,
211  .starting_stat_max = 18,
212  .starting_stat_points = 85,
213  .roll_stat_points = 115,
214  .max_stat = 0, /* max_stat - will be loaded from stats file */
215  .special_break_map = 1, /* 1 for historical reasons */
216  .ignore_plugin_compatibility = 0,
217  .account_block_create = 0,
218  .account_trusted_host = nullptr,
219  .crypt_mode = 0,
220  .min_name = 0,
221  .ignore_assets_errors = 0,
222  .assets_tracker = nullptr,
223  .fatal_hook = nullptr,
224  .stat_file = nullptr,
225 };
226 
228 
234 const char *const spellpathnames[NRSPELLPATHS] = {
235  "Protection",
236  "Fire",
237  "Frost",
238  "Electricity",
239  "Missiles",
240  "Self",
241  "Summoning",
242  "Abjuration",
243  "Restoration",
244  "Detonation",
245  "Mind",
246  "Creation",
247  "Teleportation",
248  "Information",
249  "Transmutation",
250  "Transferrence",
251  "Turning",
252  "Wounding",
253  "Death",
254  "Light"
255 };
256 
257 
269 static void init_emergency_mappath(void) {
270  char filename[MAX_BUF], tmpbuf[MAX_BUF];
271  FILE *fp;
272  int online = 0;
273 
275 
276  /* If this file doesn't exist, not a big deal */
277  snprintf(filename, sizeof(filename), "%s/%s/.emergency", settings.datadir, settings.mapdir);
278  fp = fopen(filename, "r");
279  if (fp != NULL) {
280  while (fgets(tmpbuf, MAX_BUF-1, fp)) {
281  if (tmpbuf[0] == '#')
282  continue; /* ignore comments */
283 
284  if (online == 0) {
285  tmpbuf[strlen(tmpbuf)-1] = 0; /* kill newline */
288  } else if (online == 1) {
289  settings.emergency_x = atoi(tmpbuf);
290  } else if (online == 2) {
291  settings.emergency_y = atoi(tmpbuf);
292  }
293  online++;
294  if (online > 2)
295  break;
296  }
297  fclose(fp);
298  if (online <= 2)
299  LOG(llevError, "Online read partial data from %s\n", filename);
300  LOG(llevDebug, "emergency map set to %s (%d, %d)\n",
303  }
304 }
305 
313 void init_library(void) {
314  init_log();
315  init_environ();
316  init_hash_table();
317  init_globals();
318  init_stats(); /* Needs to be fairly early, since the loader will check
319  * against the settings.max_stat value */
320 
321  for (int mess = 0; mess < MAXATTACKMESS; mess++) {
322  for (int level = 0; level < MAXATTACKMESS; level++) {
323  attack_mess[mess][level].level = -1;
324  attack_mess[mess][level].buf1 = NULL;
325  attack_mess[mess][level].buf2 = NULL;
326  attack_mess[mess][level].buf3 = NULL;
327  }
328  }
329 
330  assets_init();
331  i18n_init();
332  init_objects();
333  init_block();
334 
335  load_assets();
336 
337  init_clocks();
339  init_experience();
340 
341  if (getManager()->dumpUndefined() > 0 && !settings.ignore_assets_errors) {
342  LOG(llevError, "Assets errors, please fix and restart.\n");
344  }
345 
346  init_dynamic();
347 }
348 
354 static void init_environ(void) {
355  char *cp;
356 
357  cp = getenv("CROSSFIRE_LIBDIR");
358  if (cp)
359  settings.datadir = cp;
360  cp = getenv("CROSSFIRE_LOCALDIR");
361  if (cp)
362  settings.localdir = cp;
363  cp = getenv("CROSSFIRE_PLAYERDIR");
364  if (cp)
365  settings.playerdir = cp;
366  cp = getenv("CROSSFIRE_MAPDIR");
367  if (cp)
368  settings.mapdir = cp;
369  cp = getenv("CROSSFIRE_UNIQUEDIR");
370  if (cp)
371  settings.uniquedir = cp;
372  cp = getenv("CROSSFIRE_TEMPLATEDIR");
373  if (cp)
374  settings.templatedir = cp;
375  cp = getenv("CROSSFIRE_TMPDIR");
376  if (cp)
377  settings.tmpdir = cp;
378 }
379 
386 void init_globals(void) {
387  memset(&statistics, 0, sizeof(struct Statistics));
388 
389  /* Log to stderr by default. */
390  logfile = stderr;
391 
392  /* Try to open the log file specified on the command-line. */
393  if (settings.logfilename != NULL) {
394  logfile = fopen(settings.logfilename, "a");
395 
396  /* If writable, set buffer mode to per-line. */
397  if (logfile != NULL) {
398  setvbuf(logfile, NULL, _IOLBF, 0);
399  } else {
400  logfile = stderr;
401 
402  LOG(llevError, "Could not open '%s' for logging.\n",
404  }
405  }
406 
407  exiting = 0;
408  first_player = NULL;
409  first_map = NULL;
410  first_artifactlist = NULL;
411  *first_map_ext_path = 0;
412  nrofartifacts = 0;
413  nrofallowedstr = 0;
414  undead_name = add_string("undead");
415  blocks_prayer = add_string("blocks_prayer");
417  init_defaults();
418 }
419 
430 void free_globals(void) {
431  int msg, attack;
432 
435  for (msg = 0; msg < NROFATTACKMESS; msg++)
436  for (attack = 0; attack < MAXATTACKMESS; attack++) {
437  free(attack_mess[msg][attack].buf1);
438  free(attack_mess[msg][attack].buf2);
439  free(attack_mess[msg][attack].buf3);
440  }
441 
443 
445  free_experience();
446 
447  for (auto region : all_regions) {
453  }
454  all_regions.clear();
455 
456  assets_free();
457 }
458 
463 static void init_defaults(void) {
464  nroferrors = 0;
465 }
466 
476 static void init_dynamic(void) {
478  if (!at) {
479  LOG(llevError, "You need a archetype for a legacy map, with type %d and subtype %d\n", MAP, MAP_TYPE_LEGACY);
481  }
482  if (EXIT_PATH(&at->clone)) {
483  mapstruct *first;
484 
486  first = ready_map_name(first_map_path, 0);
487  if (!first) {
488  LOG(llevError, "Initial map %s can't be found! Please ensure maps are correctly installed.\n", first_map_path);
489  LOG(llevError, "Unable to continue without initial map.\n");
491  }
492  delete_map(first);
493  } else {
494  LOG(llevError, "Legacy map must have a 'slaying' field!\n");
496  }
497 
499  LOG(llevError, "Can not find object of type MAP subtype MAP_TYPE_DEFAULT.\n");
500  LOG(llevError, "Are the archetype files up to date? Can not continue.\n");
502  }
503 }
504 
509 void write_todclock(void) {
510  char filename[MAX_BUF];
511  FILE *fp;
512  OutputFile of;
513 
514  snprintf(filename, sizeof(filename), "%s/clockdata", settings.localdir);
515  fp = of_open(&of, filename);
516  if (fp == NULL)
517  return;
518  fprintf(fp, "%lu", todtick);
519  of_close(&of);
520 }
521 
526 static void init_clocks(void) {
527  char filename[MAX_BUF];
528  FILE *fp;
529  static int has_been_done = 0;
530 
531  if (has_been_done)
532  return;
533  else
534  has_been_done = 1;
535 
536  snprintf(filename, sizeof(filename), "%s/clockdata", settings.localdir);
537  fp = fopen(filename, "r");
538  if (fp == NULL) {
539  LOG(llevDebug, "clockdata not found, starting time at zero\n");
540  todtick = 0;
541  write_todclock();
542  return;
543  }
544  /* Read TOD and default to 0 on failure. */
545  if (fscanf(fp, "%lu", &todtick) == 1) {
546  LOG(llevDebug, "clockdata: todtick is %lu\n", todtick);
547  fclose(fp);
548  } else {
549  LOG(llevError, "Couldn't parse todtick, using default value 0\n");
550  todtick = 0;
551  fclose(fp);
552  write_todclock();
553  }
554 }
555 
562 void init_attackmess(BufferReader *reader, const char *filename) {
563  char *buf;
564  char *cp, *p;
565  int mess = -1, level;
566  int mode = 0, total = 0;
567 
568  level = 0;
569  while ((buf = bufferreader_next_line(reader)) != NULL) {
570  if (*buf == '#' || *buf == '\0')
571  continue;
572  /*
573  * Skip blanks -- strspn is slightly faster than a loop w/ optimization on
574  * Also, note we go from the beginning of the line again, since cp was at the end.
575  * While here, also skip tabs for more complete whitespace handling.
576  *
577  * SilverNexus 2018-01-21
578  */
579  cp = buf + strspn(buf, " \t");
580 
581  if (strncmp(cp, "TYPE:", 5) == 0) {
582  p = strtok(buf, ":");
583  p = strtok(NULL, ":");
584  if (mode == 1) {
585  attack_mess[mess][level].level = -1;
586  free(attack_mess[mess][level].buf1);
587  free(attack_mess[mess][level].buf2);
588  free(attack_mess[mess][level].buf3);
589  attack_mess[mess][level].buf1 = NULL;
590  attack_mess[mess][level].buf2 = NULL;
591  attack_mess[mess][level].buf3 = NULL;
592  }
593  level = 0;
594  mess = atoi(p);
595  mode = 1;
596  continue;
597  }
598  if (mode == 1) {
599  p = strtok(buf, "=");
600  attack_mess[mess][level].level = atoi(buf);
601  p = strtok(NULL, "=");
602  free(attack_mess[mess][level].buf1);
603  if (p != NULL)
604  attack_mess[mess][level].buf1 = strdup_local(p);
605  else
606  attack_mess[mess][level].buf1 = strdup_local("");
607  mode = 2;
608  continue;
609  } else if (mode == 2) {
610  p = strtok(buf, "=");
611  attack_mess[mess][level].level = atoi(buf);
612  p = strtok(NULL, "=");
613  free(attack_mess[mess][level].buf2);
614  if (p != NULL)
615  attack_mess[mess][level].buf2 = strdup_local(p);
616  else
617  attack_mess[mess][level].buf2 = strdup_local("");
618  mode = 3;
619  continue;
620  } else if (mode == 3) {
621  p = strtok(buf, "=");
622  attack_mess[mess][level].level = atoi(buf);
623  p = strtok(NULL, "=");
624  free(attack_mess[mess][level].buf3);
625  if (p != NULL)
626  attack_mess[mess][level].buf3 = strdup_local(p);
627  else
628  attack_mess[mess][level].buf3 = strdup_local("");
629  mode = 1;
630  level++;
631  total++;
632  continue;
633  }
634  }
635  LOG(llevDebug, "attackmsg %s: %d messages in %d categories\n", filename, total, mess+1);
636 }
init_globals
void init_globals(void)
Initialises all global variables.
Definition: init.cpp:386
init_objects
void init_objects(void)
Sets up and initialises the linked list of free and used objects.
Definition: object.cpp:327
init_dynamic
static void init_dynamic(void)
Initializes first_map_path from the archetype collection, and check that some required archetype actu...
Definition: init.cpp:476
NROFATTACKMESS
#define NROFATTACKMESS
Definition: attack.h:16
Settings::mapdir
const char * mapdir
Where the map files are.
Definition: global.h:256
output_file.h
global.h
DEATH_PENALTY_LEVEL
#define DEATH_PENALTY_LEVEL
Definition: config.h:152
SPELL_ENCUMBRANCE
#define SPELL_ENCUMBRANCE
Definition: config.h:156
AT_ELECTRICITY
#define AT_ELECTRICITY
Can also ignite objects (8)
Definition: attack.h:81
nrofartifacts
long nrofartifacts
Only used in malloc_info().
Definition: init.cpp:116
first_player
player * first_player
First player.
Definition: init.cpp:106
settings
struct Settings settings
Global settings.
Definition: init.cpp:139
MAP
@ MAP
Definition: object.h:130
Settings::emergency_y
uint16_t emergency_y
Coordinates to use on that map.
Definition: global.h:303
statistics
struct Statistics statistics
Merged spell statistics.
Definition: init.cpp:227
llevError
@ llevError
Problems requiring server admin to fix.
Definition: logger.h:11
init_emergency_mappath
static void init_emergency_mappath(void)
This loads the emergency map information from a .emergency file in the map directory.
Definition: init.cpp:269
LOG
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
Definition: logger.cpp:82
of_close
int of_close(OutputFile *of)
Closes an output file.
Definition: output_file.cpp:61
of_open
FILE * of_open(OutputFile *of, const char *fname)
Opens an output file.
Definition: output_file.cpp:30
player
One player.
Definition: player.h:107
strdup_local
#define strdup_local
Definition: compat.h:29
EMERGENCY_Y
#define EMERGENCY_Y
Definition: config.h:509
ready_map_name
mapstruct * ready_map_name(const char *name, int flags)
Makes sure the given map is loaded and swapped in.
Definition: map.cpp:1780
first_map_path
char first_map_path[MAX_BUF]
The start-level.
Definition: init.cpp:120
AssetsManager.h
spellpathnames
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...
Definition: init.cpp:234
first_map_ext_path
char first_map_ext_path[MAX_BUF]
Path used for per-race start maps.
Definition: init.cpp:121
Settings::datadir
const char * datadir
Read only data files.
Definition: global.h:253
AT_COLD
#define AT_COLD
Can freeze objects into ice cubes (16)
Definition: attack.h:82
EXIT_PATH
#define EXIT_PATH(xyz)
Definition: define.h:424
init_attackmess
void init_attackmess(BufferReader *reader, const char *filename)
Initializes the attack messages.
Definition: init.cpp:562
MAPDIR
#define MAPDIR
These defines tells where, relative to LIBDIR, the maps, the map-index, highscore files and directori...
Definition: config.h:515
MOTD
#define MOTD
Defining MEMORY_DEBUG disables Crossfire's object allocator, which allocates OBJ_EXPAND objects at a ...
Definition: config.h:448
UNIQUE_DIR
#define UNIQUE_DIR
Directory to use for unique items.
Definition: config.h:496
attackmess_t::buf1
char * buf1
Definition: attack.h:122
MAP_TYPE_DEFAULT
#define MAP_TYPE_DEFAULT
If no map is specified, where character starts.
Definition: map.h:60
init_clocks
static void init_clocks(void)
Initializes the gametime and TOD counters Called by init_library().
Definition: init.cpp:526
Settings::emergency_x
uint16_t emergency_x
Definition: global.h:303
SEE_LAST_ERROR
@ SEE_LAST_ERROR
Definition: define.h:52
region::name
char * name
Shortend name of the region as maps refer to it.
Definition: map.h:280
SIMPLE_EXP
#define SIMPLE_EXP
Definition: config.h:154
MAP_TYPE_LEGACY
#define MAP_TYPE_LEGACY
For old character creation method.
Definition: map.h:59
clear_friendly_list
void clear_friendly_list(void)
Totally clear the friendly list.
Definition: friend.cpp:134
NROFATTACKS
#define NROFATTACKS
Definition: attack.h:15
assets_free
void assets_free()
Free all assets-related memory.
Definition: assets.cpp:72
Statistics
This is used for various performance tracking statistics, or just how often certain events are done.
Definition: global.h:355
materials
std::vector< materialtype_t * > materials
Definition: init.cpp:128
MAXATTACKMESS
#define MAXATTACKMESS
Definition: attack.h:17
Settings::ignore_assets_errors
int ignore_assets_errors
If set then go on running even if there are errors in assets.
Definition: global.h:334
SET_TITLE
#define SET_TITLE
Definition: config.h:153
buf
StringBuffer * buf
Definition: readable.cpp:1564
getManager
AssetsManager * getManager()
Definition: assets.cpp:309
REGIONS
#define REGIONS
Definition: config.h:517
init_stats
void init_stats()
This loads statistic bonus/penalties from the stat_bonus file.
Definition: living.cpp:2520
i18n_init
void i18n_init(void)
Initializes the i18n subsystem.
Definition: languages.cpp:131
region::longname
char * longname
Official title of the region, this might be defined to be the same as name.
Definition: map.h:286
DEATH_PENALTY_RATIO
#define DEATH_PENALTY_RATIO
Definition: config.h:151
RESURRECTION
#define RESURRECTION
Definition: config.h:161
write_todclock
void write_todclock(void)
Write out the current time to the file so time does not reset every time the server reboots.
Definition: init.cpp:509
nrofallowedstr
long nrofallowedstr
Only used in malloc_info().
Definition: init.cpp:117
RECYCLE_TMP_MAPS
#define RECYCLE_TMP_MAPS
Definition: config.h:159
init_block
void init_block(void)
initialises the array used by the LOS routines.
Definition: los.cpp:106
ARMOR_SPEED_IMPROVEMENT
#define ARMOR_SPEED_IMPROVEMENT
Definition: config.h:171
init_environ
static void init_environ(void)
Initializes values from the environmental variables.
Definition: init.cpp:354
SPELLPOINT_LEVEL_DEPEND
#define SPELLPOINT_LEVEL_DEPEND
Definition: config.h:155
PK_LUCK_PENALTY
#define PK_LUCK_PENALTY
Definition: config.h:165
archetype::clone
object clone
An object from which to do object_copy()
Definition: object.h:487
Settings::logfilename
const char * logfilename
Logfile to use.
Definition: global.h:246
add_string
sstring add_string(const char *str)
Share a string.
Definition: shstr.cpp:137
first_map
mapstruct * first_map
First map.
Definition: init.cpp:107
init_log
void init_log()
Definition: logger.cpp:62
region::msg
char * msg
The description of the region.
Definition: map.h:288
trying_emergency_save
long trying_emergency_save
True when emergency_save() is reached.
Definition: init.cpp:111
region::jailmap
char * jailmap
Where a player that is arrested in this region should be imprisoned.
Definition: map.h:292
change_resist_msg
const char *const change_resist_msg[NROFATTACKS]
These are the descriptions of the resistances displayed when a player puts on/takes off an item.
Definition: init.cpp:70
SEARCH_ITEMS
#define SEARCH_ITEMS
Definition: config.h:162
nroferrors
long nroferrors
If it exceeds MAX_ERRORS, call fatal()
Definition: init.cpp:112
todtick
unsigned long todtick
Game world time, in in-game hours.
Definition: time.cpp:38
ARMOR_SPEED_LINEAR
#define ARMOR_SPEED_LINEAR
Definition: config.h:172
ARMOR_WEIGHT_REDUCTION
#define ARMOR_WEIGHT_REDUCTION
Definition: config.h:169
ARMOR_MAX_ENCHANT
#define ARMOR_MAX_ENCHANT
Definition: config.h:168
artifactlist
This represents all archetypes for one particular object type.
Definition: artifact.h:24
resist_save
const char *const resist_save[NROFATTACKS]
Attack types.
Definition: init.cpp:31
archetype
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
Definition: object.h:483
logfile
FILE * logfile
Used by server/daemon.c.
Definition: init.cpp:114
delete_map
void delete_map(mapstruct *m)
Frees the map, including the mapstruct.
Definition: map.cpp:1708
TMPDIR
#define TMPDIR
Your tmp-directory should be large enough to hold the uncompressed map-files for all who are playing.
Definition: config.h:488
ATTACKS
Chaos_Attacks ATTACKS[22]
Some local definitions for shuffle_attack().
Definition: init.cpp:81
undead_name
const char * undead_name
Definition: init.cpp:125
fatal
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
Definition: utils.cpp:595
resist_plus
const char *const resist_plus[NROFATTACKS]
Attack types to show to the player.
Definition: init.cpp:49
MAX_BUF
#define MAX_BUF
Used for all kinds of things.
Definition: define.h:35
CASTING_TIME
#define CASTING_TIME
Definition: config.h:166
strlcpy
size_t strlcpy(char *dst, const char *src, size_t size)
Portable implementation of strlcpy(3).
Definition: porting.cpp:222
Settings::playerdir
const char * playerdir
Where the player files are.
Definition: global.h:255
FREE_AND_CLEAR_STR
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
Definition: global.h:204
ob_count
long ob_count
Definition: init.cpp:123
attack_mess
attackmess_t attack_mess[NROFATTACKMESS][MAXATTACKMESS]
Definition: init.cpp:78
Settings
Server settings.
Definition: global.h:245
region
This is a game region.
Definition: map.h:279
ARMOR_WEIGHT_LINEAR
#define ARMOR_WEIGHT_LINEAR
Definition: config.h:170
STAT_LOSS_ON_DEATH
#define STAT_LOSS_ON_DEATH
Definition: config.h:164
Settings::emergency_mapname
char * emergency_mapname
Map to return players to in emergency.
Definition: global.h:302
llevInfo
@ llevInfo
Information.
Definition: logger.h:14
all_regions
std::vector< region * > all_regions
Definition: init.cpp:108
REAL_WIZ
#define REAL_WIZ
Definition: config.h:158
SET_FRIENDLY_FIRE
#define SET_FRIENDLY_FIRE
Definition: config.h:167
init_library
void init_library(void)
It is vital that init_library() is called by any functions using this library.
Definition: init.cpp:313
attacktype_desc
const char *const attacktype_desc[NROFATTACKS]
Short description of names of the attacktypes.
Definition: init.cpp:40
FREE_AND_CLEAR
#define FREE_AND_CLEAR(xyz)
Free the pointer and then set it to NULL.
Definition: global.h:199
init_hash_table
void init_hash_table(void)
Initialises the hash-table used by the shared string library.
Definition: shstr.cpp:69
mapstruct
This is a game-map.
Definition: map.h:320
ALWAYS_SHOW_HP
#define ALWAYS_SHOW_HP
Definition: config.h:160
sstring
const typedef char * sstring
Definition: sstring.h:2
free_experience
void free_experience(void)
Frees experience-related memory.
Definition: exp.cpp:263
AT_POISON
#define AT_POISON
Some damage each turn thereafter (1024)
Definition: attack.h:88
TEMPLATE_DIR
#define TEMPLATE_DIR
Definition: config.h:516
init_experience
void init_experience(void)
This loads the experience table from the exp_table file.
Definition: exp.cpp:167
RESET_LOCATION_TIME
#define RESET_LOCATION_TIME
By selecting the following, whenever a player does a backup save (with the 'save' command),...
Definition: config.h:629
attackmess_t::buf2
char * buf2
Definition: attack.h:123
free_globals
void free_globals(void)
Cleans all memory allocated for global variables.
Definition: init.cpp:430
assets.h
SPELL_FAILURE_EFFECTS
#define SPELL_FAILURE_EFFECTS
Definition: config.h:157
init_defaults
static void init_defaults(void)
Initialises global variables which can be changed by options.
Definition: init.cpp:463
AT_FIRE
#define AT_FIRE
Can ignite objects (4)
Definition: attack.h:80
BALANCED_STAT_LOSS
#define BALANCED_STAT_LOSS
Definition: config.h:149
resist_color
const char *const resist_color[NROFATTACKS]
Colors to add to the resistances for media tags.
Definition: init.cpp:61
PERMANENT_EXPERIENCE_RATIO
#define PERMANENT_EXPERIENCE_RATIO
Definition: config.h:150
level
int level
Definition: readable.cpp:1562
first_artifactlist
artifactlist * first_artifactlist
First artifact.
Definition: init.cpp:109
attackmess_t::level
int level
Definition: attack.h:121
AT_PHYSICAL
#define AT_PHYSICAL
Basic attack (1)
Definition: attack.h:78
EMERGENCY_X
#define EMERGENCY_X
Definition: config.h:508
get_archetype_by_type_subtype
archetype * get_archetype_by_type_subtype(int type, int subtype)
Retrieves an archetype by type and subtype.
Definition: arch.cpp:97
Settings::templatedir
const char * templatedir
Directory for the template map.
Definition: global.h:259
PLAYERDIR
#define PLAYERDIR
If you want the players to be able to save their characters between games, define SAVE_PLAYER and set...
Definition: config.h:549
AT_CONFUSION
#define AT_CONFUSION
Movement/attack directions become random (32)
Definition: attack.h:83
AT_MAGIC
#define AT_MAGIC
All magic spells, but not prayers (2)
Definition: attack.h:79
AT_FEAR
#define AT_FEAR
(16384)
Definition: attack.h:92
AT_SLOW
#define AT_SLOW
Speed is reduced (2048)
Definition: attack.h:89
empty_archetype
archetype * empty_archetype
Nice to have fast access to it.
Definition: init.cpp:119
Chaos_Attacks
Definition: attack.h:127
load_assets
void load_assets(void)
Definition: assets.cpp:551
blocks_prayer
sstring blocks_prayer
For update_position() mostly.
Definition: init.cpp:126
Settings::tmpdir
const char * tmpdir
Directory to use for temporary files.
Definition: global.h:260
AT_PARALYZE
#define AT_PARALYZE
Speed is reduced to zero (4096)
Definition: attack.h:90
EMERGENCY_MAPPATH
#define EMERGENCY_MAPPATH
These define the players starting map and location on that map, and where emergency saves are defined...
Definition: config.h:506
CSPORT
#define CSPORT
CSPORT is the port used for the new client/server code.
Definition: config.h:362
BufferReader
Definition: bufferreader.cpp:21
assets_init
void assets_init()
Init assets-related variables.
Definition: assets.cpp:65
exiting
int exiting
True if the game is about to exit.
Definition: init.cpp:115
attackmess_t
Attack messages structure.
Definition: attack.h:120
object.h
NOT_PERMADETH
#define NOT_PERMADETH
Definition: config.h:163
llevDebug
@ llevDebug
Only for debugging purposes.
Definition: logger.h:15
NRSPELLPATHS
#define NRSPELLPATHS
Number of spell paths.
Definition: spells.h:40
Settings::uniquedir
const char * uniquedir
Directory for the unique items.
Definition: global.h:258
OutputFile
Definition: output_file.h:41
bufferreader_next_line
char * bufferreader_next_line(BufferReader *br)
Return the next line in the buffer, as separated by a newline.
Definition: bufferreader.cpp:102
attackmess_t::buf3
char * buf3
Definition: attack.h:124
Settings::localdir
const char * localdir
Read/write data files.
Definition: global.h:254