Not sure how to make this work

Posted by Gtr on Sat 19 Jun 2004 10:06 AM — 7 posts, 22,172 views.

#0
I'm trying to use:

if ( ( obj = get_eq_char( ch, arg1 ) ) == NULL )

I'm aware thats wrong, "warning: passing arg 2 of `get_eq_char' makes integer from pointer without a cast ". told me so heh. I was wondering if anyone knew how I could get this to work correctly?
Amended on Sat 19 Jun 2004 11:43 AM by Gtr
Canada #1
Yes, the second argument, what you have as "argument" needs to be one of the defined wear locations, usually of the format "WEAR_*", like " WEAR_DUAL_WIELD", try one of those.
USA #2
Or if you are doing it with user input I think you need to make it a number, in which it would be atoi( arg1 ) or something such as that.
USA #3
It may be more complicated than a simple atoi, because you might be trying to convert e.g. "body" to WEAR_BODY - atoi("body") will return 0. I'd imagine that there already is a routine written for this (check oset wear, or something like that) but if not it's fairly straightforward to write.
#4
Basicly I'm trying to get it to check if the charecter is wearing what the argument says. I'm sure theres a simple way to go about this, thanks for helping so far, I think I'll check out do_remove. See if maby that can help.
USA #5
The function get_eq_char() is used for determining what equipment is at a particular location (represented by an integer), not if the argument is worn the player. I'd suggest looking at do_remove as you said, or the mud progs that check is_worn or something like that. In any case it should be a simple linear search over ch->first_carrying to ch->last_carrying, making sure the wearloc is not -1.
#6
Heh, I'm getting better and better at this coding thing, guess I just needed to spend a few hours not doing it. Figured out how, and thanks for the help guys.