Re: Simple warning :) (+Snippet)

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 04/18/98


On Sun, 19 Apr 1998, Raf wrote:

->   if(GET_CLASS(ch) != CLASS_RANGER && GET_LEVEL(ch) < LVL_GOD)   {
->    send_to_char("You have no idea how to cook food!\r\n", ch);
->    return;
->   }
->
->   if(GET_SKILL(ch, SKILL_COOK) <= 0)
->    {
->     send_to_char("You have no idea how to cook!\r\n", ch);
->     return;
->    }

I would suggest just using the GET_SKILL() check (as I would suggest
for stock Circle, too).  This makes it terribly easy to give the skill
to a new class or a special character.  Plus, it gets (really) ugly to
have,

  if (GET_LEVEL(ch) < LVL_GOD && !IS_RANGER(ch) && !IS_CHEF(ch) &&
      !IS_MOUNTAINEER(ch) && !IS_BARD(ch) && !IS_GYPSY(ch) && ...)

When all of these checks can be handled solely by the GET_SKILL()
check (e.g., if they aren't a ranger, then they won't have the skill,
unless they've been given it [by a god, I presume]).

So, for the sake of clean code, flexibility, and--for stock
Circle--newbie friendliness (I know, some list newbies just did a
double take, considering my battle cry [George :)] of "RTFC").

-dak


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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