Re: Class Implementation

From: Hans H. Hjort (hjort@S-96-226.RESNET.OHIO-STATE.EDU)
Date: 08/07/97


On Thu, 7 Aug 1997, Stephen Marz wrote:

> Anyone want to tell me why this class implementation only returns 0? It
> will not return any other value. I even made a test define, the
> GET_CLASS(mob_proto +i) = NPC_CLASS_UNKNOWN, unknown is number 11 in the
> structs.h file.
>
> sscanf(line, "%s %s %d %s %c", f1, f2, t + 2, &race_letter, &letter);

is race_letter a char? if so, then the format string should be
"%s %s %d %c %c", otherwise if you have
char race_letter[];
then you don't need the & in front of it.

>   switch (race_letter)
>   {
[...]
>   case 'fa':
>    GET_CLASS(mob_proto + i) = NPC_CLASS_FAIRY;
>    break;
>
Ahh, big problem, you can't use switch on strings. if you want
race_letter to be a string, you will need to use a bunch of strcmp's and
if statements.

                                                -Hans H Hjort


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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