Re: [CODE] [QUESTION] Stables

From: ;P (siv@CYBERENET.NET)
Date: 02/24/98


> I have a problem with my stable spec_proc. I can manage to rent my mount,
> but when I wish to retrieve it, the MUD crashes.
> Can anyone look through the code I attach to this mail and help me out?

>       return 0;

urm..first of all..shouldn't all of these "return 0"'s be "return 1"'s?
return 1 means that a spec_proc was found, and that the command shouldn't
be run through the normal command list..

>     vnum = GET_MOB_VNUM(horse);
>     GET_MOUNT(ch) = vnum;

ok..get_mount is an integer..equal to the mount's virtual number..right?

>     horse = GET_MOUNT(ch);
>     mount = read_mobile(horse, VIRTUAL);

here you are trying to assign the value of get_mount (integer) to the
variable horse (struct char_data *)..that will crash you..i'm sure you get
a compilation warning saying "blah blah makes integer from pointer without
a cast" or something..try:

vnum = GET_MOUNT(ch);
mount = read_mobile(vnum, VIRTUAL);

or cut out a step and just do:

mount = read_mobile(GET_MOUNT(ch), VIRTUAL);

siv


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST