Re: A 'home' made bug...

From: Rasmus R\xnlev (raro94ab@hp4.econ.cbs.dk)
Date: 04/17/96


On Tue, 16 Apr 1996, corey hoitsma wrote:

> ACMD(do_home)
> {
>   struct descriptor_data *d;
>   sh_int load_room;
>   struct char_data *victim;
>   d = descriptor_list;
>  
>  if (GET_LOADROOM(d->character) == 3005) {
>     send_to_char("You don't have a house!", ch);
>     return;
> } else {
>   act("$n runs home!", TRUE, ch, 0, 0, TO_ROOM);
>   char_from_room(victim);
>   char_to_room(victim, GET_LOADROOM(d->character));
>   act("$n is glade to be home!", TRUE, ch, 0, 0, TO_ROOM);
>   look_at_room(victim, 0);
>        }
> }

Well, to say the least you're f*cking arond seriously with pointers to a 
various number of TOTALY DIFFERENT persons.. *grin*

d = descriptor_list is the FIST character in a linked list containing all 
the currently connected players on the mud, this could be the character 
that used the ACMD, but it could just as well be the implementor who's
in the OLC ... (well, hope I made it understandable :)

to have d mean something you should do this:

d = ch->desc; /* Assigns the descriptor_data pointer of ch to d */

this way d->character makes sense.. BUT, d->character is the same as ch ...
so just use GET_LOADROOM(ch), then you don't need the descriptor_data 
pointer at all... 

Now... the part where you seem to crash the mud would be arround the:

char_from_room(victim);
char_to_room(victim.....);
look_at_room(victim, 0);

As far as I can see the victim structure hasn't been initialized to point 
to any victim.. *grin*. What you do is to set up a pointer to a structure 
of the type char_data called victim... Now to use it you need to assign 
victim to point to a valid char_data structure.
But, what you actually shoudl do is to replace the victim stuff in those 
3 lines with ch ... that simple... as it's the ch you want to move, as 
far as I'm understanding the code right... 

When you've changed that it might work propperly... 


Hope it helps..
Con

d.
--
***************************************************************************
*                            *    Visit my homepage:                      *
*   Rasmus Rønlev DOEK'94    *    http://www.econ.cbs.dk/people/raro94ab  *
*   Student instructor       *    Visit my Multi User Dungeon (MUD):      *
*                            *    ns3.ptd.net 5000 or 198.80.46.3 5000    *   
***************************************************************************
*                                                                         *
*      Student, B.Sc in Computer Science and Business Administration      *
*                                                                         *
***************************************************************************



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