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