*** Rooms and regions ***

Rooms and regions are both set up in similar ways. Every room and every region
has its own function which is stored as a function pointer in a fixed 
structure array whose size is fixed at compile time. Having dynamically 
assigned rooms and regions in the same ways as objects would be possible but
there is very little to gain from it since rooms don't usually die or get
cloned :). The macros NUM_ROOMS and NUM_REGIONS are both stored in defs.h
and MUST BE UPDATED when you add new rooms or your compiler will give an 
error.

* Regions *

The region structure is the simplist as it simply consists of a function 
pointer. I was going to add other elements to this hence I did not simply
use an array, but in the end after experimenting the extra bits turned out to 
be less usefull than I thought they'd be. Anyway, to save a lot of code 
rewriting I've left this as a structure.

extern struct region_data {
     int (*func)();
     } region[NUM_REGIONS];

The structure is set up in regions.c like so:

struct region_data region[NUM_REGIONS]=
{
island_reg1,
island_reg2
};

Each region function has the following header: 

function_name(user,com)
OBJECT user;
int com;

Com is the command number. It takes one of 2 values: 2 means attempt to deal
with the user command entered on the command line (called for any user in
the region) and 3 means run any events eg weather etc...
The values 2 & 3 are used since this matches the values passed to the room
functions for the same operations. 

* Rooms *

The room structure is far more complex than the region structure. It is
defined as follows:

extern struct room_data {
     int (*func)();
     int region;  
     int money; 
     int start_money; 
     int always_lit; 
     int lit; 
     } room[NUM_ROOMS];

func - Stores the rooms function pointer.
region - The region the room is in.
money - Amount of money in the room.
start_money - Money at boot up, needed when mud is reset.
always_lit - If 0 then room is dark unless a lit object is in it. If 1 then
             room is lit all the time, ie is an outside room.
lit - Is room currently lit. If always_lit is 1 then this will always be 1.

The structure is set up in rooms.c like so:

struct room_data room[NUM_ROOMS]=
{
isle1_0,0,0,0,1,1,
isle1_1,0,0,0,1,1,
isle1_2,0,0,0,1,1,
......

The structure can have a NULL entry in it for the room function. In this case
this room is ignored by the server and no object can be cloned or moved into
it. It a facility for you to leave space in the structure at certain positions
for rooms to be added later. Room 35 in the distribution mudlib is null. A 
rooms number is its position in the structure. eg start_0 is room number 0.


Each room function has the following header:

function_name(user,com,dir)
OBJECT user;
int com,dir;

Com as with regions is the command number. Its values have the following 
meanings:

0 - Write the room description and contents to the user. Called in look().
1 - Return the adjacent room in direction dir. If there is no next room in that
    direction -1 or -2 is returned. If -1 then the server prints an error
    message , if -2 the server stays silent so the room can print its own
    message. Called in loads of functions.
2 - Attempt to execute user commands entered on command line and found in
    the word[] array. Called in exec_com().
3 - Run room events. Called in rooms_events().

In the function there is defined an integer array call "links" though it 
could have a different name. This contains 12 links for the directions
north,south,east,west,northeast,southeast,southwest,northwest,up,down,in,out
in that order. If the value is -1 then there is no link or way out of the
room in that direction else the number means the room that is next in the
given direction. eg

int links[]={ 10,-1,3,-1,-1,-1,-1,-1,15,-1,-1,-1 };

This means that from this room , room 10 is north , room 3 is east and room 15
is up.

Doors are not built into the server since they are used in very few rooms and
are easy to implement in the code for individual rooms anyway. This approach
allows more flexibility too. All you need is a global flag variable to signal 
whether a door is open or shut then the 2 rooms either side of the door just 
access it. See the mudlib for an example where there is a door leading into 
the hut.
   Also in the mudlib (in room 26) is an example of how to have a direction
other than the 12 built in (ie north, south etc). It is a simple case of 
mapping a word onto a direction though this is not the only way to do it.

