… | |
… | |
152 | init_block (); |
152 | init_block (); |
153 | init_anim (); /* Must be after we read in the bitmaps */ |
153 | init_anim (); /* Must be after we read in the bitmaps */ |
154 | init_archetypes (); /* Reads all archetypes from file */ |
154 | init_archetypes (); /* Reads all archetypes from file */ |
155 | init_dynamic (); |
155 | init_dynamic (); |
156 | init_attackmess (); |
156 | init_attackmess (); |
157 | init_clocks (); |
|
|
158 | init_experience (); |
157 | init_experience (); |
159 | } |
158 | } |
160 | |
159 | |
161 | |
160 | |
162 | /* init_environ initialises values from the environmental variables. |
161 | /* init_environ initialises values from the environmental variables. |
… | |
… | |
237 | at = at->next; |
236 | at = at->next; |
238 | } |
237 | } |
239 | |
238 | |
240 | LOG (llevDebug, "You Need a archetype called 'map' and it have to contain start map\n"); |
239 | LOG (llevDebug, "You Need a archetype called 'map' and it have to contain start map\n"); |
241 | exit (-1); |
240 | exit (-1); |
242 | } |
|
|
243 | |
|
|
244 | unsigned long todtick; |
|
|
245 | |
|
|
246 | /* |
|
|
247 | * Write out the current time to the file so time does not |
|
|
248 | * reset every time the server reboots. |
|
|
249 | */ |
|
|
250 | void |
|
|
251 | write_todclock (void) |
|
|
252 | { |
|
|
253 | char filename[MAX_BUF]; |
|
|
254 | FILE *fp; |
|
|
255 | |
|
|
256 | sprintf (filename, "%s/clockdata", settings.localdir); |
|
|
257 | if ((fp = fopen (filename, "w")) == NULL) |
|
|
258 | { |
|
|
259 | LOG (llevError, "Cannot open %s for writing\n", filename); |
|
|
260 | return; |
|
|
261 | } |
|
|
262 | fprintf (fp, "%lu", todtick); |
|
|
263 | fclose (fp); |
|
|
264 | } |
|
|
265 | |
|
|
266 | /* |
|
|
267 | * initialises the gametime and TOD counters |
|
|
268 | * Called by init_library(). |
|
|
269 | */ |
|
|
270 | void |
|
|
271 | init_clocks (void) |
|
|
272 | { |
|
|
273 | char filename[MAX_BUF]; |
|
|
274 | FILE *fp; |
|
|
275 | static int has_been_done = 0; |
|
|
276 | |
|
|
277 | if (has_been_done) |
|
|
278 | return; |
|
|
279 | else |
|
|
280 | has_been_done = 1; |
|
|
281 | |
|
|
282 | sprintf (filename, "%s/clockdata", settings.localdir); |
|
|
283 | LOG (llevDebug, "Reading clockdata from %s...\n", filename); |
|
|
284 | if ((fp = fopen (filename, "r")) == NULL) |
|
|
285 | { |
|
|
286 | LOG (llevError, "Can't open %s.\n", filename); |
|
|
287 | todtick = 0; |
|
|
288 | write_todclock (); |
|
|
289 | return; |
|
|
290 | } |
|
|
291 | |
|
|
292 | fscanf (fp, "%lu", &todtick); |
|
|
293 | LOG (llevDebug, "todtick=%lu\n", todtick); |
|
|
294 | fclose (fp); |
|
|
295 | } |
241 | } |
296 | |
242 | |
297 | /* |
243 | /* |
298 | * initialises the attack messages. |
244 | * initialises the attack messages. |
299 | * Called by init_library(). |
245 | * Called by init_library(). |