Re: [code] help with room exits

From: John Evans (evansj@HI-LINE.NET)
Date: 04/08/98

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.

If you are using OasisOLC, load up redit.c and search for where the exit
is purged. You'll find something like so:

  /* delete exit */
  if (OLC_EXIT(d)->keyword)
  if (OLC_EXIT(d)->general_description)

This shows that when an exit is nuked, the memory that was allocated to it
is also removed. If you find the code for creating a whole new exit,
you'll find the opposite there. :)

Good luck,

John Evans <>  --

Any sufficiently advanced technology is indistinguishable from magic.
--Arthur C. Clarke

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

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