I can't seem to figure out this strange bug. I programmed in hair styles and colour. It compiles fine and stuff, but when you select the hair style and color it doesn't give you the one you pick.
Code:
"(*)--------------------------(*)\r\n"
" | Hairstyle Selection |\r\n"
"(*)--------------------------(*)\r\n"
" | A) I have long hair. |\r\n"
" | B) I have short hair. |\r\n"
" | C) I have medium hair. |\r\n"
" | D) I have a buzz cut. |\r\n"
" | E) I have a high and tight |\r\n"
" | F) I have long wavy hair. |\r\n"
" | G) I have medium wavy hair.|\r\n"
"(*)--------------------------(*)\r\n";
Let's say you picked long hair, it would give you short hair instead. If you picked long wavy hair, it would give you medium wavy have instead. You get my drift?
Here is the parse_hairstyle code.
Code:
int parse_hairstyle(char arg)
{
arg = LOWER(arg);
switch(arg) {
case 'a': return HAIRSTYLE_LONG;
case 'b': return HAIRSTYLE_SHORT;
case 'c': return HAIRSTYLE_MEDIUM;
case 'd': return HAIRSTYLE_BUZZ_CUT;
case 'e': return HAIRSTYLE_HIGH_AND_TIGHT;
case 'f': return HAIRSTYLE_LONG_WAVY;
case 'g': return HAIRSTYLE_MEDIUM_WAVY;
default: return HAIRSTYLE_UNDEFINED;
}
}
Here is CON_QHAIRSTYLE in interpreter.c
Code:
case CON_QHAIRSTYLE:
load_result = parse_hairstyle(*arg);
if (load_result == HAIRSTYLE_UNDEFINED) {
write_to_output(d, "\r\nThat's not a hairstyle.\r\nHairstyle: ");
return;
} else
GET_HAIRSTYLE(d->character) = load_result;
write_to_output(d, "%s\r\nHair Color: ", hair_color_menu);
STATE(d) = CON_QHAIRCOLOR;
break;
Here are the defines in structs.h
Code:
#define HAIRSTYLE_UNDEFINED 0 /* Hairstyle Undefined */
#define HAIRSTYLE_LONG 1 /* Hairstyle Long*/
#define HAIRSTYLE_SHORT 2 /* Hairstyle Short*/
#define HAIRSTYLE_MEDIUM 3 /* Hairstyle Medium */
#define HAIRSTYLE_BUZZ_CUT 4 /* Hairstyle Buzz Cut*/
#define HAIRSTYLE_HIGH_AND_TIGHT 5 /* Hairstyle High and Tight */
#define HAIRSTYLE_LONG_WAVY 6 /* Hairstyle Long Wavy*/
#define HAIRSTYLE_MEDIUM_WAVY 7 /* Hairstyle Medium Wavy*/
#define NUM_HAIRSTYLE 8 /* Total Number of hairstyles*/
char_player_data:
byte hairstyle; /* PC/NPC Hairstyle*/
Can you see anything wrong or am I just over looking something?