1 | /* |
1 | /* |
2 | * static char *rcsid_init_c = |
2 | * static char *rcsid_init_c = |
3 | * "$Id: init.c,v 1.2 2006/02/03 07:25:24 root Exp $"; |
3 | * "$Id: init.c,v 1.6 2006/04/28 13:56:25 pippijn Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
54 | PLAYERDIR, MAPDIR, ARCHETYPES,REGIONS,TREASURES, |
54 | PLAYERDIR, MAPDIR, ARCHETYPES,REGIONS,TREASURES, |
55 | UNIQUE_DIR, TEMPLATE_DIR, |
55 | UNIQUE_DIR, TEMPLATE_DIR, |
56 | TMPDIR, |
56 | TMPDIR, |
57 | STAT_LOSS_ON_DEATH, |
57 | STAT_LOSS_ON_DEATH, |
58 | PK_LUCK_PENALTY, |
58 | PK_LUCK_PENALTY, |
59 | USE_PERMANENT_EXPERIENCE, |
59 | PERMANENT_EXPERIENCE_RATIO, |
|
|
60 | DEATH_PENALTY_RATIO, |
|
|
61 | DEATH_PENALTY_LEVEL, |
60 | BALANCED_STAT_LOSS, |
62 | BALANCED_STAT_LOSS, |
61 | NOT_PERMADETH, |
63 | NOT_PERMADETH, |
62 | SIMPLE_EXP, |
64 | SIMPLE_EXP, |
63 | RESET_LOCATION_TIME, |
65 | RESET_LOCATION_TIME, |
64 | SET_TITLE, |
66 | SET_TITLE, |
… | |
… | |
92 | ARMOR_WEIGHT_REDUCTION, |
94 | ARMOR_WEIGHT_REDUCTION, |
93 | ARMOR_WEIGHT_LINEAR, |
95 | ARMOR_WEIGHT_LINEAR, |
94 | ARMOR_SPEED_IMPROVEMENT, |
96 | ARMOR_SPEED_IMPROVEMENT, |
95 | ARMOR_SPEED_LINEAR, |
97 | ARMOR_SPEED_LINEAR, |
96 | 1, /* no_player_stealing */ |
98 | 1, /* no_player_stealing */ |
|
|
99 | 1, /* create_home_portals */ |
97 | }; |
100 | }; |
98 | |
101 | |
99 | /* perhaps not the best place for this, but needs to be |
102 | /* perhaps not the best place for this, but needs to be |
100 | * in some file in the common area so that standalone |
103 | * in some file in the common area so that standalone |
101 | * programs, like the random map generator, can be built. |
104 | * programs, like the random map generator, can be built. |
102 | */ |
105 | */ |
103 | char *spellpathnames[NRSPELLPATHS] = { |
106 | const char* const spellpathnames[NRSPELLPATHS] = { |
104 | "Protection", |
107 | "Protection", |
105 | "Fire", |
108 | "Fire", |
106 | "Frost", |
109 | "Frost", |
107 | "Electricity", |
110 | "Electricity", |
108 | "Missiles", |
111 | "Missiles", |
… | |
… | |
234 | else if ((logfile=fopen(settings.logfilename, "a"))==NULL) { |
237 | else if ((logfile=fopen(settings.logfilename, "a"))==NULL) { |
235 | fprintf(stderr,"Unable to open %s as the logfile - will use stderr instead\n", |
238 | fprintf(stderr,"Unable to open %s as the logfile - will use stderr instead\n", |
236 | settings.logfilename); |
239 | settings.logfilename); |
237 | logfile = stderr; |
240 | logfile = stderr; |
238 | } |
241 | } |
239 | setlinebuf(logfile); |
242 | else { |
|
|
243 | setvbuf(logfile, NULL, _IOLBF, 0); |
|
|
244 | } |
240 | exiting = 0; |
245 | exiting = 0; |
241 | first_player=NULL; |
246 | first_player=NULL; |
242 | first_friendly_object=NULL; |
247 | first_friendly_object=NULL; |
243 | first_map=NULL; |
248 | first_map=NULL; |
244 | first_treasurelist=NULL; |
249 | first_treasurelist=NULL; |
245 | first_artifactlist=NULL; |
250 | first_artifactlist=NULL; |
246 | first_archetype=NULL; |
251 | first_archetype=NULL; |
|
|
252 | *first_map_ext_path=0; |
247 | warn_archetypes=0; |
253 | warn_archetypes=0; |
248 | first_map=NULL; |
|
|
249 | nroftreasures = 0; |
254 | nroftreasures = 0; |
250 | nrofartifacts = 0; |
255 | nrofartifacts = 0; |
251 | nrofallowedstr=0; |
256 | nrofallowedstr=0; |
252 | ring_arch = NULL; |
257 | ring_arch = NULL; |
253 | amulet_arch = NULL; |
258 | amulet_arch = NULL; |
… | |
… | |
305 | |
310 | |
306 | |
311 | |
307 | void init_dynamic (void) { |
312 | void init_dynamic (void) { |
308 | archetype *at = first_archetype; |
313 | archetype *at = first_archetype; |
309 | while (at) { |
314 | while (at) { |
310 | if (at->clone.type == MAP && EXIT_PATH (&at->clone)) { |
315 | if (at->clone.type == MAP) { |
|
|
316 | if (at->clone.race) { |
|
|
317 | strcpy (first_map_ext_path, at->clone.race); |
|
|
318 | } |
|
|
319 | if (EXIT_PATH (&at->clone)) { |
311 | strcpy (first_map_path, EXIT_PATH (&at->clone)); |
320 | strcpy (first_map_path, EXIT_PATH (&at->clone)); |
312 | return; |
321 | return; |
|
|
322 | } |
313 | } |
323 | } |
314 | at = at->next; |
324 | at = at->next; |
315 | } |
325 | } |
316 | LOG(llevDebug,"You Need a archetype called 'map' and it have to contain start map\n"); |
326 | LOG(llevDebug,"You Need a archetype called 'map' and it have to contain start map\n"); |
317 | exit (-1); |
327 | exit (-1); |