[an error occurred while processing this directive]
[<a href="index.shtml">Package Index</a></code> | <a href="index_std.shtml">Mudlib Index</a></code> | <a href="index_eff.shtml">Effect Index</a></code>]<br><h2>File /obj/handlers/terrain_handler.c</h2>
This is the terrain handler method documentation. For a more general
introduction to the terrain handler, please see the help for terrains.
<p><b>See also:</b><br>help::terrains
.c<br /><p>Written by Sin, Turrican and others...
<h2>Inherits</h2>
This class inherits the following classes /std/object.c<h2>Includes</h2>
This class includes the following files /include/terrain.h, /include/map.h and /include/dirs.h<h2>Method index</h2>
<ul>
<li><a href="#add_fixed_location">add_fixed_location</a>(string, string, int *)<br/>
This method adds a new fixed location for a terrain.
<li><a href="#add_floating_location">add_floating_location</a>(string, string, int *, int)<br/>
This method adds a new floating location for a terrain.
<li><a href="#clear_cloned_locations">clear_cloned_locations</a>(string)<br/>
This method clears the cloned locations cache for a given terrain.
<li><a href="#clear_connections">clear_connections</a>(string)<br/>
This method clears all connections for a given terrain.
<li><a href="#delete_cloned_location">delete_cloned_location</a>(string, string)<br/>
This method deletes a cloned location for a terrain from the cache.
<li><a href="#delete_fixed_location">delete_fixed_location</a>(string, string)<br/>
This method deletes a fixed location for a terrain.
<li><a href="#delete_floating_location">delete_floating_location</a>(string, string, int *)<br/>
This method deletes a floating location for a terrain.
<li><a href="#find_location">find_location</a>(string, int *)<br/>
This method is the main entry point for the terrain handler.
<li><a href="#get_data_file">get_data_file</a>(string)<br/>
This method loads the data file for a given terrain.
<li><a href="#get_room_size">get_room_size</a>(string, int)<br/>
This method returns the room size for a given room.
<li><a href="#member_cloned_locations">member_cloned_locations</a>(int *)<br/>
This method checks wether there is a cloned location which matches the
given coordinates.
<li><a href="#member_fixed_locations">member_fixed_locations</a>(int *)<br/>
This method checks wether there is a fixed location which matches the
given coordinates.
<li><a href="#member_floating_locations">member_floating_locations</a>(int *)<br/>
This method checks wether there are floating locations which match the
given coordinates.
<li><a href="#modify_fixed_location">modify_fixed_location</a>(string, string, int *)<br/>
This method modifies an existing fixed location for a terrain.
<li><a href="#query_cloned_locations">query_cloned_locations</a>(string)<br/>
This method returns the cloned_locations mapping for a given terrain.
<li><a href="#query_co_ord">query_co_ord</a>(string, string)<br/>
This method returns the coordinates for a given terrain and fixed location
filename.
<li><a href="#query_connected">query_connected</a>(string, int *)<br/>
This method returns wether the given coordinates is connected to another
room in the terrain handler system.
<li><a href="#query_connection">query_connection</a>(string, int *, string)<br/>
This method returns the connecting room for the given coordinates and
direction.
<li><a href="#query_fixed_locations">query_fixed_locations</a>(string)<br/>
This method returns the fixed_locations mapping for the given terrain.
<li><a href="#query_floating_locations">query_floating_locations</a>(string)<br/>
This method returns the floating_locations array for the given terrain.
<li><a href="#setup_location">setup_location</a>(object, string)<br/>
This method is called when a normal room is loaded which is part of
a terrain.
<li><a href="#top_floating_location">top_floating_location</a>(int *)<br/>
This method searches the top level floating location for the given
coordinates.
</ul>
<h2>Public Functions</h2>
These are functions that everyone can access.<p>
<dl>
<dt class="autodocfuncname"><a name="add_fixed_location">
add_fixed_location</a><pre class="autodocfuncdef">
int add_fixed_location(string terrain,
                       string file,
                       int * co_ords)
</pre><dd><br />
This method adds a new fixed location for a terrain.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
file - the file name<br />
co_ords - the coordinates for the location<br />
<br />
<dd><b>Returns:</b>
<br />1 if it succeeds, 0 if it fails (wrong coordinates or location
already present)<br /><br />
<dd><b>See also:</b>
<br /><a href="#add_floating_location">add_floating_location()</a> and <a href="#modify_fixed_location">modify_fixed_location()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="add_floating_location">
add_floating_location</a><pre class="autodocfuncdef">
int add_floating_location(string terrain,
                          string file,
                          int * co_ords,
                          int level)
</pre><dd><br />
This method adds a new floating location for a terrain.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
file - the file name<br />
co_ords - the coordinates for the location (either a single coordinate
or 2 forming a bounding rectangle)<br />
level - the level of this location<br />
<br />
<dd><b>Returns:</b>
<br />1 if it succeeds, 0 if it fails (wrong coordinates or location
already present)<br /><br />
<dd><b>See also:</b>
<br /><a href="#add_fixed_location">add_fixed_location()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="clear_cloned_locations">
clear_cloned_locations</a><pre class="autodocfuncdef">
void clear_cloned_locations(string terrain)
</pre><dd><br />
This method clears the cloned locations cache for a given terrain.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
<br />
<dd><b>See also:</b>
<br /><a href="#clear_connections">clear_connections()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="clear_connections">
clear_connections</a><pre class="autodocfuncdef">
void clear_connections(string terrain)
</pre><dd><br />
This method clears all connections for a given terrain. This needs to
be done when a terrain was modified.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
<br />
<dd><b>See also:</b>
<br /><a href="#clear_cloned_locations">clear_cloned_locations()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="delete_cloned_location">
delete_cloned_location</a><pre class="autodocfuncdef">
int delete_cloned_location(string terrain,
                           string file)
</pre><dd><br />
This method deletes a cloned location for a terrain from the cache.
It is meant to be called when a cloned location is destructed.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
file - the file name<br />
<br />
<dd><b>Returns:</b>
<br />1 if it succeeds, 0 if it fails (location not present)<br /><br />
<dd><b>See also:</b>
<br /><a href="#delete_fixed_location">delete_fixed_location()</a> and <a href="#delete_floating_location">delete_floating_location()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="delete_fixed_location">
delete_fixed_location</a><pre class="autodocfuncdef">
int delete_fixed_location(string terrain,
                          string file)
</pre><dd><br />
This method deletes a fixed location for a terrain.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
file - the file name<br />
<br />
<dd><b>Returns:</b>
<br />1 if it succeeds, 0 if it fails (location not present)<br /><br />
<dd><b>See also:</b>
<br /><a href="#delete_cloned_location">delete_cloned_location()</a> and <a href="#delete_floating_location">delete_floating_location()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="delete_floating_location">
delete_floating_location</a><pre class="autodocfuncdef">
int delete_floating_location(string terrain,
                             string file,
                             int * co_ords)
</pre><dd><br />
This method deletes a floating location for a terrain.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
file - the file name<br />
co_ords - the coordinates for the location (either a single coordinate
or 2 forming a bounding rectangle)<br />
<br />
<dd><b>Returns:</b>
<br />1 if it succeeds, 0 if it fails (location not present)<br /><br />
<dd><b>See also:</b>
<br /><a href="#delete_cloned_location">delete_cloned_location()</a> and <a href="#delete_fixed_location">delete_fixed_location()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="find_location">
find_location</a><pre class="autodocfuncdef">
object find_location(string terrain,
                     int * co_ords)
</pre><dd><br />
This method is the main entry point for the terrain handler. It loads
the room that is associated with the given terrain and coordinates.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
co_ords - the coordinates to look up<br />
<br />
<dd><b>Returns:</b>
<br />the room that was found or loaded<br /><br />
<dd><b>See also:</b>
<br /><a href="#setup_location">setup_location()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="get_data_file">
get_data_file</a><pre class="autodocfuncdef">
int get_data_file(string word)
</pre><dd><br />
This method loads the data file for a given terrain.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
word - the terrain to load the data for<br />
<br />
<dd><b>Returns:</b>
<br />1 if the terrain exists, 0 if it didn't
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="get_room_size">
get_room_size</a><pre class="autodocfuncdef">
int get_room_size(string file,
                  int level)
</pre><dd><br />
This method returns the room size for a given room. It uses a cache
to speed things up.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
file - the file name of the room<br />
level - the recursion level<br />
<br />
<dd><b>Returns:</b>
<br />the size of the room
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="member_cloned_locations">
member_cloned_locations</a><pre class="autodocfuncdef">
string member_cloned_locations(int * co_ords)
</pre><dd><br />
This method checks wether there is a cloned location which matches the
given coordinates.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
co_ords - the coordinates to find the room for<br />
<br />
<dd><b>Returns:</b>
<br />the file name of the room with the given coordinates, or 0 if
it is not found<br /><br />
<dd><b>See also:</b>
<br /><a href="#member_fixed_locations">member_fixed_locations()</a> and <a href="#member_floating_locations">member_floating_locations()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="member_fixed_locations">
member_fixed_locations</a><pre class="autodocfuncdef">
string member_fixed_locations(int * co_ords)
</pre><dd><br />
This method checks wether there is a fixed location which matches the
given coordinates.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
co_ords - the coordinates to find the room for<br />
<br />
<dd><b>Returns:</b>
<br />the file name of the room with the given coordinates, or 0 if
it is not found<br /><br />
<dd><b>See also:</b>
<br /><a href="#member_cloned_locations">member_cloned_locations()</a> and <a href="#member_floating_locations">member_floating_locations()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="member_floating_locations">
member_floating_locations</a><pre class="autodocfuncdef">
mixed * member_floating_locations(int * co_ords)
</pre><dd><br />
This method checks wether there are floating locations which match the
given coordinates.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
co_ords - the coordinates to find the rooms for<br />
<br />
<dd><b>Returns:</b>
<br />an array with the file names of the rooms and the levels, or
the empty array if none are found<br /><br />
<dd><b>See also:</b>
<br /><a href="#member_cloned_locations">member_cloned_locations()</a> and <a href="#member_fixed_locations">member_fixed_locations()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="modify_fixed_location">
modify_fixed_location</a><pre class="autodocfuncdef">
int modify_fixed_location(string terrain,
                          string file,
                          int * co_ords)
</pre><dd><br />
This method modifies an existing fixed location for a terrain.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
file - the file name<br />
co_ords - the coordinates for the location<br />
<br />
<dd><b>Returns:</b>
<br />1 if it succeeds, 0 if it fails (wrong coordinates or location
not found)<br /><br />
<dd><b>See also:</b>
<br /><a href="#add_fixed_location">add_fixed_location()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_cloned_locations">
query_cloned_locations</a><pre class="autodocfuncdef">
mapping query_cloned_locations(string terrain)
</pre><dd><br />
This method returns the cloned_locations mapping for a given terrain.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
word - the terrain name<br />
<br />
<dd><b>Returns:</b>
<br />the cloned_locations mapping; keys are the file names, values are
the coordinates for the files. There are also keys on x coordinates to
facilitate faster coordinate lookups.<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_fixed_locations">query_fixed_locations()</a> and <a href="#query_floating_locations">query_floating_locations()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_co_ord">
query_co_ord</a><pre class="autodocfuncdef">
int * query_co_ord(string terrain,
                   string file)
</pre><dd><br />
This method returns the coordinates for a given terrain and fixed location
filename.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
file - the file name of the location<br />
<br />
<dd><b>Returns:</b>
<br />the coordinates
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_connected">
query_connected</a><pre class="autodocfuncdef">
int query_connected(string terrain,
                    int * co_ords)
</pre><dd><br />
This method returns wether the given coordinates is connected to another
room in the terrain handler system.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
co_ords - the coordinates<br />
<br />
<dd><b>Returns:</b>
<br />1 if it is found, 0 otherwise<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_connection">query_connection()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_connection">
query_connection</a><pre class="autodocfuncdef">
string query_connection(string terrain,
                        int * co_ords,
                        string direc)
</pre><dd><br />
This method returns the connecting room for the given coordinates and
direction.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
terrain - the terrain name<br />
co_ords - the coordinates<br />
direc - the direction to find the room for<br />
<br />
<dd><b>Returns:</b>
<br />the file name of the connecting room or 0 if none was found<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_connected">query_connected()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_fixed_locations">
query_fixed_locations</a><pre class="autodocfuncdef">
mapping query_fixed_locations(string word)
</pre><dd><br />
This method returns the fixed_locations mapping for the given terrain.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
word - the terrain name<br />
<br />
<dd><b>Returns:</b>
<br />the fixed_locations mapping; keys are the file names, values are
the coordinates for the files<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_cloned_locations">query_cloned_locations()</a> and <a href="#query_floating_locations">query_floating_locations()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_floating_locations">
query_floating_locations</a><pre class="autodocfuncdef">
mixed * query_floating_locations(string word)
</pre><dd><br />
This method returns the floating_locations array for the given terrain.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
word - the terrain name<br />
<br />
<dd><b>Returns:</b>
<br />the floating_locations array; this is an array of arrays where each
array consists of the file name, an array of 6 coordinates forming a
bounding box or normal coordinates for the location and the level of the
floating location<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_cloned_locations">query_cloned_locations()</a> and <a href="#query_fixed_locations">query_fixed_locations()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="setup_location">
setup_location</a><pre class="autodocfuncdef">
void setup_location(object place,
                    string terrain)
</pre><dd><br />
This method is called when a normal room is loaded which is part of
a terrain. The terrain handler needs to know about this to be able
to calculate the exits into the floating portion of the terrain.
It also sets the coordinates of the room to the values as saved in the
terrain.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
place - the room object which is a fixed location in the terrain<br />
terrain - the terrain name<br />
<br />
<dd><b>See also:</b>
<br /><a href="#find_location">find_location()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="top_floating_location">
top_floating_location</a><pre class="autodocfuncdef">
string top_floating_location(int * co_ords)
</pre><dd><br />
This method searches the top level floating location for the given
coordinates.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
co_ords - the coordinates to find the top level for<br />
<br />
<dd><b>Returns:</b>
<br />the file name of the top level room with the given coordinates,
or 0 if none was found<br /><br />
<dd><b>See also:</b>
<br /><a href="#member_floating_locations">member_floating_locations()
</a><br /><br /><br /></dl>

</dl>
[an error occurred while processing this directive]

