Re: [CODE]Race Help

From: bruce (
Date: 07/26/00

Steven Newsom wrote:
> Is there a way to aloow multi-character character constants in bpl14????
> (ex.  At race menu type DE would give you dark Elf  race- [D]ark [E]lf)
> Ive tried to do it but it will only recognize the first letter type, so
> instead of giving Dark Elf it will just give it Dwarf([D]warf).

i don't know how your races are set up, but it's just a matter of
altering the function that parses the input.

assuming you've defined races as:
#define RACE_HUMAN      0
#define RACE_DWARF      1
#define RACE_DARKELF    2
#define NUM_RACES       3

i'd do it something like this: (mailer code)

const char *race_codes[] = {
  "h",  //human
  "d",  //dwarf
  "de", //dark elf

int parse_race(char *arg) {
  int i;
  for (i = 0;i < NUM_RACES;i++) if (!strcasecmp(race_codes[i], arg))
return i;
  return RACE_HUMAN;
  01100010  01110010  01110101  01100011  01100101
 **   Phone: +61 414 790173 **

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

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