|
CHAPTER 1
Dynamic Exits:
This is one of the most powerful features of room2. To be able to use it
you have to define EXTD_ROOM and DYNAMIC_EXITS before the include
<room2.h> line.
Kiri says in 2016: I think we could make a light-weight solution without
EXTD_ROOM. But you would have to overwrite the original move function of
the room to control if the direction is active at the moment e.g. if the
sewer cover is open or closed. On the other hand this would avoid to move
all (living) objects in the room "around" to get the init called again.
With dynamic exits you can add, remove and change the exits of your
room dynamically.
add_exit(dest, dir) adds a new exit with destination dest in
direction dir.
remove_exit(dir) removes the exit in direction dir.
change_exit_dir(dest, dir) changes the direction in destination dest.
change_exit_room(dest, dir) changes the destination in direction dir.
These functions can be called from anywhere in your program. Remember
that you might have to change your code if you have a function long(str)
or init() defined and you are converting to EXTD_ROOM.
Also make sure to reset your exits if reset(1) is called. The easiest way
to achieve this is to call set_exits not after the if (arg) return; line,
but before it.
Modified by Kiri in August 2016.
See also: |
|