{NEWBIE} [code bug]

From: Justin Rio (c616077@showme.missouri.edu)
Date: 01/25/97


Hi.

I posted this problem before, and I got one answer (w/o going back to my
saaved mail to see, Thank You whomever answered me the first time), but my
error still persists.
I added one class (brute) to stock circle3.0 patch 11 following the
guidelines in the class.doc available in the circle ftp site
(ftp.circlemud.org/pub/CircleMUD/contrib/doc).  It was suggested to me
that I go back and make sure I didn't re-use bit numbers and that
everything was still defined correctly.  Didn't find any errors there.
Here is the error I am getting when I compile. 

make ../bin/circle
cc -c -g -cckr  class.c

(0476)  (((((obj)->obj_flags.extra_flags) & ((1 << 17)))) &&
     (!(((((ch)->char_specials.saved.act)) & ((1 << 3)))) &&
     (((ch)->player.class) == 4 ))))

******** Line 475 of "class.c": [Error #067]  Improper use of
"extra_flags", only a funtion reference is valid here.

Stop.

Stop.


Okay, now here is some of the code changes I made to class.c when adding
"brute".  I stoped clipping when I hit line 475-ish.  If you think the
prob is in one of the other files I had to change (magic.c, constants.c,
shop.h, structs.h, utils.h, shop.c, config.c) just let me know and I'll
either post it or send it to you specicifcally.  Anywho, here's the
changes:




const char *pc_class_types[] = {
  "Magic User",
  "Cleric",
  "Thief",
  "Warrior",
  "Brute",
  "\n"
};


/* The menu for choosing a class in interpreter.c: */
const char *class_menu =
"\r\n"
"Select a class:\r\n"
"  [C]leric\r\n"
"  [T]hief\r\n"
"  [W]arrior\r\n"
"  [M]agic-user\r\n"
"  [B]rute\r\n";



/*
 * The code to interpret a class letter -- used in interpreter.c when a
 * new character is selecting a class and by 'set class' in act.wizard.c.
 */

int parse_class(char arg)
{
  arg = LOWER(arg);

  switch (arg) {
  case 'm':
    return CLASS_MAGIC_USER;
    break;
  case 'c':
    return CLASS_CLERIC;
    break;
  case 'w':
    return CLASS_WARRIOR;
    break;
  case 't':
    return CLASS_THIEF;
    break;
  case 'b':
    return CLASS_BRUTE;
    break;
  default:
    return CLASS_UNDEFINED;
    break;
  }
}

/*
 * bitvectors (i.e., powers of two) for each class, mainly for use in
 * do_who and do_users.  Add new classes at the end so that all classes
 * use sequential powers of two (1 << 0, 1 << 1, 1 << 2, 1 << 3, 1 << 4,
 * 1 << 5, etc.
 */

------------------

long find_class_bitvector(char arg)
{
  arg = LOWER(arg);

  switch (arg) {
    case 'm':
      return (1 << 0);
      break;
    case 'c':
      return (1 << 1);
      break;
    case 't':
      return (1 << 2);
      break;
    case 'w':
      return (1 << 3);
      break;
    case 'b':
      return (1 << 4);
      break;
    default:
      return 0;
      break;
  }
}
____________________

  case CLASS_BRUTE:
    add_hp += number(11, 16);
    add_mana = number(GET_LEVEL(ch), (int) (1.5 * GET_LEVEL(ch)));
    add_mana = MIN(add_mana, 10);
    add_move = number(1, 3);
    break;
  }

--------



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_CLERIC) && IS_CLERIC(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_WARRIOR) && IS_WARRIOR(ch)) ||
      (IS_OBJ_STAT(obj, ITEM_ANTI_THIEF) && IS_THIEF(ch))
      (IS_OBJ_STAT(obj, ITEM_ANTI_BRUTE) && IS_BRUTE(ch)))
	return 1;
  else
	return 0;
}

Any help would be extremely appreciated.
TIA

Salvatore
of as-of-yet not up
GuardianMUD

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