[CODE] Can't figure out my bug

From: Rick Glover (magik@PYRAMID.NET)
Date: 05/03/98


I've been having a problem with a certain part of my code and I'm hoping
that someone could help me out.  I'm trying to simply access do_help in
interpreter.c to show help on a class that the user selects.  This is in
the character generation process of nanny.




Nanny's header:

void nanny(struct descriptor_data *d, char *arg)
{
  char buf[MAX_STRING_LENGTH];
  int player_i, load_result;
  char tmp_name[MAX_INPUT_LENGTH];
  struct char_file_u tmp_store;
  extern sh_int r_mortal_start_room;
  extern sh_int r_immort_start_room;
  extern sh_int r_frozen_start_room;
  extern const char *race_menu;
  extern const int *class_params[NUM_RACES][17];
  extern const char *pc_race_types[];
  extern const char *pc_class_types[];
  extern int max_bad_pws;
  sh_int load_room;
  extern char *GREETINGS;
  char titlescreen[LARGE_BUFSIZE]; /* or whatever size is appropriate */

  int load_char(char *name, struct char_file_u *char_element);
  int parse_class(char arg);
  int parse_race(char arg);
  int term, clvl;

Nanny's help call that is giving me an error of:
   warning: passing arg 2 of `do_help' makes pointer from integer without a
cast

    SEND_TO_Q("\r\nEnter the capital letter of the race you would like more
information on.\r\nr\nPlease choose a race: ", d);
    STATE(d) = CON_QRACE;
    break;

  case CON_QRACE:
    load_result = parse_race(*arg);
    if ((IS_UPPER(*arg)) && (load_result != RACE_UNDEFINED)) {
      do_help(d->character, *pc_race_types[(int)load_result], 0, 0);
      echo_on(d);
      SEND_TO_Q("\r\nPlease choose a race: ", d);
      return;
    }

Relevant functions and macros:

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

  switch (arg) {
  case 'a':
    return RACE_HUMAN;
    break;
  case 'b':
    return RACE_MTNDWARF;
    break;
  case 'c':
    return RACE_MOONELF;
    break;
  case 'd':
    return RACE_GNOME;
    break;
  case 'e':
    return RACE_HALFELF;
    break;
  case 'f':
    return RACE_HALFLING;
    break;
  default:
    return RACE_UNDEFINED;
    break;
  }
}

#define IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z')
#define RACE_UNDEFINED   -1
#define RACE_HUMAN        0
#define RACE_MTNDWARF     1
#define RACE_MOONELF      2
#define RACE_GNOME        3
#define RACE_HALFELF      4
#define RACE_HALFLING     5

const char *pc_race_types[] = {
  "Human",
  "Mountain Dwarf",
  "Moon Elf",
  "Gnome",
  "Half-elf",
  "Halfling",
  "\n"
};

Think that does it.  Thanks for any comments or suggestions.

Magik


     +------------------------------------------------------------+
     | 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/15/00 PST