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