… | |
… | |
26 | * the objects which correspond to the GODS (type GOD) */ |
26 | * the objects which correspond to the GODS (type GOD) */ |
27 | |
27 | |
28 | void |
28 | void |
29 | init_gods (void) |
29 | init_gods (void) |
30 | { |
30 | { |
31 | archetype *at = NULL; |
31 | LOG (llevDebug, "Initialising gods...\n"); |
32 | |
32 | |
33 | LOG (llevDebug, "Initialising gods...\n"); |
|
|
34 | for (at = first_archetype; at != NULL; at = at->next) |
33 | for (archetype *at = first_archetype; at; at = at->next) |
35 | if (at->clone.type == GOD) |
34 | if (at->clone.type == GOD) |
36 | add_god_to_list (at); |
35 | add_god_to_list (at); |
37 | |
36 | |
38 | LOG (llevDebug, "done.\n"); |
37 | LOG (llevDebug, "done.\n"); |
39 | } |
38 | } |
… | |
… | |
105 | { |
104 | { |
106 | godlink *god = first_god; |
105 | godlink *god = first_god; |
107 | int i; |
106 | int i; |
108 | |
107 | |
109 | if (god) |
108 | if (god) |
110 | for (i = RANDOM () % (god->id) + 1; god; god = god->next) |
109 | for (i = rndm (god->id) + 1; god; god = god->next) |
111 | if (god->id == i) |
110 | if (god->id == i) |
112 | break; |
111 | break; |
113 | |
112 | |
114 | if (!god) |
113 | if (!god) |
115 | LOG (llevError, "get_rand_god(): can't find a random god!\n"); |
114 | LOG (llevError, "get_rand_god(): can't find a random god!\n"); |
|
|
115 | |
116 | return god; |
116 | return god; |
117 | } |
117 | } |
118 | |
118 | |
119 | /* pntr_to_god_obj() - returns a pointer to the object |
119 | /* pntr_to_god_obj() - returns a pointer to the object |
120 | * We need to be VERY carefull about using this, as we |
120 | * We need to be VERY carefull about using this, as we |