Welcome to the Builder Academy

Question Having problems with a error given during compile

More
17 Dec 2012 17:34 - 22 Dec 2012 03:10 #1194 by dfeigel71
I have been working to add classes and races to my mud. Everything has gone ok for the most part, but now I am trying to define what race is allowed to be what class. In doing so, I have received the following error:

class.c: In function find_class_bitvector:
class.c:145: warning: passing argument 1 of parse_class makes pointer from integer without a cast
class.c:145: error: too few arguments to function âparse_classâ

I am still learning to code, and overall it is moving along, but after looking at this problem for hours and being unable to figure it out I figured maybe someone can point me in the right direction. The following is a copy of the basic code I am trying to implement. If someone can look it over and maybe point out where the problem is and what I am doing wrong it would be greatly appreciated.

Thank you,

Dustin
Code:
int parse_class(struct char_data *ch, char arg) { arg = LOWER(arg); switch (arg) { case 'a': if (GET_RACE(ch) == RACE_DWARF || (GET_RACE(ch) == RACE_HUMAN)) { return CLASS_BARBARIAN; } else { return CLASS_UNDEFINED; } break; case 'b': if (GET_RACE(ch) == RACE_HUMAN || (GET_RACE(ch) == RACE_HALF_ELF)) { return CLASS_KNIGHT; } else { return CLASS_UNDEFINED; } break; case 'c': if (GET_RACE(ch) == RACE_DWARF || (GET_RACE(ch) == RACE_ELF)) { return CLASS_PALADIN; } else { return CLASS_UNDEFINED; } break; case 'd': if (GET_RACE(ch) == RACE_GNOME || (GET_RACE(ch) == RACE_TROLL)) { return CLASS_ROUGE; } else { return CLASS_UNDEFINED; } case 'e': if (GET_RACE(ch) == RACE_GNOME || (GET_RACE(ch) == RACE_HUMAN)) { return CLASS_WARLOCK; } else { return CLASS_UNDEFINED; } default: return CLASS_UNDEFINED; } }
Last edit: 22 Dec 2012 03:10 by Vatiken. Reason: Code tags

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

More
18 Dec 2012 14:28 #1195 by zusuk
i'm guessing, but try this: do a search for all instances of parse_class in your code, and make sure the function call matches your function definition you posted

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

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

More
19 Dec 2012 18:26 #1198 by dfeigel71
I have checked the other places where parse_class is located. I made sure that class.h matches the function in class.c. both being,

int parse_class(struct char_data *ch, char arg)


but the problem is in act.wizard.c where the function to set class is located. I am unsure how to re-write this part to work with my changes and get ever thing to compile.

act.wizard.c: if ((i = parse_class(*val_arg)) == CLASS_UNDEFINED) {

any suggestions as to how to handle the parse_class(*val_arg) in act.wizard.c?

I think if a proper way to handle this is set, then everything may compile and work correctly.

Thanks,

Dustin

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

More
19 Dec 2012 21:09 #1200 by thomas
You're calling it with just the "char" argument (the entered text).

Try passing the character struct as well:

if ((i = parse_class(d->character, *val_arg)) == CLASS_UNDEFINED) {

or

if ((i = parse_class(ch, *val_arg)) == CLASS_UNDEFINED) {

depending on whether you have a char_data *ch or a descriptor_data *d in that function.

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

More
21 Dec 2012 20:15 #1205 by Liko
My Races snippet is a great reference point for adding classes/races.

tbamud.com/downloads/viewdownload/5-snippets/77-races

Randian(0.0.0)
Owner/Developer

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

Time to create page: 0.197 seconds