[NEWBIE][CODE] invalid_race/invalid_class

From: Jared Noble (jnoble@inreach.com)
Date: 03/06/01


I thought I would tackle adding races to circle30bpl17. Basically, I
followed the instructions on the wtfaq. There were one or two inconsistances
but nothing major. Everything compiled fine except for class.c

Here is what the faq says to add at the bottom of class.c

------------snip snip--------------

int invalid_race(struct char_data *ch, struct obj_data *obj) {
  if ((IS_OBJ_STAT(obj, ITEM_ANTI_HUMAN) && IS_HUMAN(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_ELF)   && IS_ELF(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_GNOME) && IS_GNOME(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_FAIRY) && IS_FAIRY(ch)))
        return 1;
  else
        return 0;
}

------------snip snip--------------

The only modification I had made was not following that particular list of
races. Anyhow, upon compile the following error was thrown at me.

gcc -g -O2 -Wall  -c class.c
class.c: In function `invalid_race':
class.c:2270: warning: suggest parentheses around && within ||
class.c:2270: parse error before `return'
*** Error code 1

So, I tooled around a bit hoping to figure it out without needed to write
this here email. Basically, I removed the extra parentheses. That got rid of
the warning - suggestion for added parantheses around && but the parse error
still remains. I've gone through and typed in the text by hand and still
there is parse error. I cannot figure out what's going on. Here is what I
have.

------------snip snip--------------

int invalid_race(struct char_data *ch, struct obj_data *obj)
{
  if  (IS_OBJ_STAT(obj, ITEM_ANTI_HUMAN)    && IS_HUMAN(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_ELF)      && IS_ELF(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_HALF_ELF) && IS_HALF_ELF(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_DWARF)    && IS_DWARF(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_HALFLING) && IS_HALFLING(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_GNOME)    && IS_GNOME(ch))
      return 1;
  else
      return 0;
}

------------snip snip--------------

Maybe I am missing something. Anybody have any suggestions for me?

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST