Hey list,
I'm converting the "quest buy" command into table format, so
it's a lot shorter and easier to update. Before I changed
anything you could type "quest buy suit" or "quest buy energy"
to buy the same item. It used the is_name function to compare
the argument to the list of keywords for the item. So now I
have made a table like this:
const struct prize_type prize_table[] =
{
{ "suit energy", QUEST_ITEM_SUIT_ENERGY,
25000 },
{ "flame darkness", QUEST_ITEM_FLAME_DARKNESS,
20000 },
--cut--
And a prize_lookup function:
int prize_lookup (char *name)
{
int type;
for (type = 0; prize_table[type].name != NULL; type++)
{
if (LOWER(name[0]) == LOWER(prize_table[type].name[0])
&& strstr( name, prize_table[type].name ) )
return type;
}
return -1;
}
Now the problem I'm encountering is that I can type "quest buy
suit" and buy the suit, but not "quest buy energy". So it's not
recognizing any of the keywords in the table after the first
one. What am I doing wrong in the prize_lookup function? Or if
it isn't that, what could it be? Thanks.
=====
-Matt Foltz
[Neoterra MUD] telnet://neoterra.is-a-geek.com:4000
[Car Audio Resources homepage] http://www.car-audio.net
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com