Re: A 'home' made bug...

From: Steve (quickey@cyberverse.com)
Date: 04/16/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;
this makes d a pointer to the first person on descriptor_list (the most 
recent one logged in, I dont think you want to do this, because most 
likely ch != d->character


>  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);
you haven't set victim to anything yet, this is definatly a NULL pointer
this too is bad

>   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);
>        }
> }


you may want to rewrite it like this:
NOTE:
on *>MY<* mud GET_LOADROOM() is the vnum of the room, not sure if this is 
how it is in stock circle code (if it isn't you'll have to change this a bit)

/* sends a char back to his house (which is specified by his loadroom */
ACMD(do_home)
{
  if(GET_LOADROOM(ch) == 3005)
    send_to_char("You don't have a house!\r\n", ch);
  else {
   act("$n runs home!", TRUE, ch, 0, 0, TO_ROOM);
   char_from_room(ch);
   char_to_room(ch, real_room(GET_LOADROOM(ch)));
   act("$n is glade to be home!", TRUE, ch, 0, 0, TO_ROOM);
   look_at_room(ch, 0);
  }
  return;
}



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