[CODE] Yup.. me again with more problems.. :>

From: Steve Reeves (dormammu@voicenet.com)
Date: 10/19/96


I've determined I'm the worst coder on the face of the Earth.. :>  [Well,
look at it this way, I'm gonna be trying to recruit some experienced Circle
coders soon to work on my MUD with me.. the list won't have to put up with
me asking a question a day much longer :> ]

Okay, anyway, today's dumb question involves the question I asked about
restricting classes to certain races.  I got the snippet off Furry's page
and looked at it and thought, "Hmmm.. I have it set up so you pick class
before race.. so, this method won't quite work."  So, instead of altering it
so you pick race before class, I simply made class restrict what race you
can be, instead of vice versa.  This was fine, as the race system is
modelled after the class system.  [I used the original race.doc to implement
races, remember.]  Anyway, after working for a while I've stumbled upon a
problem.. apparently my code base has become facist and outlawed races.  :>
Basically, you are a new character and you pick class, then you pick race..
BUT.. no matter what race you try, you can't be that race.  Needless to say,
this situation will make my MUD very unpopular once it opens.  :>  Anyway,
here is some code for you to look at:

/*
 * The code to interpret a race letter (used in interpreter.c when a
 * new character is selecting a race).
 */
int parse_race(struct char_data * ch, char arg)
{
  arg = LOWER(arg);

  switch (arg) {
  case 'h':
    return RACE_HUMAN;
    break;
  case 'e':
    if (GET_CLASS(ch) != CLASS_NINJA) {
      return RACE_ELF;
  }  else {
      return RACE_UNDEFINED;
}
    break;
  case 'g':
    if (GET_CLASS(ch) == CLASS_WARRIOR || GET_CLASS(ch) == CLASS_MAGIC_USER
||  GET_CLASS(ch) == CLASS_THIEF || GET_CLASS(ch) == CLASS_CLERIC) {
/*  NOTE:  In the real code, the above 3 lines are all on the same line.
This dumb
mail reader automatically wraps.  Nothing I can do about it. /*
    return RACE_GNOME;
  }  else {
      return RACE_UNDEFINED;
}
    break;

It goes on like that for several more races.  I cannot figure out what it
going on.  I don't even have any statements in Human, so it should
definately work, but it doesn't... nothing at all works.  Pretty much the
rest of class.c is stock code.  Except for two new classes, and the other
race stuff.  [At first I thought maybe I needed '&&' between the
GET_CLASS(ch) stuff, but I'm pretty sure that'd mean the player would have
to be all the races listed.]  Anyway, if anyone can help me, I'd appreciate
it.  :>

[Oh, also, if it matters any, the code bit above comes right after the
parse_class routine.]

Steve -- who promises not to ask dumb code questions anymore.  :>

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