Crossfire Server, Trunk
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  .worldmaptilesizex = 0,
190  .worldmaptilesizey = 0,
191  .fastclock = 0,
192  .emergency_mapname = nullptr,
193  .emergency_x = EMERGENCY_X,
194  .emergency_y = EMERGENCY_Y,
195  .max_level = 0,
196  .item_power_factor = 1.0,
197  /* Armor enchantment stuff */
198  .armor_max_enchant = ARMOR_MAX_ENCHANT,
199  .armor_weight_reduction = ARMOR_WEIGHT_REDUCTION,
200  .armor_weight_linear = ARMOR_WEIGHT_LINEAR,
201  .armor_speed_improvement = ARMOR_SPEED_IMPROVEMENT,
202  .armor_speed_linear = ARMOR_SPEED_LINEAR,
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,
210  .log_timestamp = 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,
216  .max_stat = 0, /* max_stat - will be loaded from stats file */
217  .special_break_map = 1, /* 1 for historical reasons */
218  .disabled_plugins = { },
219  .ignore_plugin_compatibility = 0,
220  .account_block_create = 0,
221  .account_trusted_host = nullptr,
222  .crypt_mode = 0,
223  .min_name = 0,
224  .hooks_count = 0,
225  .hooks_filename = { nullptr },
226  .hooks = { nullptr },
227  .ignore_assets_errors = 0,
228  .assets_tracker = nullptr,
229  .fatal_hook = nullptr,
230 };
231 
233 
239 const char *const spellpathnames[NRSPELLPATHS] = {
240  "Protection",
241  "Fire",
242  "Frost",
243  "Electricity",
244  "Missiles",
245  "Self",
246  "Summoning",
247  "Abjuration",
248  "Restoration",
249  "Detonation",
250  "Mind",
251  "Creation",
252  "Teleportation",
253  "Information",
254  "Transmutation",
255  "Transferrence",
256  "Turning",
257  "Wounding",
258  "Death",
259  "Light"
260 };
261 
262 
274 static void init_emergency_mappath(void) {
275  char filename[MAX_BUF], tmpbuf[MAX_BUF];
276  FILE *fp;
277  int online = 0;
278 
280 
281  /* If this file doesn't exist, not a big deal */
282  snprintf(filename, sizeof(filename), "%s/%s/.emergency", settings.datadir, settings.mapdir);
283  fp = fopen(filename, "r");
284  if (fp != NULL) {
285  while (fgets(tmpbuf, MAX_BUF-1, fp)) {
286  if (tmpbuf[0] == '#')
287  continue; /* ignore comments */
288 
289  if (online == 0) {
290  tmpbuf[strlen(tmpbuf)-1] = 0; /* kill newline */
293  } else if (online == 1) {
294  settings.emergency_x = atoi(tmpbuf);
295  } else if (online == 2) {
296  settings.emergency_y = atoi(tmpbuf);
297  }
298  online++;
299  if (online > 2)
300  break;
301  }
302  fclose(fp);
303  if (online <= 2)
304  LOG(llevError, "Online read partial data from %s\n", filename);
305  LOG(llevDebug, "emergency map set to %s (%d, %d)\n",
308  }
309 }
310 
311 void load_assets(void) {
313  assets_end_load();
314 }
315 
323 void init_library(void) {
324  init_environ();
325  init_hash_table();
326  init_globals();
327  init_stats(); /* Needs to be fairly early, since the loader will check
328  * against the settings.max_stat value */
329 
330  for (int mess = 0; mess < MAXATTACKMESS; mess++) {
331  for (int level = 0; level < MAXATTACKMESS; level++) {
332  attack_mess[mess][level].level = -1;
333  attack_mess[mess][level].buf1 = NULL;
334  attack_mess[mess][level].buf2 = NULL;
335  attack_mess[mess][level].buf3 = NULL;
336  }
337  }
338 
339  assets_init();
340  i18n_init();
341  init_objects();
342  init_block();
343 
344  load_assets();
345 
346  init_clocks();
348  init_experience();
349 
350  if (getManager()->dumpUndefined() > 0 && !settings.ignore_assets_errors) {
351  LOG(llevError, "Assets errors, please fix and restart.\n");
353  }
354 
355  init_dynamic();
356 }
357 
363 static void init_environ(void) {
364  char *cp;
365 
366  cp = getenv("CROSSFIRE_LIBDIR");
367  if (cp)
368  settings.datadir = cp;
369  cp = getenv("CROSSFIRE_LOCALDIR");
370  if (cp)
371  settings.localdir = cp;
372  cp = getenv("CROSSFIRE_PLAYERDIR");
373  if (cp)
374  settings.playerdir = cp;
375  cp = getenv("CROSSFIRE_MAPDIR");
376  if (cp)
377  settings.mapdir = cp;
378  cp = getenv("CROSSFIRE_UNIQUEDIR");
379  if (cp)
380  settings.uniquedir = cp;
381  cp = getenv("CROSSFIRE_TEMPLATEDIR");
382  if (cp)
383  settings.templatedir = cp;
384  cp = getenv("CROSSFIRE_TMPDIR");
385  if (cp)
386  settings.tmpdir = cp;
387 }
388 
395 void init_globals(void) {
396  memset(&statistics, 0, sizeof(struct Statistics));
397 
398  /* Log to stderr by default. */
399  logfile = stderr;
400 
401  /* Try to open the log file specified on the command-line. */
402  if (settings.logfilename != NULL) {
403  logfile = fopen(settings.logfilename, "a");
404 
405  /* If writable, set buffer mode to per-line. */
406  if (logfile != NULL) {
407  setvbuf(logfile, NULL, _IOLBF, 0);
408  } else {
409  logfile = stderr;
410 
411  LOG(llevError, "Could not open '%s' for logging.\n",
413  }
414  }
415 
416  exiting = 0;
417  first_player = NULL;
418  first_map = NULL;
419  first_artifactlist = NULL;
420  *first_map_ext_path = 0;
421  nrofartifacts = 0;
422  nrofallowedstr = 0;
423  undead_name = add_string("undead");
424  blocks_prayer = add_string("blocks_prayer");
426  init_defaults();
427 }
428 
439 void free_globals(void) {
440  int msg, attack;
441 
444  for (msg = 0; msg < NROFATTACKMESS; msg++)
445  for (attack = 0; attack < MAXATTACKMESS; attack++) {
446  free(attack_mess[msg][attack].buf1);
447  free(attack_mess[msg][attack].buf2);
448  free(attack_mess[msg][attack].buf3);
449  }
450 
452 
454  free_experience();
455 
456  for (auto region : all_regions) {
462  }
463  all_regions.clear();
464 
465  assets_free();
466 }
467 
472 static void init_defaults(void) {
473  nroferrors = 0;
474 }
475 
485 static void init_dynamic(void) {
487  if (!at) {
488  LOG(llevError, "You need a archetype for a legacy map, with type %d and subtype %d\n", MAP, MAP_TYPE_LEGACY);
490  }
491  if (EXIT_PATH(&at->clone)) {
492  mapstruct *first;
493 
496  if (!first) {
497  LOG(llevError, "Initial map %s can't be found! Please ensure maps are correctly installed.\n", first_map_path);
498  LOG(llevError, "Unable to continue without initial map.\n");
500  }
501  delete_map(first);
502  } else {
503  LOG(llevError, "Legacy map must have a 'slaying' field!\n");
505  }
506 
508  LOG(llevError, "Can not find object of type MAP subtype MAP_TYPE_DEFAULT.\n");
509  LOG(llevError, "Are the archetype files up to date? Can not continue.\n");
511  }
512 }
513 
518 void write_todclock(void) {
519  char filename[MAX_BUF];
520  FILE *fp;
521  OutputFile of;
522 
523  snprintf(filename, sizeof(filename), "%s/clockdata", settings.localdir);
524  fp = of_open(&of, filename);
525  if (fp == NULL)
526  return;
527  fprintf(fp, "%lu", todtick);
528  of_close(&of);
529 }
530 
535 static void init_clocks(void) {
536  char filename[MAX_BUF];
537  FILE *fp;
538  static int has_been_done = 0;
539 
540  if (has_been_done)
541  return;
542  else
543  has_been_done = 1;
544 
545  snprintf(filename, sizeof(filename), "%s/clockdata", settings.localdir);
546  fp = fopen(filename, "r");
547  if (fp == NULL) {
548  LOG(llevError, "Can't open %s.\n", filename);
549  todtick = 0;
550  write_todclock();
551  return;
552  }
553  /* Read TOD and default to 0 on failure. */
554  if (fscanf(fp, "%lu", &todtick) == 1) {
555  LOG(llevDebug, "clockdata: todtick is %lu\n", todtick);
556  fclose(fp);
557  } else {
558  LOG(llevError, "Couldn't parse todtick, using default value 0\n");
559  todtick = 0;
560  fclose(fp);
561  write_todclock();
562  }
563 }
564 
571 void init_attackmess(BufferReader *reader, const char *filename) {
572  char *buf;
573  char *cp, *p;
574  int mess = -1, level;
575  int mode = 0, total = 0;
576 
577  level = 0;
578  while ((buf = bufferreader_next_line(reader)) != NULL) {
579  if (*buf == '#' || *buf == '\0')
580  continue;
581  /*
582  * Skip blanks -- strspn is slightly faster than a loop w/ optimization on
583  * Also, note we go from the beginning of the line again, since cp was at the end.
584  * While here, also skip tabs for more complete whitespace handling.
585  *
586  * SilverNexus 2018-01-21
587  */
588  cp = buf + strspn(buf, " \t");
589 
590  if (strncmp(cp, "TYPE:", 5) == 0) {
591  p = strtok(buf, ":");
592  p = strtok(NULL, ":");
593  if (mode == 1) {
594  attack_mess[mess][level].level = -1;
595  free(attack_mess[mess][level].buf1);
596  free(attack_mess[mess][level].buf2);
597  free(attack_mess[mess][level].buf3);
598  attack_mess[mess][level].buf1 = NULL;
599  attack_mess[mess][level].buf2 = NULL;
600  attack_mess[mess][level].buf3 = NULL;
601  }
602  level = 0;
603  mess = atoi(p);
604  mode = 1;
605  continue;
606  }
607  if (mode == 1) {
608  p = strtok(buf, "=");
609  attack_mess[mess][level].level = atoi(buf);
610  p = strtok(NULL, "=");
611  free(attack_mess[mess][level].buf1);
612  if (p != NULL)
613  attack_mess[mess][level].buf1 = strdup_local(p);
614  else
615  attack_mess[mess][level].buf1 = strdup_local("");
616  mode = 2;
617  continue;
618  } else if (mode == 2) {
619  p = strtok(buf, "=");
620  attack_mess[mess][level].level = atoi(buf);
621  p = strtok(NULL, "=");
622  free(attack_mess[mess][level].buf2);
623  if (p != NULL)
624  attack_mess[mess][level].buf2 = strdup_local(p);
625  else
626  attack_mess[mess][level].buf2 = strdup_local("");
627  mode = 3;
628  continue;
629  } else if (mode == 3) {
630  p = strtok(buf, "=");
631  attack_mess[mess][level].level = atoi(buf);
632  p = strtok(NULL, "=");
633  free(attack_mess[mess][level].buf3);
634  if (p != NULL)
635  attack_mess[mess][level].buf3 = strdup_local(p);
636  else
637  attack_mess[mess][level].buf3 = strdup_local("");
638  mode = 1;
639  level++;
640  total++;
641  continue;
642  }
643  }
644  LOG(llevDebug, "attackmsg %s: %d messages in %d categories\n", filename, total, mess+1);
645 }
init_globals
void init_globals(void)
Definition: init.cpp:395
init_objects
void init_objects(void)
Definition: object.cpp:327
init_dynamic
static void init_dynamic(void)
Definition: init.cpp:485
NROFATTACKMESS
#define NROFATTACKMESS
Definition: attack.h:18
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
nrofartifacts
long nrofartifacts
Definition: init.cpp:116
first_player
player * first_player
Definition: init.cpp:106
settings
struct Settings settings
Definition: init.cpp:139
MAP
@ MAP
Definition: object.h:130
AT_POISON
#define AT_POISON
Definition: attack.h:86
AT_MAGIC
#define AT_MAGIC
Definition: attack.h:77
Settings::uniquedir
const char * uniquedir
Definition: global.h:253
statistics
struct Statistics statistics
Definition: init.cpp:232
llevError
@ llevError
Definition: logger.h:11
init_emergency_mappath
static void init_emergency_mappath(void)
Definition: init.cpp:274
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.cpp:51
of_close
int of_close(OutputFile *of)
Definition: output_file.cpp:61
Statistics
Definition: global.h:361
of_open
FILE * of_open(OutputFile *of, const char *fname)
Definition: output_file.cpp:30
player
Definition: player.h:105
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)
Definition: map.cpp:1759
AT_ELECTRICITY
#define AT_ELECTRICITY
Definition: attack.h:79
first_map_path
char first_map_path[MAX_BUF]
Definition: init.cpp:120
spellpathnames
const char *const spellpathnames[NRSPELLPATHS]
Definition: init.cpp:239
first_map_ext_path
char first_map_ext_path[MAX_BUF]
Definition: init.cpp:121
Settings
Definition: global.h:240
AT_PHYSICAL
#define AT_PHYSICAL
Definition: attack.h:76
todtick
unsigned long todtick
Definition: time.cpp:38
EXIT_PATH
#define EXIT_PATH(xyz)
Definition: define.h:439
init_attackmess
void init_attackmess(BufferReader *reader, const char *filename)
Definition: init.cpp:571
MAPDIR
#define MAPDIR
Definition: config.h:515
Settings::templatedir
const char * templatedir
Definition: global.h:254
Settings::localdir
const char * localdir
Definition: global.h:249
MOTD
#define MOTD
Definition: config.h:448
UNIQUE_DIR
#define UNIQUE_DIR
Definition: config.h:496
Settings::ignore_assets_errors
int ignore_assets_errors
Definition: global.h:335
mail_login.total
total
Definition: mail_login.py:30
attackmess_t::buf1
char * buf1
Definition: attack.h:120
Settings::tmpdir
const char * tmpdir
Definition: global.h:255
mode
linux kernel c mode(defun linux-c-mode() "C mode with adjusted defaults for use with the Linux kernel."(interactive)(c-mode)(c-set-style "K&R")(setq c-basic-offset 8))
init_clocks
static void init_clocks(void)
Definition: init.cpp:535
SEE_LAST_ERROR
@ SEE_LAST_ERROR
Definition: define.h:52
region::name
char * name
Definition: map.h:274
SIMPLE_EXP
#define SIMPLE_EXP
Definition: config.h:154
clear_friendly_list
void clear_friendly_list(void)
Definition: friend.cpp:134
NROFATTACKS
#define NROFATTACKS
Definition: attack.h:17
npc_dialog.filename
filename
Definition: npc_dialog.py:99
assets_free
void assets_free()
Definition: assets.cpp:72
materials
std::vector< materialtype_t * > materials
Definition: init.cpp:128
AssetsManager.h
MAXATTACKMESS
#define MAXATTACKMESS
Definition: attack.h:19
SET_TITLE
#define SET_TITLE
Definition: config.h:153
buf
StringBuffer * buf
Definition: readable.cpp:1552
getManager
AssetsManager * getManager()
Definition: assets.cpp:305
REGIONS
#define REGIONS
Definition: config.h:517
init_stats
void init_stats()
Definition: living.cpp:2584
i18n_init
void i18n_init(void)
Definition: languages.cpp:130
region::longname
char * longname
Definition: map.h:280
DEATH_PENALTY_RATIO
#define DEATH_PENALTY_RATIO
Definition: config.h:151
RESURRECTION
#define RESURRECTION
Definition: config.h:161
write_todclock
void write_todclock(void)
Definition: init.cpp:518
nrofallowedstr
long nrofallowedstr
Definition: init.cpp:117
RECYCLE_TMP_MAPS
#define RECYCLE_TMP_MAPS
Definition: config.h:159
init_block
void init_block(void)
Definition: los.cpp:106
AT_COLD
#define AT_COLD
Definition: attack.h:80
Settings::emergency_x
uint16_t emergency_x
Definition: global.h:300
ARMOR_SPEED_IMPROVEMENT
#define ARMOR_SPEED_IMPROVEMENT
Definition: config.h:171
init_environ
static void init_environ(void)
Definition: init.cpp:363
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
Definition: object.h:478
of
a copper bar weighs and has a value of
Definition: ore.txt:3
add_string
sstring add_string(const char *str)
Definition: shstr.cpp:124
first_map
mapstruct * first_map
Definition: init.cpp:107
region::msg
char * msg
Definition: map.h:282
trying_emergency_save
long trying_emergency_save
Definition: init.cpp:111
region::jailmap
char * jailmap
Definition: map.h:286
change_resist_msg
const char *const change_resist_msg[NROFATTACKS]
Definition: init.cpp:70
navar-midane_pickup.msg
list msg
Definition: navar-midane_pickup.py:13
SEARCH_ITEMS
#define SEARCH_ITEMS
Definition: config.h:162
nroferrors
long nroferrors
Definition: init.cpp:112
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
MAP_TYPE_LEGACY
#define MAP_TYPE_LEGACY
Definition: map.h:57
artifactlist
Definition: artifact.h:24
resist_save
const char *const resist_save[NROFATTACKS]
Definition: init.cpp:31
archetype
Definition: object.h:474
Settings::playerdir
const char * playerdir
Definition: global.h:250
logfile
FILE * logfile
Definition: init.cpp:114
delete_map
void delete_map(mapstruct *m)
Definition: map.cpp:1696
TMPDIR
#define TMPDIR
Definition: config.h:488
ATTACKS
Chaos_Attacks ATTACKS[22]
Definition: init.cpp:81
ASSETS_ALL
#define ASSETS_ALL
Definition: assets.h:32
undead_name
const char * undead_name
Definition: init.cpp:125
resist_plus
const char *const resist_plus[NROFATTACKS]
Definition: init.cpp:49
MAX_BUF
#define MAX_BUF
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)
Definition: porting.cpp:222
FREE_AND_CLEAR_STR
#define FREE_AND_CLEAR_STR(xyz)
Definition: global.h:198
load_assets
void load_assets(void)
Definition: init.cpp:311
ob_count
long ob_count
Definition: init.cpp:123
attack_mess
attackmess_t attack_mess[NROFATTACKMESS][MAXATTACKMESS]
Definition: init.cpp:78
Settings::logfilename
const char * logfilename
Definition: global.h:241
region
Definition: map.h:273
ARMOR_WEIGHT_LINEAR
#define ARMOR_WEIGHT_LINEAR
Definition: config.h:170
STAT_LOSS_ON_DEATH
#define STAT_LOSS_ON_DEATH
Definition: config.h:164
llevInfo
@ llevInfo
Definition: logger.h:12
fatal
void fatal(enum fatal_error err)
Definition: utils.cpp:570
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)
Definition: init.cpp:323
attacktype_desc
const char *const attacktype_desc[NROFATTACKS]
Definition: init.cpp:40
FREE_AND_CLEAR
#define FREE_AND_CLEAR(xyz)
Definition: global.h:193
AT_SLOW
#define AT_SLOW
Definition: attack.h:87
init_hash_table
void init_hash_table(void)
Definition: shstr.cpp:55
mapstruct
Definition: map.h:314
ALWAYS_SHOW_HP
#define ALWAYS_SHOW_HP
Definition: config.h:160
BufferReader
Definition: bufferreader.cpp:21
sstring
const typedef char * sstring
Definition: sstring.h:2
free_experience
void free_experience(void)
Definition: exp.cpp:263
TEMPLATE_DIR
#define TEMPLATE_DIR
Definition: config.h:516
init_experience
void init_experience(void)
Definition: exp.cpp:167
RESET_LOCATION_TIME
#define RESET_LOCATION_TIME
Definition: config.h:629
attackmess_t::buf2
char * buf2
Definition: attack.h:121
free_globals
void free_globals(void)
Definition: init.cpp:439
assets.h
SPELL_FAILURE_EFFECTS
#define SPELL_FAILURE_EFFECTS
Definition: config.h:157
init_defaults
static void init_defaults(void)
Definition: init.cpp:472
OutputFile
Definition: output_file.h:41
Settings::mapdir
const char * mapdir
Definition: global.h:251
BALANCED_STAT_LOSS
#define BALANCED_STAT_LOSS
Definition: config.h:149
resist_color
const char *const resist_color[NROFATTACKS]
Definition: init.cpp:61
PERMANENT_EXPERIENCE_RATIO
#define PERMANENT_EXPERIENCE_RATIO
Definition: config.h:150
level
int level
Definition: readable.cpp:1550
first_artifactlist
artifactlist * first_artifactlist
Definition: init.cpp:109
attackmess_t::level
int level
Definition: attack.h:119
MAP_TYPE_DEFAULT
#define MAP_TYPE_DEFAULT
Definition: map.h:58
Settings::datadir
const char * datadir
Definition: global.h:248
AT_FEAR
#define AT_FEAR
Definition: attack.h:90
EMERGENCY_X
#define EMERGENCY_X
Definition: config.h:508
get_archetype_by_type_subtype
archetype * get_archetype_by_type_subtype(int type, int subtype)
Definition: arch.cpp:99
first
Crossfire Protocol most of the time after the actual code was already omit certain important and possibly make life miserable any new developer or curious player should be able to find most of the relevant information here If inconsistencies are found or this documentation proves to be consider the latest server side protocol code in the public source code repository as the authoritative reference Introduction If you were ever curious enough to telnet or netcat to a Crossfire chances are you were sorely disappointed While the protocol may seem to use plain text at first
Definition: protocol.txt:20
PLAYERDIR
#define PLAYERDIR
Definition: config.h:549
empty_archetype
archetype * empty_archetype
Definition: init.cpp:119
AT_CONFUSION
#define AT_CONFUSION
Definition: attack.h:81
assets_collect
void assets_collect(const char *datadir, int what)
Definition: assets.cpp:113
blocks_prayer
sstring blocks_prayer
Definition: init.cpp:126
AT_PARALYZE
#define AT_PARALYZE
Definition: attack.h:88
Settings::emergency_y
uint16_t emergency_y
Definition: global.h:300
EMERGENCY_MAPPATH
#define EMERGENCY_MAPPATH
Definition: config.h:506
CSPORT
#define CSPORT
Definition: config.h:362
assets_init
void assets_init()
Definition: assets.cpp:65
exiting
int exiting
Definition: init.cpp:115
attackmess_t
Definition: attack.h:118
object.h
NOT_PERMADETH
#define NOT_PERMADETH
Definition: config.h:163
llevDebug
@ llevDebug
Definition: logger.h:13
Chaos_Attacks
Definition: attack.h:125
NRSPELLPATHS
#define NRSPELLPATHS
Definition: spells.h:40
assets_end_load
void assets_end_load()
Definition: assets.cpp:227
Settings::emergency_mapname
char * emergency_mapname
Definition: global.h:299
bufferreader_next_line
char * bufferreader_next_line(BufferReader *br)
Definition: bufferreader.cpp:102
AT_FIRE
#define AT_FIRE
Definition: attack.h:78
level
Definition: level.py:1
attackmess_t::buf3
char * buf3
Definition: attack.h:122