… | |
… | |
54 | static std::vector<archetype *> postponed_arch; |
54 | static std::vector<archetype *> postponed_arch; |
55 | |
55 | |
56 | //+GPL |
56 | //+GPL |
57 | |
57 | |
58 | /* |
58 | /* |
59 | * Creates an object. This function is called by get_archetype() |
59 | * Creates an object. This function is called by get_archetype () |
60 | * if it fails to find the appropriate archetype. |
60 | * if it fails to find the appropriate archetype. |
61 | * Thus get_archetype() will be guaranteed to always return |
61 | * Thus get_archetype() will be guaranteed to always return |
62 | * an object, and never NULL. |
62 | * an object, and never NULL. |
63 | */ |
63 | */ |
64 | static object * |
64 | static object * |
… | |
… | |
349 | return 0; |
349 | return 0; |
350 | else |
350 | else |
351 | return i->second; |
351 | return i->second; |
352 | } |
352 | } |
353 | |
353 | |
|
|
354 | void |
|
|
355 | archetype::post_load_check () |
|
|
356 | { |
|
|
357 | object::post_load_check (); |
|
|
358 | |
|
|
359 | assert (("obj_original MUST NOT be set for archetypes", !flag [FLAG_OBJ_ORIGINAL])); |
|
|
360 | } |
|
|
361 | |
354 | archetype * |
362 | archetype * |
355 | archetype::read (object_thawer &f) |
363 | archetype::read (object_thawer &f) |
356 | { |
364 | { |
357 | assert (f.kw == KW_object); |
365 | assert (f.kw == KW_object); |
358 | |
366 | |
… | |
… | |
592 | |
600 | |
593 | /* |
601 | /* |
594 | * Returns the first archetype using the given type. |
602 | * Returns the first archetype using the given type. |
595 | * Used in treasure-generation. |
603 | * Used in treasure-generation. |
596 | */ |
604 | */ |
597 | archetype * |
605 | static archetype * |
598 | type_to_archetype (int type) |
606 | type_to_archetype (int type) |
599 | { |
607 | { |
600 | for_all_archetypes (at) |
608 | for_all_archetypes (at) |
601 | if (at->type == type && at->head_ () != at) |
609 | if (at->type == type && at->head_ () != at) |
602 | return at; |
610 | return at; |