Welcome to the Builder Academy

Question Can't figure out.

More
26 Jun 2012 16:28 #266 by Liko
Can't figure out. was created by Liko
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?

Randian(0.0.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

More
26 Jun 2012 16:33 #267 by Halenbane
Replied by Halenbane on topic Re: Can't figure out.
Should your undefined hairstyle be at the end in your defines? Since your first case is a hairstyle when you select it, but in defines the first define is undefined hairstyle/

Please Log in or Create an account to join the conversation.

More
26 Jun 2012 17:09 #268 by Liko
Replied by Liko on topic Re: Can't figure out.
This issue has been resolved.

I simply had to had a undefined to their pc_hair_*_types :)

Randian(0.0.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

More
26 Jun 2012 17:11 - 26 Jun 2012 17:12 #269 by Halenbane
Replied by Halenbane on topic Re: Can't figure out.
Very nice :D

You should throw up a snip, I had started on this but hadn't finished yet :D
Last edit: 26 Jun 2012 17:12 by Halenbane.

Please Log in or Create an account to join the conversation.

Time to create page: 0.193 seconds