Bug with Skills revisited (and solved)

From: Christopher J. Dickey (cdickey@texas.net)
Date: 03/27/95


I wrote previously about having trouble with find_skill_num from 
spell_parser.c, and got several suggestions from you all.  My solution 
was this:  modify find_skill_num to make sure that there are no more 
arguments in either the spell/skill list or word sent.  The function 
is_abbrev is okay, I looked over it and it works perfectly, the problem 
is that at the end of find_skill_num you have this statement:

if (ok && !*first2)
   return index;

What this does is make sure there aren't any arguments left in the 
original argument sent to it.  But, if the name of the skill/spell you 
send to it is only one argument, such as firearms, and you have a 
spell/skill higher on the list such as fire cloud, when it goes through 
the loop (take a look at the code to see), it'll exit the loop because 
fire is an abbreviation for firearms.  The reason it was written like 
this was so that you could use spells names like 'prot fro ev' to 
substitute for 'protection from evil'.  The solution was simple, though 
it may be a slight annoyance to some, but who cares :)  By changing the 
last if-statement to this:

if (ok && !*first2 && !*first)
   return index;

you can solve the problem I had.  The only problem with this is that you
can no longer use 'prot' for 'protection from evil', but instead it must 
have the same number of arguments, like 'p f e' if you'd like.  The only 
other way that I could find to solve this was to have it search the list 
the old way, then search for the abreviated versions, which in my opinion 
would take up more time than I'd like.  Thanks for all your all's input.


Chris
(cdickey@texas.net)



This archive was generated by hypermail 2b30 : 12/07/00 PST