ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/init.C
(Generate patch)

Comparing deliantra/server/common/init.C (file contents):
Revision 1.10 by root, Sun Sep 10 16:00:23 2006 UTC vs.
Revision 1.17 by root, Mon Dec 18 02:35:00 2006 UTC

1
2/*
3 * static char *rcsid_init_c =
4 * "$Id: init.C,v 1.10 2006/09/10 16:00:23 root Exp $";
5 */
6
7/* 1/*
8 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
9 3
10 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
22 16
23 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 20
27 The authors can be reached via e-mail at crossfire-devel@real-time.com 21 The authors can be reached via e-mail at <crossfire@schmorp.de>
28*/ 22*/
29 23
30#define EXTERN // horrible hack 24#define EXTERN // horrible hack
31 25
32#include <global.h> 26#include <global.h>
33#include <object.h> 27#include <object.h>
34 28
35extern const char *const attacktype_desc[NROFATTACKS] = { 29extern const char *const attacktype_desc[NROFATTACKS] = {
36#define def(uc, lc, name, plus, change) # name, 30# define def(uc, lc, name, plus, change) # name,
37#include "attackinc.h" 31# include "attackinc.h"
38#undef def 32# undef def
39};
40
41extern const keyword resist_save[NROFATTACKS] = {
42#define def(uc, lc, name, plus, change) KW_resist_ ## lc,
43#include "attackinc.h"
44#undef def
45}; 33};
46 34
47extern const char *const resist_plus[NROFATTACKS] = { 35extern const char *const resist_plus[NROFATTACKS] = {
48#define def(uc, lc, name, plus, change) # plus, 36# define def(uc, lc, name, plus, change) # plus,
49#include "attackinc.h" 37# include "attackinc.h"
50#undef def 38# undef def
51}; 39};
52 40
53extern const char *const change_resist_msg[NROFATTACKS] = { 41extern const char *const change_resist_msg[NROFATTACKS] = {
54#define def(uc, lc, name, plus, change) # change, 42# define def(uc, lc, name, plus, change) # change,
55#include "attackinc.h" 43# include "attackinc.h"
56#undef def 44# undef def
57}; 45};
58 46
59int resist_table[NROFATTACKS] = { 47int resist_table[NROFATTACKS] = {
60#define def(uc, lc, name, plus, change) ATNR_ ## uc, 48# define def(uc, lc, name, plus, change) ATNR_ ## uc,
61#include "attackinc.h" 49# include "attackinc.h"
62#undef def 50# undef def
63}; 51};
64 52
65/* You unforunately need to looking in include/global.h to see what these 53/* You unforunately need to looking in include/global.h to see what these
66 * correspond to. 54 * correspond to.
67 */ 55 */
99 SEARCH_ITEMS, 87 SEARCH_ITEMS,
100 SPELL_ENCUMBRANCE, 88 SPELL_ENCUMBRANCE,
101 SPELL_FAILURE_EFFECTS, 89 SPELL_FAILURE_EFFECTS,
102 CASTING_TIME, 90 CASTING_TIME,
103 REAL_WIZ, 91 REAL_WIZ,
104 RECYCLE_TMP_MAPS,
105 EXPLORE_MODE, 92 EXPLORE_MODE,
106 SPELLPOINT_LEVEL_DEPEND, 93 SPELLPOINT_LEVEL_DEPEND,
107 SET_FRIENDLY_FIRE, 94 SET_FRIENDLY_FIRE,
108 "", /* Who format specifier */
109 "", /* who wiz format specifier */
110 MOTD, 95 MOTD,
111 "rules", 96 "rules",
112 "news", 97 "news",
113 "", /* DM_MAIL */ 98 "", /* DM_MAIL */
114 0, /* This and the next 3 values are metaserver values */
115 "",
116 "",
117 0,
118 "",
119 0, 0, 0, 0, 0, 0, 0, 0, /* worldmap settings */ 99 0, 0, 0, 0, 0, 0, 0, 0, /* worldmap settings */
120 EMERGENCY_MAPPATH, EMERGENCY_X, EMERGENCY_Y, 100 EMERGENCY_MAPPATH, EMERGENCY_X, EMERGENCY_Y,
121 0, 101 0,
122 1.0, 102 1.0,
123 103
183 continue; /* ignore comments */ 163 continue; /* ignore comments */
184 164
185 if (online == 0) 165 if (online == 0)
186 { 166 {
187 tmpbuf[strlen (tmpbuf) - 1] = 0; /* kill newline */ 167 tmpbuf[strlen (tmpbuf) - 1] = 0; /* kill newline */
188 settings.emergency_mapname = strdup_local (tmpbuf); 168 settings.emergency_mapname = strdup (tmpbuf);
189 } 169 }
190 else if (online == 1) 170 else if (online == 1)
191 { 171 {
192 settings.emergency_x = atoi (tmpbuf); 172 settings.emergency_x = atoi (tmpbuf);
193 } 173 }
220void 200void
221init_library (void) 201init_library (void)
222{ 202{
223 init_environ (); 203 init_environ ();
224 init_globals (); 204 init_globals ();
225 init_objects ();
226 init_vars (); 205 init_vars ();
227 init_block (); 206 init_block ();
228 ReadBmapNames (); 207 ReadBmapNames ();
229 ReadSmooth (); 208 ReadSmooth ();
230 init_anim (); /* Must be after we read in the bitmaps */ 209 init_anim (); /* Must be after we read in the bitmaps */
283 262
284void 263void
285init_globals (void) 264init_globals (void)
286{ 265{
287 if (settings.logfilename[0] == 0) 266 if (settings.logfilename[0] == 0)
288 {
289 logfile = stderr; 267 logfile = stderr;
290 }
291 else if ((logfile = fopen (settings.logfilename, "a")) == NULL) 268 else if ((logfile = fopen (settings.logfilename, "a")) == NULL)
292 { 269 {
293 fprintf (stderr, "Unable to open %s as the logfile - will use stderr instead\n", settings.logfilename); 270 fprintf (stderr, "Unable to open %s as the logfile - will use stderr instead\n", settings.logfilename);
294 logfile = stderr; 271 logfile = stderr;
295 } 272 }
296 else 273 else
297 {
298 setvbuf (logfile, NULL, _IOLBF, 0); 274 setvbuf (logfile, NULL, _IOLBF, 0);
299 }
300 exiting = 0;
301 first_player = NULL;
302 first_friendly_object = NULL;
303 first_map = NULL;
304 first_treasurelist = NULL;
305 first_artifactlist = NULL;
306 first_archetype = NULL;
307 *first_map_ext_path = 0;
308 warn_archetypes = 0;
309 nroftreasures = 0;
310 nrofartifacts = 0;
311 nrofallowedstr = 0;
312 ring_arch = NULL;
313 amulet_arch = NULL;
314 staff_arch = NULL;
315 trying_emergency_save = 0;
316 num_animations = 0;
317 animations_allocated = 0;
318 init_defaults ();
319} 275}
320
321/*
322 * Sets up and initialises the linked list of free and used objects.
323 * Allocates a certain chunk of objects and puts them on the free list.
324 * Called by init_library();
325 */
326
327void
328init_objects (void)
329{
330 /* Initialize all objects: */
331 objects = NULL;
332 active_objects = NULL;
333}
334
335/*
336 * Initialises global variables which can be changed by options.
337 * Called by init_library().
338 */
339
340void
341init_defaults (void)
342{
343 editor = 0;
344 nroferrors = 0;
345}
346
347 276
348void 277void
349init_dynamic (void) 278init_dynamic (void)
350{ 279{
351 archetype *at = first_archetype; 280 archetype *at = first_archetype;
353 while (at) 282 while (at)
354 { 283 {
355 if (at->clone.type == MAP) 284 if (at->clone.type == MAP)
356 { 285 {
357 if (at->clone.race) 286 if (at->clone.race)
358 {
359 strcpy (first_map_ext_path, at->clone.race); 287 strcpy (first_map_ext_path, at->clone.race);
360 } 288
361 if (EXIT_PATH (&at->clone)) 289 if (EXIT_PATH (&at->clone))
362 { 290 {
363 strcpy (first_map_path, EXIT_PATH (&at->clone)); 291 strcpy (first_map_path, EXIT_PATH (&at->clone));
364 return; 292 return;
365 } 293 }
366 } 294 }
295
367 at = at->next; 296 at = at->next;
368 } 297 }
298
369 LOG (llevDebug, "You Need a archetype called 'map' and it have to contain start map\n"); 299 LOG (llevDebug, "You Need a archetype called 'map' and it have to contain start map\n");
370 exit (-1); 300 exit (-1);
371} 301}
372 302
373unsigned long todtick; 303unsigned long todtick;
486 { 416 {
487 p = strtok (buf, "="); 417 p = strtok (buf, "=");
488 attack_mess[mess][level].level = atoi (buf); 418 attack_mess[mess][level].level = atoi (buf);
489 p = strtok (NULL, "="); 419 p = strtok (NULL, "=");
490 if (p != NULL) 420 if (p != NULL)
491 attack_mess[mess][level].buf1 = strdup_local (p); 421 attack_mess[mess][level].buf1 = strdup (p);
492 else 422 else
493 attack_mess[mess][level].buf1 = strdup_local (""); 423 attack_mess[mess][level].buf1 = strdup ("");
494 mode = 2; 424 mode = 2;
495 continue; 425 continue;
496 } 426 }
497 else if (mode == 2) 427 else if (mode == 2)
498 { 428 {
499 p = strtok (buf, "="); 429 p = strtok (buf, "=");
500 attack_mess[mess][level].level = atoi (buf); 430 attack_mess[mess][level].level = atoi (buf);
501 p = strtok (NULL, "="); 431 p = strtok (NULL, "=");
502 if (p != NULL) 432 if (p != NULL)
503 attack_mess[mess][level].buf2 = strdup_local (p); 433 attack_mess[mess][level].buf2 = strdup (p);
504 else 434 else
505 attack_mess[mess][level].buf2 = strdup_local (""); 435 attack_mess[mess][level].buf2 = strdup ("");
506 mode = 3; 436 mode = 3;
507 continue; 437 continue;
508 } 438 }
509 else if (mode == 3) 439 else if (mode == 3)
510 { 440 {
511 p = strtok (buf, "="); 441 p = strtok (buf, "=");
512 attack_mess[mess][level].level = atoi (buf); 442 attack_mess[mess][level].level = atoi (buf);
513 p = strtok (NULL, "="); 443 p = strtok (NULL, "=");
514 if (p != NULL) 444 if (p != NULL)
515 attack_mess[mess][level].buf3 = strdup_local (p); 445 attack_mess[mess][level].buf3 = strdup (p);
516 else 446 else
517 attack_mess[mess][level].buf3 = strdup_local (""); 447 attack_mess[mess][level].buf3 = strdup ("");
518 mode = 1; 448 mode = 1;
519 level++; 449 level++;
520 total++; 450 total++;
521 continue; 451 continue;
522 } 452 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines