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.88 by root, Mon Apr 5 02:05:32 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)
771 if ((skop->type == SKILL || skop->type == SKILL_TOOL)
772 && !strncmp (string, skop->skill, min (strlen (string), strlen (skop->skill))))
773 { 773 {
774 if (skop->type == SKILL 774 skop = find_skill_by_name (op, skop->skill);
775 && skop->flag [FLAG_CAN_USE_SKILL]
776 && skop->skill.starts_with (string))
777 break; 775 break;
778 else if (skop->type == SKILL_TOOL
779 && skop->skill.starts_with (string)
780 && op->apply (skop))
781 break;
782 } 776 }
783 777
784 if (!skop) 778 if (!skop)
785 { 779 {
786 op->failmsg (format ("Unable to find skill %s.", string)); 780 op->failmsgf ("Unable to find skill %s.", string);
787 return 0; 781 return 0;
788 } 782 }
789 783
790 if (!(skill_flags [skop->subtype] & SF_USE)) 784 if (!(skill_flags [skop->subtype] & SF_USE))
791 { 785 {
792 op->failmsg (format ( 786 op->failmsgf (
793 "You feel as if you wanted to do something funny, but you can't remember what. " 787 "You feel as if you wanted to do something funny, but you can't remember what. "
794 "H<The %s skill cannot be used - maybe you need to ready it, use it with some item, or it's always active.>", 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.>",
795 &skop->skill 790 &skop->skill
796 )); 791 );
797 return 0; 792 return 0;
798 } 793 }
799 794
800 len = strlen (skop->skill); 795 len = strlen (skop->skill);
801 796

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines