Re: Problems with GET_RACE(ch)

From: Alex Mann (alex4501@hotmail.com)
Date: 06/09/02


> >However, when ever I try to call GET_RACE(ch), such as in do_score using
>%s
> >call, I get the following compiler error:
> >
> >warning; format argument is not a pointer (arg 4)
> >
> >#define RACE_UNDEFINED    -1
> >#define RACE_HUMAN        0
> >#define RACE_ELF          1
> >#define RACE_TROLL        2
> >#define RACE_DWARF        3
> >#define RACE_HALFLING     4
> >
> >#define NUM_RACES         5
> >
> >So it looks like somewhere GET_RACE got set to be an integer and not a
>char.
> >But i can't seem to find it anywhere in the code, it all looks fine.
>
>No, it's an int to start with.  GET_RACE() is probably defined as
>((ch)->player.race) which is stored as an int.
>
>To print out the race names, you need an array like
>char *race_name[]={"human", "elf", "troll", "dwarf", "halfling"};
>then in the sprintf you'd use race_names[GET_RACE(ch)].
>
>Make sure to check for RACE_UNDEFINED before calling it or you'll blow
>the place up again.
>
>Either that or start them at 0 instead of -1, and add "Undefined" as the
>first element of the array.

Hi

Just a quick thanks, this worked fine, not quite sure why I had to do it
this way this time but not last time, but hey as long as it works.

Thanks



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT