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.86 by root, Sat Apr 3 22:30:21 2010 UTC vs.
Revision 1.92 by root, Sat Apr 10 04:54:10 2010 UTC

168 168
169 if (!skill) 169 if (!skill)
170 skill = give_skill_by_name (who, skill_tool->skill); 170 skill = give_skill_by_name (who, skill_tool->skill);
171 171
172 if (!skill_tool->flag [FLAG_APPLIED]) 172 if (!skill_tool->flag [FLAG_APPLIED])
173 if (apply_special (who, splay (skill_tool), AP_APPLY)) 173 if (!who->apply (splay (skill_tool)))
174 return 0; 174 return 0;
175 175
176 return splay (skill); 176 return splay (skill);
177} 177}
178 178
179object * 179object *
180find_skill_by_name_fuzzy (object *who, const char *name) 180find_skill_by_name_fuzzy (object *who, const char *name)
181{ 181{
182 if (!name) 182 if (name)
183 return 0;
184
185 for (object *tmp = who->inv; tmp; tmp = tmp->below) 183 for (object *tmp = who->inv; tmp; tmp = tmp->below)
186 if ((tmp->type == SKILL || tmp->type == SKILL_TOOL) 184 if ((tmp->type == SKILL || tmp->type == SKILL_TOOL)
187 && tmp->skill.starts_with (name)) 185 && tmp->skill.starts_with (name))
188 if (object *skop = find_skill_by_name (who, tmp->skill)) 186 if (object *skop = find_skill_by_name (who, tmp->skill))
189 return skop; 187 return skop;
190 188
191 return 0; 189 return 0;
192} 190}
193 191
194/* This returns the skill pointer of the given name (the 192/* This returns the skill pointer of the given name (the
408 { 406 {
409 found_cauldron = true; 407 found_cauldron = true;
410 408
411 if (tmp->skill != skill->skill) 409 if (tmp->skill != skill->skill)
412 { 410 {
413 op->failmsg (format ("You can't use the %s with the %s skill!", 411 op->failmsgf ("You can't use the %s with the %s skill!",
414 query_name (tmp), 412 query_name (tmp),
415 query_name (skill))); 413 query_name (skill));
416 break; 414 break;
417 } 415 }
418 416
419 attempt_do_alchemy (op, tmp, skill); 417 attempt_do_alchemy (op, tmp, skill);
420 418
768 766
769 if (!string) 767 if (!string)
770 return 0; 768 return 0;
771 769
772 for (skop = op->inv; skop; skop = skop->below) 770 for (skop = op->inv; skop; skop = skop->below)
773 { 771 if ((skop->type == SKILL || skop->type == SKILL_TOOL)
774 if (skop->type == SKILL
775 && QUERY_FLAG (skop, FLAG_CAN_USE_SKILL)
776 && !strncasecmp (string, skop->skill, min (strlen (string), (size_t) strlen (skop->skill)))) 772 && !strncmp (string, skop->skill, min (strlen (string), strlen (skop->skill))))
773 {
774 skop = find_skill_by_name (op, skop->skill);
777 break; 775 break;
778 else if (skop->type == SKILL_TOOL
779 && !strncasecmp (string, skop->skill, min (strlen (string), (size_t) strlen (skop->skill))))
780 break;
781 } 776 }
782 777
783 if (!skop) 778 if (!skop)
784 { 779 {
785 new_draw_info_format (NDI_UNIQUE, 0, op, "Unable to find skill %s", string); 780 op->failmsgf ("Unable to find skill %s.", string);
781 return 0;
782 }
783
784 if (!(skill_flags [skop->subtype] & SF_USE))
785 {
786 op->failmsgf (
787 "You feel as if you wanted to do something funny, but you can't remember what. "
788 "H<The %s skill cannot be C<use_skill>'ed - maybe you need to C<ready_skill> it, "
789 "use it with some item, or it's always active.>",
790 &skop->skill
791 );
786 return 0; 792 return 0;
787 } 793 }
788 794
789 len = strlen (skop->skill); 795 len = strlen (skop->skill);
790 796
855 * through that code if skill is set to change to the skill. 861 * through that code if skill is set to change to the skill.
856 */ 862 */
857 if (player *pl = op->contr) 863 if (player *pl = op->contr)
858 { 864 {
859 if (skill) 865 if (skill)
860 op->change_skill (skill); 866 {
867 if (!op->apply (skill))
868 return 0;
869 }
861 else 870 else
862 { 871 {
863 if (!pl->combat_ob) 872 if (!pl->combat_ob)
864 { 873 {
865 if (QUERY_FLAG (op, FLAG_READY_WEAPON)) 874 if (QUERY_FLAG (op, FLAG_READY_WEAPON))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines