Re: Problems with GET_RACE(ch)

From: Mike Stilson (
Date: 06/09/02

On Sun, Jun 09, 2002 at 07:23:32AM -0300, Alex Mann wrote:
>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.


   | FAQ: |
   | Archives: |
   | Newbie List:   |

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