ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/arch.C
(Generate patch)

Comparing deliantra/server/common/arch.C (file contents):
Revision 1.46 by root, Mon Apr 16 06:23:39 2007 UTC vs.
Revision 1.48 by root, Mon Apr 16 11:09:30 2007 UTC

275 } 275 }
276 276
277 return 0; 277 return 0;
278} 278}
279 279
280void
281init_archetypes (void)
282{
283 load_archetypes ();
284
285 empty_archetype = archetype::find ("empty_archetype");
286}
287
288archetype::archetype () 280archetype::archetype ()
289{ 281{
290 clone.arch = this; 282 clone.arch = this;
291 283
292 CLEAR_FLAG (&clone, FLAG_FREED); /* This shouldn't matter, since copy_to */ 284 CLEAR_FLAG (&clone, FLAG_FREED); /* This shouldn't matter, since copy_to */
418 410
419/* 411/*
420 * First initialises the archtype hash-table (init_archetable()). 412 * First initialises the archtype hash-table (init_archetable()).
421 * Reads and parses the archetype file (with the first and second-pass 413 * Reads and parses the archetype file (with the first and second-pass
422 * functions). 414 * functions).
423 * Then initialises treasures by calling load_treasures().
424 */ 415 */
425void 416bool
426load_archetypes (void) 417load_archetype_file (const char *filename)
427{ 418{
428 char filename[MAX_BUF];
429
430 sprintf (filename, "%s/%s", settings.datadir, settings.archetypes);
431 LOG (llevDebug, "Reading archetypes from %s:\n", filename);
432
433 object_thawer f (filename); 419 object_thawer f (filename);
434 420
435 f.next (); 421 f.next ();
436 422
423 // make sure the next - long - step is only done after a tick
424 coroapi::wait_for_tick_begin ();
425
437 if (!load_archetypes (f)) 426 if (!load_archetypes (f))
438 cleanup ("unable to load archetypes"); 427 return false;
439 428
440 warn_archetypes = 1; 429 warn_archetypes = 1;
430
431 empty_archetype = archetype::find ("empty_archetype");
432 if (!empty_archetype)
433 return false;
434
435 coroapi::cede ();
436
437 return true;
441} 438}
442 439
443/* 440/*
444 * Creates and returns a new object which is a copy of the given archetype. 441 * Creates and returns a new object which is a copy of the given archetype.
445 * This function returns NULL on failure. 442 * This function returns NULL on failure.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines