… | |
… | |
80 | DEATH_PENALTY_RATIO, |
80 | DEATH_PENALTY_RATIO, |
81 | DEATH_PENALTY_LEVEL, |
81 | DEATH_PENALTY_LEVEL, |
82 | BALANCED_STAT_LOSS, |
82 | BALANCED_STAT_LOSS, |
83 | NOT_PERMADETH, |
83 | NOT_PERMADETH, |
84 | SIMPLE_EXP, |
84 | SIMPLE_EXP, |
85 | RESET_LOCATION_TIME, |
|
|
86 | SET_TITLE, |
85 | SET_TITLE, |
87 | RESURRECTION, |
86 | RESURRECTION, |
88 | SEARCH_ITEMS, |
87 | SEARCH_ITEMS, |
89 | SPELL_ENCUMBRANCE, |
88 | SPELL_ENCUMBRANCE, |
90 | SPELL_FAILURE_EFFECTS, |
89 | SPELL_FAILURE_EFFECTS, |
… | |
… | |
147 | * init_hash_table if you are doing any object loading. |
146 | * init_hash_table if you are doing any object loading. |
148 | */ |
147 | */ |
149 | void |
148 | void |
150 | init_library (void) |
149 | init_library (void) |
151 | { |
150 | { |
152 | init_environ (); |
|
|
153 | init_globals (); |
151 | init_globals (); |
154 | init_vars (); |
|
|
155 | init_block (); |
152 | init_block (); |
156 | ReadBmapNames (); |
|
|
157 | ReadSmooth (); |
|
|
158 | init_anim (); /* Must be after we read in the bitmaps */ |
|
|
159 | init_archetypes (); /* Reads all archetypes from file */ |
153 | init_archetypes (); /* Reads all archetypes from file */ |
160 | init_dynamic (); |
154 | init_dynamic (); |
161 | init_attackmess (); |
155 | init_attackmess (); |
162 | init_clocks (); |
|
|
163 | init_experience (); |
156 | init_experience (); |
164 | } |
157 | } |
165 | |
158 | |
166 | |
159 | |
167 | /* init_environ initialises values from the environmental variables. |
160 | /* init_environ initialises values from the environmental variables. |
… | |
… | |
200 | cp = getenv ("CROSSFIRE_TMPDIR"); |
193 | cp = getenv ("CROSSFIRE_TMPDIR"); |
201 | if (cp) |
194 | if (cp) |
202 | settings.tmpdir = cp; |
195 | settings.tmpdir = cp; |
203 | } |
196 | } |
204 | |
197 | |
205 | |
|
|
206 | /* |
198 | /* |
207 | * Initialises all global variables. |
199 | * Initialises all global variables. |
208 | * Might use environment-variables as default for some of them. |
200 | * Might use environment-variables as default for some of them. |
209 | */ |
201 | */ |
210 | |
|
|
211 | void |
202 | void |
212 | init_globals (void) |
203 | init_globals (void) |
213 | { |
204 | { |
214 | if (settings.logfilename[0] == 0) |
205 | if (settings.logfilename[0] == 0) |
215 | logfile = stderr; |
206 | logfile = stderr; |
… | |
… | |
244 | at = at->next; |
235 | at = at->next; |
245 | } |
236 | } |
246 | |
237 | |
247 | LOG (llevDebug, "You Need a archetype called 'map' and it have to contain start map\n"); |
238 | LOG (llevDebug, "You Need a archetype called 'map' and it have to contain start map\n"); |
248 | exit (-1); |
239 | exit (-1); |
249 | } |
|
|
250 | |
|
|
251 | unsigned long todtick; |
|
|
252 | |
|
|
253 | /* |
|
|
254 | * Write out the current time to the file so time does not |
|
|
255 | * reset every time the server reboots. |
|
|
256 | */ |
|
|
257 | |
|
|
258 | void |
|
|
259 | write_todclock (void) |
|
|
260 | { |
|
|
261 | char filename[MAX_BUF]; |
|
|
262 | FILE *fp; |
|
|
263 | |
|
|
264 | sprintf (filename, "%s/clockdata", settings.localdir); |
|
|
265 | if ((fp = fopen (filename, "w")) == NULL) |
|
|
266 | { |
|
|
267 | LOG (llevError, "Cannot open %s for writing\n", filename); |
|
|
268 | return; |
|
|
269 | } |
|
|
270 | fprintf (fp, "%lu", todtick); |
|
|
271 | fclose (fp); |
|
|
272 | } |
|
|
273 | |
|
|
274 | /* |
|
|
275 | * initialises the gametime and TOD counters |
|
|
276 | * Called by init_library(). |
|
|
277 | */ |
|
|
278 | |
|
|
279 | void |
|
|
280 | init_clocks (void) |
|
|
281 | { |
|
|
282 | char filename[MAX_BUF]; |
|
|
283 | FILE *fp; |
|
|
284 | static int has_been_done = 0; |
|
|
285 | |
|
|
286 | if (has_been_done) |
|
|
287 | return; |
|
|
288 | else |
|
|
289 | has_been_done = 1; |
|
|
290 | |
|
|
291 | sprintf (filename, "%s/clockdata", settings.localdir); |
|
|
292 | LOG (llevDebug, "Reading clockdata from %s...\n", filename); |
|
|
293 | if ((fp = fopen (filename, "r")) == NULL) |
|
|
294 | { |
|
|
295 | LOG (llevError, "Can't open %s.\n", filename); |
|
|
296 | todtick = 0; |
|
|
297 | write_todclock (); |
|
|
298 | return; |
|
|
299 | } |
|
|
300 | fscanf (fp, "%lu", &todtick); |
|
|
301 | LOG (llevDebug, "todtick=%lu\n", todtick); |
|
|
302 | fclose (fp); |
|
|
303 | } |
240 | } |
304 | |
241 | |
305 | /* |
242 | /* |
306 | * initialises the attack messages. |
243 | * initialises the attack messages. |
307 | * Called by init_library(). |
244 | * Called by init_library(). |