ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/skill_util.C
(Generate patch)

Comparing deliantra/server/server/skill_util.C (file contents):
Revision 1.92 by root, Sat Apr 10 04:54:10 2010 UTC vs.
Revision 1.93 by root, Sat Apr 10 05:12:57 2010 UTC

207 if (tmp->type == SKILL && tmp->subtype == skillno) 207 if (tmp->type == SKILL && tmp->subtype == skillno)
208 if (object *skop = find_skill_by_name (who, tmp->skill)) 208 if (object *skop = find_skill_by_name (who, tmp->skill))
209 return skop; 209 return skop;
210 210
211 return 0; 211 return 0;
212}
213
214/* This changes the objects chosen_skill to new_skill.
215 * return 1 on success, 0 on error
216 */
217bool
218object::change_skill (object *new_skill)
219{
220 if (type != PLAYER)
221 return 0;
222
223 // optimise this supposedly common case
224 if (new_skill == chosen_skill)
225 return 1;
226
227 if (chosen_skill)
228 {
229 chosen_skill->flag [FLAG_APPLIED] = false;
230 change_abil (this, chosen_skill);
231 }
232
233 chosen_skill = new_skill;
234
235 if (chosen_skill)
236 {
237 chosen_skill->flag [FLAG_APPLIED] = true;
238 change_abil (this, chosen_skill);
239 }
240
241 // always clear current weapon, as the selected skill could
242 // conflict with the current weapon skill, which would go
243 // undetected and exp would be given to the wrong skill.
244 current_weapon = 0;
245
246 update_stats ();
247 return 1;
248} 212}
249 213
250/* do_skill() - Main skills use function-similar in scope to cast_spell(). 214/* do_skill() - Main skills use function-similar in scope to cast_spell().
251 * We handle all requests for skill use outside of some combat here. 215 * We handle all requests for skill use outside of some combat here.
252 * We require a separate routine outside of fire() so as to allow monsters 216 * We require a separate routine outside of fire() so as to allow monsters

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines