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.47 by root, Mon Apr 16 10:14:25 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 */
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 */ 415 */
424void 416bool
425load_archetypes (void) 417load_archetype_file (const char *filename)
426{ 418{
427 char filename[MAX_BUF];
428
429 sprintf (filename, "%s/%s", settings.datadir, settings.archetypes);
430 LOG (llevDebug, "Reading archetypes from %s:\n", filename);
431
432 object_thawer f (filename); 419 object_thawer f (filename);
433 420
434 f.next (); 421 f.next ();
435 422
423 // make sure the next - long - step is only done after a tick
424 coroapi::wait_for_tick_begin ();
425
436 if (!load_archetypes (f)) 426 if (!load_archetypes (f))
437 cleanup ("unable to load archetypes"); 427 return false;
438 428
439 warn_archetypes = 1; 429 warn_archetypes = 1;
440 430
441 load_treasures (); 431 empty_archetype = archetype::find ("empty_archetype");
432 if (!empty_archetype)
433 return false;
434
435 coroapi::cede ();
436
437 return true;
442} 438}
443 439
444/* 440/*
445 * 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.
446 * This function returns NULL on failure. 442 * This function returns NULL on failure.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines