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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines