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.29 by root, Wed Mar 14 00:04:58 2007 UTC vs.
Revision 1.32 by root, Mon Apr 16 06:23:39 2007 UTC

148void 148void
149init_library (void) 149init_library (void)
150{ 150{
151 init_globals (); 151 init_globals ();
152 init_block (); 152 init_block ();
153 init_anim (); /* Must be after we read in the bitmaps */
154 init_archetypes (); /* Reads all archetypes from file */ 153 init_archetypes (); /* Reads all archetypes from file */
155 init_dynamic (); 154 init_dynamic ();
156 init_attackmess (); 155 init_attackmess ();
157 init_clocks ();
158 init_experience (); 156 init_experience ();
159} 157}
160 158
161 159
162/* init_environ initialises values from the environmental variables. 160/* init_environ initialises values from the environmental variables.
235 } 233 }
236 234
237 at = at->next; 235 at = at->next;
238 } 236 }
239 237
240 LOG (llevDebug, "You Need a archetype called 'map' and it have to contain start map\n"); 238 LOG (llevDebug, "You need an archetype of type 'map' and it has to contain the player start map\n");
241 exit (-1); 239 exit (-1);
242}
243
244unsigned 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 */
250void
251write_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 */
270void
271init_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} 240}
296 241
297/* 242/*
298 * initialises the attack messages. 243 * initialises the attack messages.
299 * Called by init_library(). 244 * Called by init_library().

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines