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

Comparing deliantra/server/server/init.C (file contents):
Revision 1.22 by root, Tue Dec 26 08:55:00 2006 UTC vs.
Revision 1.28 by pippijn, Wed Jan 3 00:46:53 2007 UTC

23 23
24#include <global.h> 24#include <global.h>
25#include <material.h> 25#include <material.h>
26#include <loader.h> 26#include <loader.h>
27#include <sproto.h> 27#include <sproto.h>
28
29/* global weathermap */
30weathermap_t **weathermap;
31 28
32void 29void
33set_logfile (char *val) 30set_logfile (char *val)
34{ 31{
35 settings.logfilename = val; 32 settings.logfilename = val;
239 * pass system very easy, and it is very easy to add in new options. 236 * pass system very easy, and it is very easy to add in new options.
240 */ 237 */
241struct Command_Line_Options options[] = { 238struct Command_Line_Options options[] = {
242 239
243/* Pass 1 functions - STuff that can/should be called before we actually 240/* Pass 1 functions - STuff that can/should be called before we actually
244 * initialize any data. 241 * initialise any data.
245 */ 242 */
246 {"-h", 0, 1, help}, 243 {"-h", 0, 1, help},
247 244
248/* Honor -help also, since it is somewhat common */ 245/* Honor -help also, since it is somewhat common */
249 {"-help", 0, 1, help}, 246 {"-help", 0, 1, help},
382 FILE *fp; 379 FILE *fp;
383 materialtype_t *mt; 380 materialtype_t *mt;
384 int i, value; 381 int i, value;
385 382
386 sprintf (filename, "%s/materials", settings.datadir); 383 sprintf (filename, "%s/materials", settings.datadir);
387 LOG (llevDebug, "Reading material type data from %s...", filename); 384 LOG (llevDebug, "Reading material type data from %s...\n", filename);
388 if ((fp = fopen (filename, "r")) == NULL) 385 if ((fp = fopen (filename, "r")) == NULL)
389 { 386 {
390 LOG (llevError, "Cannot open %s for reading\n", filename); 387 LOG (llevError, "Cannot open %s for reading\n", filename);
391 mt = get_empty_mat (); 388 mt = get_empty_mat ();
392 mt->next = NULL; 389 mt->next = NULL;
1013 * LibDir in this pass would be reasonable*/ 1010 * LibDir in this pass would be reasonable*/
1014 1011
1015 cfperl_init (); 1012 cfperl_init ();
1016 init_library (); /* Must be called early */ 1013 init_library (); /* Must be called early */
1017 load_settings (); /* Load the settings file */ 1014 load_settings (); /* Load the settings file */
1018 init_weather ();
1019 load_materials (); 1015 load_materials ();
1020 parse_args (argc, argv, 2); 1016 parse_args (argc, argv, 2);
1021 fprintf (logfile, "Welcome to CrossFire, v%s\n", VERSION); 1017 fprintf (logfile, "Welcome to CrossFire, v%s\n", VERSION);
1018 fprintf (logfile, "Copyright (C) 2005, 2006, 2007 Marc Lehmann.\n");
1022 fprintf (logfile, "Copyright (C) 1994 Mark Wedel.\n"); 1019 fprintf (logfile, "Copyright (C) 1994 Mark Wedel.\n");
1023 fprintf (logfile, "Copyright (C) 1992 Frank Tore Johansen.\n"); 1020 fprintf (logfile, "Copyright (C) 1992 Frank Tore Johansen.\n");
1024 1021
1025 if (strcmp (settings.dm_mail, "") != 0) 1022 if (strcmp (settings.dm_mail, "") != 0)
1026 { 1023 {
1032 1029
1033 init_startup (); /* Write (C), check shutdown/forbid files */ 1030 init_startup (); /* Write (C), check shutdown/forbid files */
1034 init_uuid (); 1031 init_uuid ();
1035 init_signals (); /* Sets up signal interceptions */ 1032 init_signals (); /* Sets up signal interceptions */
1036 init_commands (); /* Sort command tables */ 1033 init_commands (); /* Sort command tables */
1037 read_map_log (); /* Load up the old temp map files */
1038 init_skills (); 1034 init_skills ();
1039 1035
1040 parse_args (argc, argv, 3); 1036 parse_args (argc, argv, 3);
1041 1037
1042 if (settings.daemonmode) 1038 if (settings.daemonmode)
1212 printf ("Save player:\t<true>\n"); 1208 printf ("Save player:\t<true>\n");
1213 printf ("Save mode:\t%4.4o\n", SAVE_MODE); 1209 printf ("Save mode:\t%4.4o\n", SAVE_MODE);
1214 printf ("Playerdir:\t<VAR>/%s\n", settings.playerdir); 1210 printf ("Playerdir:\t<VAR>/%s\n", settings.playerdir);
1215 printf ("Itemsdir:\t<VAR>/%s\n", settings.uniquedir); 1211 printf ("Itemsdir:\t<VAR>/%s\n", settings.uniquedir);
1216 printf ("Tmpdir:\t\t%s\n", settings.tmpdir); 1212 printf ("Tmpdir:\t\t%s\n", settings.tmpdir);
1217 printf ("Map max timeout:\t%d\n", MAP_MAXTIMEOUT);
1218 printf ("Max objects:\t%d\n", MAX_OBJECTS);
1219#ifdef USE_CALLOC 1213#ifdef USE_CALLOC
1220 printf ("Use_calloc:\t<true>\n"); 1214 printf ("Use_calloc:\t<true>\n");
1221#else 1215#else
1222 printf ("Use_calloc:\t<false>\n"); 1216 printf ("Use_calloc:\t<false>\n");
1223#endif 1217#endif
1253rec_sighup (int i) 1247rec_sighup (int i)
1254{ 1248{
1255 LOG (llevInfo, "SIGHUP received\n"); 1249 LOG (llevInfo, "SIGHUP received\n");
1256 1250
1257 if (init_done) 1251 if (init_done)
1258 cleanup (); 1252 cleanup (0);
1259 1253
1260 exit (0); 1254 exit (0);
1261} 1255}
1262 1256
1263void 1257void
1321 return; 1315 return;
1322 init_done = 1; 1316 init_done = 1;
1323 first_race = 0; 1317 first_race = 0;
1324 1318
1325 sprintf (fname, "%s/races", settings.datadir); 1319 sprintf (fname, "%s/races", settings.datadir);
1326 LOG (llevDebug, "Reading races from %s...", fname); 1320 LOG (llevDebug, "Reading races from %s...\n", fname);
1327 if (!(file = fopen (fname, "r"))) 1321 if (!(file = fopen (fname, "r")))
1328 { 1322 {
1329 LOG (llevError, "Cannot open races file %s: %s\n", fname, strerror (errno)); 1323 LOG (llevError, "Cannot open races file %s: %s\n", fname, strerror (errno));
1330 return; 1324 return;
1331 } 1325 }
1372 if (cp[strlen (cp) - 1] == '\n') 1366 if (cp[strlen (cp) - 1] == '\n')
1373 cp[strlen (cp) - 1] = '\0'; 1367 cp[strlen (cp) - 1] = '\0';
1374 1368
1375 /* set creature race to race value */ 1369 /* set creature race to race value */
1376 if ((mon = archetype::find (cp)) == NULL) 1370 if ((mon = archetype::find (cp)) == NULL)
1377 LOG (llevError, "\nCreature %s in race file lacks archetype", cp); 1371 LOG (llevError, "Creature %s in race file lacks archetype\n", cp);
1378 else 1372 else
1379 { 1373 {
1380 if (set_race && (!mon->clone.race || strcmp (mon->clone.race, race))) 1374 if (set_race && (!mon->clone.race || strcmp (mon->clone.race, race)))
1381 { 1375 {
1382 if (mon->clone.race) 1376 if (mon->clone.race)
1383 LOG (llevDebug, "\n Resetting race to %s from %s for archetype %s", race, &mon->clone.race, &mon->name); 1377 LOG (llevDebug, "Resetting race to %s from %s for archetype %s\n", race, &mon->clone.race, &mon->name);
1384 1378
1385 mon->clone.race = race; 1379 mon->clone.race = race;
1386 } 1380 }
1387 1381
1388 /* if the arch is a monster, add it to the race list */ 1382 /* if the arch is a monster, add it to the race list */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines