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.57 by root, Thu Apr 15 06:05:52 2010 UTC vs.
Revision 1.69 by root, Sat Nov 17 23:40:00 2018 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 6 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 7 * Copyright (©) 1992 Frank Tore Johansen
7 * 8 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 9 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 10 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 11 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 12 * option) any later version.
12 * 13 *
13 * This program is distributed in the hope that it will be useful, 14 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 17 * GNU General Public License for more details.
17 * 18 *
18 * You should have received a copy of the Affero GNU General Public License 19 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 20 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 21 * <http://www.gnu.org/licenses/>.
21 * 22 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 23 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 24 */
24 25
25#define EXTERN // horrible hack 26#define EXTERN // horrible hack
26 27
27#include <global.h> 28#include <global.h>
28#include <object.h> 29#include <object.h>
29 30
30dynbuf_text msg_dynbuf (65536, 65536); 31dynbuf_text msg_dynbuf (65536, 65536);
31 32
33extern const char *const attacktype_name[NROFATTACKS] = {
34# define def(uc, lc, desc, plus, change) # lc,
35# include "attackinc.h"
36# undef def
37};
38
32extern const char *const attacktype_desc[NROFATTACKS] = { 39extern const char *const attacktype_desc[NROFATTACKS] = {
33# define def(uc, lc, name, plus, change) # name, 40# define def(uc, lc, desc, plus, change) # desc,
34# include "attackinc.h" 41# include "attackinc.h"
35# undef def 42# undef def
36}; 43};
37 44
38extern const char *const resist_plus[NROFATTACKS] = { 45extern const char *const resist_plus[NROFATTACKS] = {
39# define def(uc, lc, name, plus, change) # plus, 46# define def(uc, lc, desc, plus, change) # plus,
40# include "attackinc.h" 47# include "attackinc.h"
41# undef def 48# undef def
42}; 49};
43 50
44extern const char *const change_resist_msg[NROFATTACKS] = { 51extern const char *const change_resist_msg[NROFATTACKS] = {
45# define def(uc, lc, name, plus, change) # change, 52# define def(uc, lc, desc, plus, change) # change,
46# include "attackinc.h" 53# include "attackinc.h"
47# undef def 54# undef def
48}; 55};
49 56
50int resist_table[NROFATTACKS] = { 57int resist_table[NROFATTACKS] = {
51# define def(uc, lc, name, plus, change) ATNR_ ## uc, 58# define def(uc, lc, desc, plus, change) ATNR_ ## uc,
52# include "attackinc.h" 59# include "attackinc.h"
53# undef def 60# undef def
54}; 61};
55 62
56/* You unforunately need to looking in include/global.h to see what these 63/* You unforunately need to looking in include/global.h to see what these
57 * correspond to. 64 * correspond to.
58 */ 65 */
59struct Settings settings = { 66struct Settings settings = {
60 LOGFILE, /* Logfile */ 67 LOGFILE, /* Logfile */
61 CSPORT, /* Client/server port */ 68 llevTrace, /* Log level */
62
63/* Debug level */
64#ifdef DEBUG
65 llevDebug,
66#else
67 llevInfo,
68#endif
69
70 0, NULL, 0, /* dumpvalues, dumparg, daemonmode */
71 0, /* argc */ 69 0, /* argc */
72 NULL, /* argv */ 70 NULL, /* argv */
73 CONFDIR, 71 CONFDIR,
74 DATADIR, 72 DATADIR,
75 LOCALDIR, 73 LOCALDIR,
76 PLAYERDIR, MAPDIR, ARCHETYPES, REGIONS, TREASURES, 74 PLAYERDIR,
75 MAPDIR,
77 UNIQUE_DIR, "", 76 UNIQUE_DIR,
78 TMPDIR, 77 TMPDIR,
79 PK_LUCK_PENALTY, 78 PK_LUCK_PENALTY,
80 STAT_LOSS_ON_DEATH, 79 STAT_LOSS_ON_DEATH,
81 PERMANENT_EXPERIENCE_RATIO, 80 PERMANENT_EXPERIENCE_RATIO,
82 DEATH_PENALTY_RATIO, 81 DEATH_PENALTY_RATIO,
88 RESURRECTION, 87 RESURRECTION,
89 SEARCH_ITEMS, 88 SEARCH_ITEMS,
90 SPELL_ENCUMBRANCE, 89 SPELL_ENCUMBRANCE,
91 SPELL_FAILURE_EFFECTS, 90 SPELL_FAILURE_EFFECTS,
92 SET_FRIENDLY_FIRE, 91 SET_FRIENDLY_FIRE,
93 0,
94 0,
95 EXPLORE_MODE,
96 SPELLPOINT_LEVEL_DEPEND, 92 SPELLPOINT_LEVEL_DEPEND,
97 0, 93 0,
98 1.0, 94 1.25,
99 95
100/* Armor enchantment stuff */ 96/* Armor enchantment stuff */
101 ARMOR_MAX_ENCHANT, 97 ARMOR_MAX_ENCHANT,
102 ARMOR_WEIGHT_REDUCTION, 98 ARMOR_WEIGHT_REDUCTION,
103 ARMOR_WEIGHT_LINEAR, 99 ARMOR_WEIGHT_LINEAR,
139void 135void
140init_environ () 136init_environ ()
141{ 137{
142 const char *cp; 138 const char *cp;
143 139
144 if (cp = getenv ("DELIANTRA_CONFDIR" )) settings.confdir = cp; 140 if (cp = getenv ("DELIANTRA_CONFDIR" )) settings.confdir = cp;
141
142 if (cp = getenv ("DELIANTRA_LIBDIR" )) settings.datadir = cp; /* deprecated */
145 if (cp = getenv ("DELIANTRA_LIBDIR" )) settings.datadir = cp; 143 if (cp = getenv ("DELIANTRA_DATADIR" )) settings.datadir = cp;
144 if (cp = getenv ("DELIANTRA_MAPDIR" )) settings.mapdir = cp;
145
146 if (cp = getenv ("DELIANTRA_LOCALDIR" )) settings.localdir = cp; 146 if (cp = getenv ("DELIANTRA_LOCALDIR" )) settings.localdir = cp;
147 if (cp = getenv ("DELIANTRA_PLAYERDIR" )) settings.playerdir = cp; 147 if (cp = getenv ("DELIANTRA_PLAYERDIR" )) settings.playerdir = cp;
148 if (cp = getenv ("DELIANTRA_MAPDIR" )) settings.mapdir = cp;
149 if (cp = getenv ("DELIANTRA_ARCHETYPES" )) settings.archetypes = cp;
150 if (cp = getenv ("DELIANTRA_TREASURES" )) settings.treasures = cp;
151 if (cp = getenv ("DELIANTRA_UNIQUEDIR" )) settings.uniquedir = cp; 148 if (cp = getenv ("DELIANTRA_UNIQUEDIR" )) settings.uniquedir = cp;
152 if (cp = getenv ("DELIANTRA_TEMPLATEDIR")) settings.templatedir = cp;
153 if (cp = getenv ("DELIANTRA_TMPDIR" )) settings.tmpdir = cp; 149 if (cp = getenv ("DELIANTRA_TMPDIR" )) settings.tmpdir = cp;
154
155 if (cp = getenv ("DELIANTRA_LOGFILE" )) settings.logfilename = cp; 150 if (cp = getenv ("DELIANTRA_LOGFILE" )) settings.logfilename = cp;
156} 151}
157 152
158/* 153/*
159 * Initialises all global variables. 154 * Initialises all global variables.
162void 157void
163init_globals () 158init_globals ()
164{ 159{
165 if (settings.logfilename[0] == 0) 160 if (settings.logfilename[0] == 0)
166 log_setfd (-1); 161 log_setfd (-1);
167 else 162 else
168 { 163 {
169 int logfd = open (settings.logfilename, O_CREAT|O_WRONLY|O_APPEND, 0666); 164 int logfd = open (settings.logfilename, O_CREAT|O_WRONLY|O_APPEND, 0666);
170 165
171 if (logfd >= 0) 166 if (logfd >= 0)
172 log_setfd (logfd); 167 log_setfd (logfd);
193//attackmess_t attack_mess[NROFATTACKMESS][MAXATTACKMESS]; 188//attackmess_t attack_mess[NROFATTACKMESS][MAXATTACKMESS];
194 189
195void 190void
196init_attackmess () 191init_attackmess ()
197{ 192{
198 char filename[MAX_BUF]; 193 object_thawer thawer (settings.datadir, "attackmess");
199
200 sprintf (filename, "%s/attackmess", settings.datadir);
201 LOG (llevDebug, "Reading attack messages from %s...\n", filename);
202
203 object_thawer thawer (filename);
204 194
205 if (!thawer) 195 if (!thawer)
206 { 196 {
207 LOG (llevError, "Can't open %s.\n", filename); 197 LOG (llevError, "Can't open %s.\n", thawer.name);
208 return; 198 return;
209 } 199 }
210 200
211 int msgnum = -1; 201 int msgnum = -1;
212 int total = 0; 202 int total = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines