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.28 by root, Sun Mar 11 02:12:44 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 ReadSmooth ();
154 init_anim (); /* Must be after we read in the bitmaps */
155 init_archetypes (); /* Reads all archetypes from file */ 153 init_archetypes (); /* Reads all archetypes from file */
156 init_dynamic (); 154 init_dynamic ();
157 init_attackmess (); 155 init_attackmess ();
158 init_clocks ();
159 init_experience (); 156 init_experience ();
160} 157}
161 158
162 159
163/* init_environ initialises values from the environmental variables. 160/* init_environ initialises values from the environmental variables.
236 } 233 }
237 234
238 at = at->next; 235 at = at->next;
239 } 236 }
240 237
241 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");
242 exit (-1); 239 exit (-1);
243}
244
245unsigned 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 */
251void
252write_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 */
271void
272init_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} 240}
297 241
298/* 242/*
299 * initialises the attack messages. 243 * initialises the attack messages.
300 * Called by init_library(). 244 * Called by init_library().

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines