… | |
… | |
50 | |
50 | |
51 | // the vector of other_arch references to be resolved |
51 | // the vector of other_arch references to be resolved |
52 | static std::vector< std::pair<arch_ptr *, shstr> > postponed_arch_ref; |
52 | static std::vector< std::pair<arch_ptr *, shstr> > postponed_arch_ref; |
53 | // the vector of loaded but not yet committed archetypes |
53 | // the vector of loaded but not yet committed archetypes |
54 | static std::vector<archetype *> postponed_arch; |
54 | static std::vector<archetype *> postponed_arch; |
|
|
55 | |
|
|
56 | //+GPL |
|
|
57 | |
|
|
58 | /* |
|
|
59 | * Creates an object. This function is called by get_archetype() |
|
|
60 | * if it fails to find the appropriate archetype. |
|
|
61 | * Thus get_archetype() will be guaranteed to always return |
|
|
62 | * an object, and never NULL. |
|
|
63 | */ |
|
|
64 | object * |
|
|
65 | create_singularity (const char *name) |
|
|
66 | { |
|
|
67 | LOG (llevError | logBacktrace, "FATAL: creating singularity for '%s'.\n", name); |
|
|
68 | |
|
|
69 | if (!strcmp (name, "bug")) |
|
|
70 | abort (); |
|
|
71 | |
|
|
72 | object *op = archetype::get (shstr_bug); |
|
|
73 | op->name = op->name_pl = format ("bug, please report (missing archetype %s)", name); |
|
|
74 | |
|
|
75 | return op; |
|
|
76 | } |
55 | |
77 | |
56 | /** |
78 | /** |
57 | * GROS - This function retrieves an archetype given the name that appears |
79 | * GROS - This function retrieves an archetype given the name that appears |
58 | * during the game (for example, "writing pen" instead of "stylus"). |
80 | * during the game (for example, "writing pen" instead of "stylus"). |
59 | * It does not use the hashtable system, but browse the whole archlist each time. |
81 | * It does not use the hashtable system, but browse the whole archlist each time. |
… | |
… | |
276 | } |
298 | } |
277 | |
299 | |
278 | return 0; |
300 | return 0; |
279 | } |
301 | } |
280 | |
302 | |
|
|
303 | //-GPL |
|
|
304 | |
281 | archetype::archetype (const char *name) |
305 | archetype::archetype (const char *name) |
282 | { |
306 | { |
283 | arch = this; |
307 | arch = this; |
284 | this->archname = this->name = this->name_pl = name; |
308 | this->archname = this->name = this->name_pl = name; |
285 | } |
309 | } |
… | |
… | |
541 | object *op = clone (); |
565 | object *op = clone (); |
542 | op->instantiate (); |
566 | op->instantiate (); |
543 | return op; |
567 | return op; |
544 | } |
568 | } |
545 | |
569 | |
546 | /* |
570 | //+GPL |
547 | * Creates an object. This function is called by get_archetype() |
|
|
548 | * if it fails to find the appropriate archetype. |
|
|
549 | * Thus get_archetype() will be guaranteed to always return |
|
|
550 | * an object, and never NULL. |
|
|
551 | */ |
|
|
552 | object * |
|
|
553 | create_singularity (const char *name) |
|
|
554 | { |
|
|
555 | LOG (llevError | logBacktrace, "FATAL: creating singularity for '%s'.\n", name); |
|
|
556 | |
|
|
557 | if (!strcmp (name, "bug")) |
|
|
558 | abort (); |
|
|
559 | |
|
|
560 | object *op = archetype::get (shstr_bug); |
|
|
561 | op->name = op->name_pl = format ("bug, please report (missing archetype %s)", name); |
|
|
562 | |
|
|
563 | return op; |
|
|
564 | } |
|
|
565 | |
571 | |
566 | /* |
572 | /* |
567 | * Finds which archetype matches the given name, and returns a new |
573 | * Finds which archetype matches the given name, and returns a new |
568 | * object containing a copy of the archetype. |
574 | * object containing a copy of the archetype. |
569 | */ |
575 | */ |
… | |
… | |
643 | } |
649 | } |
644 | |
650 | |
645 | return head; |
651 | return head; |
646 | } |
652 | } |
647 | |
653 | |
|
|
654 | //-GPL |
|
|
655 | |