… | |
… | |
28 | |
28 | |
29 | #include <global.h> |
29 | #include <global.h> |
30 | #include <living.h> |
30 | #include <living.h> |
31 | #include <spells.h> |
31 | #include <spells.h> |
32 | |
32 | |
33 | /* init_gods() - this takes a look at all of the archetypes to find |
|
|
34 | * the objects which correspond to the GODS (type GOD) */ |
|
|
35 | |
|
|
36 | void |
|
|
37 | init_gods (void) |
|
|
38 | { |
|
|
39 | LOG (llevDebug, "Initialising gods...\n"); |
|
|
40 | |
|
|
41 | for_all_archetypes (at) |
|
|
42 | if (at->type == GOD) |
|
|
43 | add_god_to_list (at); |
|
|
44 | |
|
|
45 | LOG (llevDebug, "done.\n"); |
|
|
46 | } |
|
|
47 | |
|
|
48 | /* add_god_to_list()- called only from init_gods */ |
33 | /* add_god_to_list()- called only from init_gods */ |
49 | void |
34 | static void |
50 | add_god_to_list (archetype *god_arch) |
35 | add_god_to_list (archetype *god_arch) |
51 | { |
36 | { |
52 | if (!god_arch) |
37 | if (!god_arch) |
53 | { |
38 | { |
54 | LOG (llevError, "ERROR: Tried to add null god to list!\n"); |
39 | LOG (llevError, "ERROR: Tried to add null god to list!\n"); |
… | |
… | |
83 | } |
68 | } |
84 | |
69 | |
85 | /* baptize_altar() - (cosmetically) change the name to that of the |
70 | /* baptize_altar() - (cosmetically) change the name to that of the |
86 | * god in question, then set the title for later use. -b.t. |
71 | * god in question, then set the title for later use. -b.t. |
87 | */ |
72 | */ |
88 | int |
73 | static int |
89 | baptize_altar (object *op) |
74 | baptize_altar (object *op) |
90 | { |
75 | { |
91 | char buf[MAX_BUF]; |
76 | char buf[MAX_BUF]; |
92 | |
77 | |
93 | /* if the title field is pre-set, then that altar is |
78 | /* if the title field is pre-set, then that altar is |
… | |
… | |
140 | return godlnk && godlnk->arch |
125 | return godlnk && godlnk->arch |
141 | ? godlnk->arch |
126 | ? godlnk->arch |
142 | : 0; |
127 | : 0; |
143 | } |
128 | } |
144 | |
129 | |
145 | void |
130 | static void |
146 | free_all_god (void) |
131 | free_all_god (void) |
147 | { |
132 | { |
148 | godlink *god, *godnext; |
133 | godlink *god, *godnext; |
149 | |
134 | |
150 | LOG (llevDebug, "Freeing god information\n"); |
135 | LOG (llevDebug, "Freeing god information\n"); |
… | |
… | |
152 | { |
137 | { |
153 | godnext = god->next; |
138 | godnext = god->next; |
154 | delete god; |
139 | delete god; |
155 | } |
140 | } |
156 | } |
141 | } |
|
|
142 | |
|
|
143 | /* init_gods() - this takes a look at all of the archetypes to find |
|
|
144 | * the objects which correspond to the GODS (type GOD) */ |
|
|
145 | void |
|
|
146 | init_gods (void) |
|
|
147 | { |
|
|
148 | LOG (llevDebug, "Initialising gods...\n"); |
|
|
149 | |
|
|
150 | for_all_archetypes (at) |
|
|
151 | if (at->type == GOD) |
|
|
152 | add_god_to_list (at); |
|
|
153 | |
|
|
154 | LOG (llevDebug, "done.\n"); |
|
|
155 | } |
|
|
156 | |