… | |
… | |
75 | { |
75 | { |
76 | if (caster == op && spob->skill) |
76 | if (caster == op && spob->skill) |
77 | dest->skill = spob->skill; |
77 | dest->skill = spob->skill; |
78 | else |
78 | else |
79 | dest->skill = caster->skill; |
79 | dest->skill = caster->skill; |
80 | } |
|
|
81 | |
|
|
82 | /* init_spells: This should really be called check_spells, as that |
|
|
83 | * is what it does. It goes through the spells looking for any |
|
|
84 | * obvious errors. This was most useful in debugging when re-doing |
|
|
85 | * all the spells to catch simple errors. To use it all the time |
|
|
86 | * will result in it spitting out messages that aren't really errors. |
|
|
87 | */ |
|
|
88 | void |
|
|
89 | init_spells (void) |
|
|
90 | { |
|
|
91 | #ifdef SPELL_DEBUG |
|
|
92 | static int init_spells_done = 0; |
|
|
93 | int i; |
|
|
94 | archetype *at; |
|
|
95 | |
|
|
96 | if (init_spells_done) |
|
|
97 | return; |
|
|
98 | LOG (llevDebug, "Checking spells...\n"); |
|
|
99 | |
|
|
100 | for_all_archetypes (at) |
|
|
101 | { |
|
|
102 | if (at->type == SPELL) |
|
|
103 | { |
|
|
104 | if (at->skill) |
|
|
105 | { |
|
|
106 | for (i = 1; i < NUM_SKILLS; i++) |
|
|
107 | if (!strcmp (skill_names[i], at->skill)) |
|
|
108 | break; |
|
|
109 | if (i == NUM_SKILLS) |
|
|
110 | { |
|
|
111 | LOG (llevError, "Spell %s has improper associated skill %s\n", at->name, at->skill); |
|
|
112 | } |
|
|
113 | } |
|
|
114 | /* other_arch is already checked for in the loader */ |
|
|
115 | } |
|
|
116 | } |
|
|
117 | |
|
|
118 | i = 0; |
|
|
119 | while (spell_mapping[i]) |
|
|
120 | { |
|
|
121 | if (!archetype::find (spell_mapping[i])) |
|
|
122 | { |
|
|
123 | LOG (llevError, "Unable to find spell mapping %s (%i)\n", spell_mapping[i], i); |
|
|
124 | } |
|
|
125 | i++; |
|
|
126 | } |
|
|
127 | LOG (llevDebug, "Checking spells completed.\n"); |
|
|
128 | #endif |
|
|
129 | } |
|
|
130 | |
|
|
131 | /* Dumps all the spells - now also dumps skill associated with the spell. |
|
|
132 | * not sure what this would be used for, as the data seems pretty |
|
|
133 | * minimal, but easy enough to keep around. |
|
|
134 | */ |
|
|
135 | void |
|
|
136 | dump_spells () |
|
|
137 | { |
|
|
138 | for_all_archetypes (at) |
|
|
139 | if (at->type == SPELL) |
|
|
140 | fprintf (stderr, "%s:%s:%s:%s:%d\n", &at->object::name, |
|
|
141 | &at->archname, at->other_arch ? &at->other_arch->archname : "<nil>", &at->skill, at->level); |
|
|
142 | } |
80 | } |
143 | |
81 | |
144 | /* pretty basic function - basically just takes |
82 | /* pretty basic function - basically just takes |
145 | * an object, sets the x,y, and calls insert_ob_in_map |
83 | * an object, sets the x,y, and calls insert_ob_in_map |
146 | */ |
84 | */ |