Re: [code] [newbie] Race crash

From: Derek L. Karnes (dkarnes@mystech.com)
Date: 12/19/96


Allan M. Grant wrote:
> 
> I got the whois to work and now I want to enchance it.
> I was able to do this:
>       sprintf(buf, "%s[%2d %s] %s %s", buf, GET_LEVEL(victim),
>                     CLASS_ABBR(victim), GET_NAME(victim),
>                     GET_TITLE(victim));
> It works like this. I get something like:
> >whois Pheonix
> [54 pa] Pheonix the God of Eternal Cyberflames
> 
> Then I wanted to add my race as well so that instead of getting [54 pa]
> I would get something like [Half-Elf 54 pa] and here is what I got:
>       sprintf(buf, "%s[%s %2d %s] %s %s", buf, GET_RACE(victim),
> GET_LEVEL(victim),
>                     CLASS_ABBR(victim), GET_NAME(victim),
>                     GET_TITLE(victim));
> When I do this and try whois the mud crashes. I tried RACE_ABBR instead
> even though I want the whole race name. And I get unresolved external. I
> added and extern for it below the extern for class_abbr and still I get
> an unresolved external. What is wrong with both of those?

The whois snippet uses struct char_player_data{}, which doesn't have race
as part of it's structure. Check out structs.h for what it does have..

Also, GET_RACE probably returns an integer race value, which you use to
parse into the character string value using something like:
races[GET_RACE(victim)]

--
- Derek L. Karnes
- Mystech Associates, Inc.
- dkarnes@mystech.com
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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