invalid class

From: Matthew Kuebbeler (flawed@southwind.net)
Date: 08/23/00


Hi all,
        I'm having a bit of trouble trying to get this file to compile.
In class.c I've added several new classes and I get the following error
when I make:
class.c: In function `invalid class`:
class.c:2043: parse error before `==`
class.c:2043: parse error before `)`
class.c:2053: warning: control reaches end of non-void function

I've included the stat abils due to the `==` being in those, and no where
near `invalid_class`.

/*
 * Roll the 6 stats for a character... each stat is made of the sum of
 * the best 3 out of 4 rolls of a 6-sided die.  Each class then decides
 * which priority will be given for the best to worst stats.
 */
void roll_real_abils(struct char_data * ch)
{
  int i, j, k, temp;
  ubyte table[6];
  ubyte rolls[4];

  for (i = 0; i < 6; i++)
    table[i] = 0;

  for (i = 0; i < 6; i++) {

    for (j = 0; j < 4; j++)
      rolls[j] = number(1, 6);

    temp = rolls[0] + rolls[1] + rolls[2] + rolls[3] -
      MIN(rolls[0], MIN(rolls[1], MIN(rolls[2], rolls[3])));

    for (k = 0; k < 6; k++)
      if (table[k] < temp) {
        temp ^= table[k];
        table[k] ^= temp;
        temp ^= table[k];
      }
  }

  ch->real_abils.str_add = 0;

  switch (GET_CLASS(ch)) {
  case CLASS_MAGIC_USER:
  case CLASS_RENEGADE:
  case CLASS_WHITE_ROBE_WIZARD:
  case CLASS_RED_ROBE_WIZARD:
  case CLASS_BLACK_ROBE_WIZARD:
    ch->real_abils.intel = table[0];
    ch->real_abils.wis = table[1];
    ch->real_abils.dex = table[2];
    ch->real_abils.str = table[3];
    ch->real_abils.con = table[4];
    ch->real_abils.cha = table[5];
    break;
  case CLASS_CLERIC:
    ch->real_abils.wis = table[0];
    ch->real_abils.intel = table[1];
    ch->real_abils.str = table[2];
    ch->real_abils.dex = table[3];
    ch->real_abils.con = table[4];
    ch->real_abils.cha = table[5];
    break;
  case CLASS_DRUID:
    ch->real_abils.wis = table[0];
    ch->real_abils.intel = table[1];
    ch->real_abils.cha = table[2];
    ch->real_abils.str = table[3];
    ch->real_abils.dex = table[4];
    ch->real_abils.con = table[5];
    break;
  case CLASS_THIEF:
    ch->real_abils.dex = table[0];
    ch->real_abils.str = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.intel = table[3];
    ch->real_abils.wis = table[4];
    ch->real_abils.cha = table[5];
    break;
  case CLASS_BARD:
    ch->real_abils.dex = table[0];
    ch->real_abils.intel = table[1];
    ch->real_abils.cha = table[2];
    ch->real_abils.wis = table[3];
    ch->real_abils.con = table[4];
    ch->real_abils.str = table[5];
    break;
  case CLASS_WARRIOR:
    ch->real_abils.str = table[0];
    ch->real_abils.dex = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.wis = table[3];
    ch->real_abils.intel = table[4];
    ch->real_abils.cha = table[5];
    if (ch->real_abils.str == 18)
      ch->real_abils.str_add = number(0, 100);
    break;
  case CLASS_BARBARIAN:
    ch->real_abils.con = table[0];
    ch->real_abils.str = table[1];
    ch->real_abils.dex = table[2];
    ch->real_abils.wis = table[3];
    ch->real_abils.intel = table[4];
    ch->real_abils.cha = table[5];
    if (ch->real_abils.str == 18)
      ch->real_abils.str_add = number(0, 100);
    break;
  case CLASS_KNIGHT:
    ch->real_abils.str = table[0];
    ch->real_abils.wis = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.dex = table[3];
    ch->real_abils.intel = table[4];
    ch->real_abils.cha = table[5];
    if (ch->real_abils.str == 18)
      ch->real_abils.str_add = number(0, 100);
    break;
  case CLASS_PALADIN:
    ch->real_abils.cha = table[0];
    ch->real_abils.wis = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.str = table[3];
    ch->real_abils.intel = table[4];
    ch->real_abils.dex = table[5];
    if (ch->real_abils.str == 18)
      ch->real_abils.str_add = number(0, 100);
    break;
  case CLASS_RANGER:
    ch->real_abils.str = table[0];
    ch->real_abils.wis = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.dex = table[3];
    ch->real_abils.intel = table[4];
    ch->real_abils.cha = table[5];
    if (ch->real_abils.str == 18)
      ch->real_abils.str_add = number(0, 100);
    break;
  }
  ch->aff_abils = ch->real_abils;
}

/*
 * invalid_class is used by handler.c to determine if a piece of equipment is
 * usable by a particular class, based on the ITEM_ANTI_{class} bitvectors.
 */

int invalid_class(struct char_data *ch, struct obj_data *obj) {
  if ((IS_OBJ_STAT(obj, ITEM_ANTI_MAGIC_USER) && IS_MAGIC_USER(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_RENEGADE) && IS_RENEGADE(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_WHITE_ROBE_WIZARD) && IS_WHITE_ROBE_WIZARD(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_RED_ROBE_WIZARD) && IS_RED_ROBE_WIZARD(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_BLACK_ROBE_WIZARD) && IS_BLACK_ROBE_WIZARD(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_CLERIC) && IS_CLERIC(ch)) ||
 /* 2043 */     (IS_OBJ_STAT(obj, ITEM_ANTI_DRUID) && IS_DRUID(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_WARRIOR) && IS_WARRIOR(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_BARBARIAN) && IS_BARBARIAN(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_KNIGHT) && IS_KNIGHT(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_PALADIN) && IS_PALADIN(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_THIEF) && IS_THIEF(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_BARD) && IS_BARD(ch)))
        return 1;
  else
        return 0;
}


Any help on this will be appreciated....I've been looking so much my eyes
are starting to bug out.

Matt


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



This archive was generated by hypermail 2b30 : 04/11/01 PDT