Re: [code] help with room exits

From: Angus Mezick (angus@EDGIL.CCMAIL.COMPUSERVE.COM)
Date: 04/09/98

Don't forget to also check the actual exit.  There is a chance that the exit
exits, but goes to -1 because it is an exit desc.


______________________________ Forward Header __________________________________
Subject: Re:  [code] help with room exits
Date:    4/8/98 9:59 PM

On Wed, 8 Apr 1998, C^2 wrote:

>         I know that the function works properly, but I just can't seem to
> get right how to check to see if the target room(the room the player is
> trying to enter) has a down exit.  Things that I have tried are:
> world[(EXIT(ch, dir)->to_room)].dir_option[DOWN]->to_room != -1
> world[(EXIT(ch, dir)->to_room).dir_option[DOWN]->to_room].number != -1
> world[(world[ch->in_room].dir_option[dir]->to_room)].dir_option[DOWN]->to_room
> == -1
>         Every one of these crashes the mud as soon as a character(without
> fly) enters the room.  Flying characters work fine.  If I replace the

if (world[EXIT(ch, dir)->to_room].dir_option[DOWN] &&
    code_for_ch_not_flying) {
  send_to_char("You gotta be flying to go there.\r\n", ch);
  return 0;

If an exit does not exist.... Then it quite literally does NOT exist. It
doesn't exist as an option for movement and it doesn't exist in memory
either. That is probably why the attempt to accesss a non-existant exit
crashed the MUD.


Good luck,

John Evans <>  --

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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