[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/map.c

This contains information about all the rooms in the mud. It is used by things like the route handler to determine routes between two locations.

As coded by Wodan and overhauled by Olorin and overhauled again by Wodan. and rewritten by Olorin The thing is somehow improving though :)

Written by Wodan

Change history

Inherits

This class inherits the following classes /obj/handlers/inherit/distance_handler.c

Includes

This class includes the following files /include/map_handler.h, /include/terrain_map.h, /include/runtime_config.h, /include/room.h and /include/config.h

Class Index

Method index

Public Functions

These are functions that everyone can access.

all_qdes_cb
void all_qdes_cb(string * exits,
                 string room,
                 function func)
all_query_destination_cb
void all_query_destination_cb(string * exits,
                              string room,
                              function func)
change_changetimes
void change_changetimes(string dir,
                        string room,
                        int time)

This method changes the current change time for the room in the dirctory.

Parameters:
dir - the directory to change the room in
room - the room to change
time - the new change time for the room

See also:
query_changetimes()


change_clusters
void change_clusters(string dir,
                     string room,
                     int cluster)

This method change sthe current cluster for the given room.

Parameters:
dir - the directory in which to change the room
room - the room to change the cluster in
cluster - the new value for the cluster of the room

See also:
quert_clusters()


change_co_ords
void change_co_ords(string dir,
                    string room,
                    int * coord)

This method changes the coordinates of the room.

Parameters:
dir - the directory to change the coordinates in
room - the room to change the coordinates for
coord - the new coordinates for the room


change_map
void change_map(string dir,
                string room,
                string * dd)

This method changes the current values of the map values for the specified room.

Parameters:
dir - the directory to change the values in
room - the room to change the directory for
dd - the array containing the direction, destination pairs

See also:
query_map()


change_movezones
void change_movezones(string dir,
                      string room,
                      string * zones)

This method changes the value of the move zones for the specified room and directory.

Parameters:
dir - the directory to change the values in
room - the room the change the values in
zones - the new set of move zones

See also:
query_movezones()


change_shorts
void change_shorts(string dir,
                   string room,
                   string sh)

This method changes the short description for the room and directory.

Parameters:
dir - the directory to change the short in
room - the room to change the short in
sh - the short description for the room

See also:
query_shorts()


change_sizes
void change_sizes(string dir,
                  string room,
                  int * size)

This method changes the currently stored sizes for the room

Parameters:
dir - the direct to change the size in
room - the room to change the size in
size - the new size for the room

See also:
query_sizes()


check_map
void check_map(string room)
check_save_files
void check_save_files()

This method checks the save files in the directory to check to make sure all the rooms still exist in the game.
clear_cache
void clear_cache()

This method completely clears the cache of all information. This method is used for debugging purposes.

See also:
update_cache()


compare_arrays
int compare_arrays(mixed * ar1,
                   mixed * ar2)

This method compares too arrays to see if they are the same.

Parameters:
ar1 - the first array to compare
ar2 - the second array to compare

Returns:
1 if they are not the same, 0 if they are


del
void del(string dir,
         string room)

This method deletes a room from the specified directory.

Parameters:
dir - the directory to delete the room from
room - the room to delete


do_room
void do_room(string room)

This method will decide if room should be checked, using the checks that can be done without loading the room, queue the check of this room. The callout is to alleviate a problem of too deep recursion errors eg. when the room to be checked it loaded because of a command like drag This functions should NOT be private, since it's the fundamental interface toorooms.

Parameters:
room - the room to check

See also:
queue_room()


finish_all_query_destination
void finish_all_query_destination(string * exits,
                                  function func,
                                  string * dest_dir)
finish_dest_dir
void finish_dest_dir(string room,
                     function func,
                     int result,
                     mapping * rows)
finish_dest_dir2
void finish_dest_dir2(string room,
                      function func,
                      int result,
                      mapping * rows)
finish_qdir
void finish_qdir(string room,
                 function func,
                 string * qddir)
finish_query_destination
void finish_query_destination(string exit,
                              function func,
                              string * dest_dir)
map_streets
string map_streets(object player,
                   string start,
                   int visibility,
                   int max,
                   int written)

This method returns the map from the start location and using the specified visibility.

Parameters:
player - the player doing the look
start - the start location
visibility - how far you can see

Returns:
the map string


qdd_cb
void qdd_cb(string room,
            function func)
qdes_cb
void qdes_cb(string exit,
             string room,
             function func)
qdir_cb
void qdir_cb(string room,
             function func)
query_cache
string * query_cache()

This method returns the current cache stores in the map handler.

Returns:
the list of directories currently loaded

See also:
update_cache() and clear_cache()


query_changetimes
mapping query_changetimes(string dir)

This method returns all the change times for the specified directory. The change times are the time at which the file was last changed. This method returns a mapping, the key of the mapping is the room and the index of the mapping is the time at which it changed (an integer).

Parameters:
dir - the directory to return the change times for

Returns:
the change times mapping

See also:
change_changetimes()


query_cluster
int query_cluster(string room)

This method returns the cluster number for the specified room.

Parameters:
room - the room to find the cluster for

Returns:
the cluster number for the room

See also:
set_cluster()


query_clusters
mapping query_clusters(string dir)

This method returns the current clusters for the specified dir. The returned mapping has keys of the room and the values are the cluster number.

Parameters:
dir - the directory to return the clusters for

Returns:
the clusters mapping

See also:
change_clusters()


query_co_ord
int * query_co_ord(string room)

This method returns the coordinates for the specified room. This will cause the room to load if possible to extract the coordinates.

Parameters:
room - the room the get the coordinates of

Returns:
the coordinates of the room, 0 on failure


query_co_ords
mapping query_co_ords(string dir)

This method returns the coordinates for the specified directory. The mapping containers keys of the room and the values are the coordinates of the room.

Parameters:
dir - the directory to return the coordinates for

Returns:
the coordinates mapping

See also:
change_co_ords()


query_dest_dir
string * query_dest_dir(string room)

This method returns the destination directory array for the specified room. This is equivilant to the method of the same name on /std/room.c Returns an array of ({ direction, destination, ... })

Parameters:
room - the room to return the destination direction array for

Returns:
an array of direction, destination pairs

See also:
/std/room->query_dest_dir() and query_destination()


query_dest_dir_cb
void query_dest_dir_cb(string room,
                       function func)
query_dest_dir_with_flags
string * query_dest_dir_with_flags(string room)

This method returns the destination directory array for the specified room. This is equivilant to the method of the same name on /std/room.c Returns an array of ({ direction, destination, ... })

Parameters:
room - the room to return the destination direction array for

Returns:
an array of direction, destination pairs

See also:
/std/room->query_dest_dir() and query_destination()


query_dest_dir_with_flags_map
mixed * query_dest_dir_with_flags_map(string path)
query_destination
string query_destination(string exit,
                         string room)

This method returns the destination associated with the exit in the room.

Parameters:
exit - the exit in the room to check
room - the room in which to check for the exit

Returns:
the destination for the exit

See also:
query_dest_dir()


query_destination_cb
void query_destination_cb(string exit,
                          string room,
                          function func)
query_known
int query_known(string room)

This method returns true if the room is known of to the map handler.

Parameters:
room - the room to test for existance

Returns:
1 if it exists, 0 if it does not


query_map
mapping query_map(string dir)

This method attempts to return the map for the current directory. This returns a mapping which contains an index being the room and the indicies are direction, destination pairs.
([
   file : ({
             direction1,
             destination1,
             ...
           }),
 ])


Parameters:
dir - the directory to load the information for

Returns:
the directions mapping

See also:
update_cache() and change_map()


query_movezones
mapping query_movezones(string dir)

This method returns all the move zones for the specified directory. This method returns a mapping whose keys are the rooms and the values are the movezones for that room.

Parameters:
dir - the directory to return the move zones for

Returns:
the movezones mapping

See also:
change_movezones()


query_queue
string * query_queue()

This method returns the current quere stores in the map handler. The queue is a list of rooms waiting to be processed into the map handler.

Returns:
the current queue


query_room_size
int * query_room_size(string room)

This method returns the size of the room, it will attempt to load the room if it is not in map handlers current rooms.

Parameters:
room - the room to find the size of


query_short
string query_short(string room)

This method returns the short description of the room. This will return the short description of named cloned objects as well as attempting to force the room to load if it is not found in the internal cache.

Parameters:
room - the room to return the short description of


query_shorts
mapping query_shorts(string dir)

This method will return all the shorts for the specified directory. The mapping returned has keys of the room names and values of the short description of the room.

Parameters:
dir - the directory to return the shorts for

Returns:
the shorts descriptions mapping

See also:
change_shorts()


query_sizes
mapping query_sizes(string dir)

This method will return the sizes for all the rooms in the directory.

Parameters:
dir - the directory to return the sizes mapping for

Returns:
the sizes mapping

See also:
change_sizes()


query_zones
string * query_zones(string room)

This method returns the move zones for the specified room. It will load the room if it is not available in the map handlers cache.

Parameters:
room - the room to get the zones for

Returns:
the array of move zones for the room

See also:
query_short()


queue_room
varargs void queue_room(string room,
                        int force,
                        string reason)

This method will queue the room without doing any tests. This should only be used by people who know what they are doing as it bypasses several checks.

Parameters:
room - the room to queue
force - if it is forced to queue
reason - the reason it was queued


set_cluster
void set_cluster(string room,
                 int cluster)

This method sets the cluster number for the specified room.

Parameters:
room - the room to set the cluster number for
cluster - the new cluster number

See also:
query_cluster()


set_co_ord
void set_co_ord(string room,
                int * coord)

This method sets the coordinates for the specified room.

Parameters:
room - the room to set the coordinates for
coord - the coordinates to set the room to

See also:
query_co_ord()


set_stopped
void set_stopped(int s)

This method sets the stopped attribute of the map handler. If the stopped attribute is non-zero then the map handler will stop processing the currently queued rooms.

Parameters:
s - the new value of the stopped flag


static_query_co_ord
int * static_query_co_ord(string room)

This method will return the coordinates of the room only using the internal map information.

Parameters:
room - the room to get the coordinates of

Returns:
the coordinates of the room, 0 on failure


static_query_short
string static_query_short(string room)

This method returns the short description of the room only from within the map handlers files. This will not cause the room to load and will not work on cloned file names.

Parameters:
room - the room to return the short description of

See also:
query_short()


test_room
int test_room(string room)

This method tests to see if the specified room exists and is loadable.

Parameters:
room - the room to test for existance

Returns:
1 if it exists and 0 if it does not


Protected Functions

These are functions that only objects inheriting the class can access.

update_cache
void update_cache(string directory,
                  int load)

This method goes through the cahce on the directory and removes all the current references to the directory. If the load parameter is non-zero then the directory is forced to be reloaded even if it already exists. If this parameter is not set then the directory will only be loaded if it is not already in the cache.

This method uses the functions in the map helper to set the values in all the internal variables. It also swaps the specified directory onto the end of the cache list, so it will be removed later.

Parameters:
directory - the directory to update
load - should we force this to reload

See also:
clear_cache() and /obj/handlers/map_helper.c


Classes

These are nice data types for dealing with... Data!