--- deliantra/server/common/init.C 2010/04/15 06:05:52 1.57 +++ deliantra/server/common/init.C 2018/11/17 23:40:00 1.69 @@ -1,24 +1,25 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. - * - * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * + * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team + * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2002 Mark Wedel & Crossfire Development Team * Copyright (©) 1992 Frank Tore Johansen - * + * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the Affero GNU General Public License * and the GNU General Public License along with this program. If not, see * . - * + * * The authors can be reached via e-mail to */ @@ -29,26 +30,32 @@ dynbuf_text msg_dynbuf (65536, 65536); +extern const char *const attacktype_name[NROFATTACKS] = { +# define def(uc, lc, desc, plus, change) # lc, +# include "attackinc.h" +# undef def +}; + extern const char *const attacktype_desc[NROFATTACKS] = { -# define def(uc, lc, name, plus, change) # name, +# define def(uc, lc, desc, plus, change) # desc, # include "attackinc.h" # undef def }; extern const char *const resist_plus[NROFATTACKS] = { -# define def(uc, lc, name, plus, change) # plus, +# define def(uc, lc, desc, plus, change) # plus, # include "attackinc.h" # undef def }; extern const char *const change_resist_msg[NROFATTACKS] = { -# define def(uc, lc, name, plus, change) # change, +# define def(uc, lc, desc, plus, change) # change, # include "attackinc.h" # undef def }; int resist_table[NROFATTACKS] = { -# define def(uc, lc, name, plus, change) ATNR_ ## uc, +# define def(uc, lc, desc, plus, change) ATNR_ ## uc, # include "attackinc.h" # undef def }; @@ -58,23 +65,15 @@ */ struct Settings settings = { LOGFILE, /* Logfile */ - CSPORT, /* Client/server port */ - -/* Debug level */ -#ifdef DEBUG - llevDebug, -#else - llevInfo, -#endif - - 0, NULL, 0, /* dumpvalues, dumparg, daemonmode */ + llevTrace, /* Log level */ 0, /* argc */ NULL, /* argv */ CONFDIR, DATADIR, LOCALDIR, - PLAYERDIR, MAPDIR, ARCHETYPES, REGIONS, TREASURES, - UNIQUE_DIR, "", + PLAYERDIR, + MAPDIR, + UNIQUE_DIR, TMPDIR, PK_LUCK_PENALTY, STAT_LOSS_ON_DEATH, @@ -90,12 +89,9 @@ SPELL_ENCUMBRANCE, SPELL_FAILURE_EFFECTS, SET_FRIENDLY_FIRE, - 0, - 0, - EXPLORE_MODE, SPELLPOINT_LEVEL_DEPEND, 0, - 1.0, + 1.25, /* Armor enchantment stuff */ ARMOR_MAX_ENCHANT, @@ -141,17 +137,16 @@ { const char *cp; - if (cp = getenv ("DELIANTRA_CONFDIR" )) settings.confdir = cp; - if (cp = getenv ("DELIANTRA_LIBDIR" )) settings.datadir = cp; + if (cp = getenv ("DELIANTRA_CONFDIR" )) settings.confdir = cp; + + if (cp = getenv ("DELIANTRA_LIBDIR" )) settings.datadir = cp; /* deprecated */ + if (cp = getenv ("DELIANTRA_DATADIR" )) settings.datadir = cp; + if (cp = getenv ("DELIANTRA_MAPDIR" )) settings.mapdir = cp; + if (cp = getenv ("DELIANTRA_LOCALDIR" )) settings.localdir = cp; if (cp = getenv ("DELIANTRA_PLAYERDIR" )) settings.playerdir = cp; - if (cp = getenv ("DELIANTRA_MAPDIR" )) settings.mapdir = cp; - if (cp = getenv ("DELIANTRA_ARCHETYPES" )) settings.archetypes = cp; - if (cp = getenv ("DELIANTRA_TREASURES" )) settings.treasures = cp; - if (cp = getenv ("DELIANTRA_UNIQUEDIR" )) settings.uniquedir = cp; - if (cp = getenv ("DELIANTRA_TEMPLATEDIR")) settings.templatedir = cp; + if (cp = getenv ("DELIANTRA_UNIQUEDIR" )) settings.uniquedir = cp; if (cp = getenv ("DELIANTRA_TMPDIR" )) settings.tmpdir = cp; - if (cp = getenv ("DELIANTRA_LOGFILE" )) settings.logfilename = cp; } @@ -164,7 +159,7 @@ { if (settings.logfilename[0] == 0) log_setfd (-1); - else + else { int logfd = open (settings.logfilename, O_CREAT|O_WRONLY|O_APPEND, 0666); @@ -195,16 +190,11 @@ void init_attackmess () { - char filename[MAX_BUF]; - - sprintf (filename, "%s/attackmess", settings.datadir); - LOG (llevDebug, "Reading attack messages from %s...\n", filename); - - object_thawer thawer (filename); + object_thawer thawer (settings.datadir, "attackmess"); if (!thawer) { - LOG (llevError, "Can't open %s.\n", filename); + LOG (llevError, "Can't open %s.\n", thawer.name); return; }