… | |
… | |
275 | } |
275 | } |
276 | |
276 | |
277 | return 0; |
277 | return 0; |
278 | } |
278 | } |
279 | |
279 | |
280 | void |
|
|
281 | init_archetypes (void) |
|
|
282 | { |
|
|
283 | load_archetypes (); |
|
|
284 | |
|
|
285 | empty_archetype = archetype::find ("empty_archetype"); |
|
|
286 | } |
|
|
287 | |
|
|
288 | archetype::archetype () |
280 | archetype::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 | */ |
424 | void |
416 | bool |
425 | load_archetypes (void) |
417 | load_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. |