Re: [NEWBIE][CODE] invalid_race/invalid_class

From: The Luthers (Dana and Todd) (luthers@ex-pressnet.com)
Date: 03/06/01


----- Original Message -----
From: "Jared Noble" <jnoble@INREACH.COM>
> Anyhow, I went ahead and cut invalid_class and pasted it over invalid_race,
> changed the class names to the race names etc... again I got the warning to
> add parentheses. So, I went ahead and added them but still I'm having the
> same parse problem.
>
 1- > int invalid_race(struct char_data *ch, struct obj_data *obj) {
 2- >   if (((IS_OBJ_STAT(obj, ITEM_ANTI_HUMAN) && IS_HUMAN(ch))) ||
 3- >       ((IS_OBJ_STAT(obj, ITEM_ANTI_ELF) && IS_ELF(ch))) ||
 4- >       ((IS_OBJ_STAT(obj, ITEM_ANTI_HALF_ELF) && IS_HALF_ELF(ch))) ||
 5- >       ((IS_OBJ_STAT(obj, ITEM_ANTI_DWARF) && IS_DWARF(ch)))
 6- >       ((IS_OBJ_STAT(obj, ITEM_ANTI_HALFLING) && IS_HALFLING(ch))) ||
 7- >       ((IS_OBJ_STAT(obj, ITEM_ANTI_GNOME) && IS_GNOME(ch)))) ||
 8- >         return 1;
 9- >   else
10->         return 0;
11-> }

Your parenthesis and or statements still aren't matched up. I put line
numbers at the start of each line for reference, but:
line 5 needs a || at the end, and line 7 should have none at the end.

Also, you don't need the double (( ))'s between each ||  (though I don't
think it actually *hurts* anything to have them...)

if it doesn't let you without the doubles perhaps try putting ()'s around
your macro calls... like so - maybe one of them is adding something in odd -
I know my MSVC6 does odd things with macro's that Borland didn't do.

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;
}


Dana

--
   +---------------------------------------------------------------+
   | 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