common/object.c File Reference

#include <global.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <skillist.h>
#include <loader.h>
#include <sproto.h>

Go to the source code of this file.

Defines

#define NUM_MATERIALS_REAL   NROFMATERIALS * NROFMATERIALS_REAL + 1

Functions

static void sub_weight (object *op, sint32 weight)
static void remove_ob_inv (object *op)
static void add_weight (object *op, sint32 weight)
void init_materials ()
void mark_object_removed (object *ob)
void object_gc ()
static int compare_ob_value_lists_one (const object *wants, const object *has)
static int compare_ob_value_lists (const object *ob1, const object *ob2)
int CAN_MERGE (object *ob1, object *ob2)
objectmerge_ob (object *op, object *top)
signed long sum_weight (object *op)
objectis_player_inv (object *op)
void dump_object (object *op, StringBuffer *sb)
void free_all_object_data ()
objectget_owner (object *op)
void clear_owner (object *op)
static void set_owner_simple (object *op, object *owner)
static void set_skill_pointers (object *op, object *chosen_skill, object *exp_obj)
void set_owner (object *op, object *owner)
void copy_owner (object *op, object *clone)
void initialize_object (object *op)
void copy_object (object *op2, object *op)
void copy_object_data (object *op2, object *op)
objectget_object ()
void update_turn_face (object *op)
void update_ob_speed (object *op)
void update_object (object *op, int action)
void drop_ob_inv (object *ob)
void destroy_object (object *ob)
void destruct_ob (object *op)
void remove_ob (object *op)
objectinsert_ob_in_map (object *op, mapstruct *m, object *originator, int flag)
void replace_insert_ob_in_map (char *arch_string, object *op)
objectget_split_ob (object *orig_ob, int nr, char *err, size_t size)
objectdecrease_ob_nr (object *op, uint32 i)
objectinsert_ob_in_ob (object *op, object *where)
int check_walk_on (object *op, object *originator, int flags)
int check_walk_off (object *op, object *originator, int flags)
objectpresent_arch (archetype *at, mapstruct *m, int x, int y)
objectpresent (uint8 type, mapstruct *m, int x, int y)
objectpresent_in_ob (uint8 type, object *op)
objectpresent_arch_in_ob (archetype *at, object *op)
int find_free_spot (archetype *at, object *op, mapstruct *m, int x, int y, int start, int stop)
int find_first_free_spot (archetype *at, object *op, mapstruct *m, int x, int y)
int find_first_free_spot2 (archetype *at, mapstruct *m, int x, int y, int start, int range)
static void permute (int *arr, int begin, int end)
void get_search_arr (int *search_arr)
int find_dir (mapstruct *m, int x, int y, object *exclude)
int find_dir_2 (int x, int y)
int absdir (int d)
int dirdiff (int dir1, int dir2)
int get_dir_to_target (object *op, object *target, rv_vector *range_vector)
int can_pick (object *who, object *item)
objectobject_create_clone (object *asrc)
int was_destroyed (object *op, tag_t old_tag)
objectload_object_str (char *obstr)
int auto_apply (object *op)
int can_see_monsterP (mapstruct *m, int x, int y, int dir)
void free_key_values (object *op)
key_valueobject_get_key_link (const object *ob, const char *key)
const char * object_get_value (const object *op, const char *const key)
static int object_set_value_s (object *op, const char *canonical_key, const char *value, int add_key)
int object_set_value (object *op, const char *key, const char *value, int add_key)
void init_object_initializers ()

Variables

struct mempool_chunkremoved_objects
objectactive_objects
static int static_walk_semaphore = 0
object void_container
static const int reduction_dir [SIZEOFFREE][3]
materialtype material [NROFMATERIALS]
material_real_struct material_real [NUM_MATERIALS_REAL]
int freearr_x [SIZEOFFREE]
int freearr_y [SIZEOFFREE]
int maxfree [SIZEOFFREE]
int freedir [SIZEOFFREE]

Detailed Description

Object related code.

Definition in file object.c.


Function Documentation

int absdir ( int  d  ) 

Computes an absolute direction.

Parameters:
d Direction to convert.
Returns:
Number between 1 and 8, which represent the "absolute" direction of a number (it actually takes care of "overflow" in previous calculations of a direction).

Definition at line 3074 of file object.c.

static void add_weight ( object op,
sint32  weight 
) [static]

Adds the specified weight to an object, and also updates how much the environment(s) is/are carrying.

Parameters:
op The object
weight The weight to add

Definition at line 578 of file object.c.

int auto_apply ( object op  ) 

Process object with FLAG_AUTO_APPLY.

Basically creates treasure for objects like shop floors and treasures.

Parameters:
op The object to process.
Returns:
1 if a new object was generated, 0 otherwise.

Definition at line 3294 of file object.c.

int CAN_MERGE ( object ob1,
object ob2 
)

Moved this out of define.h and in here, since this is the only file it is used in. Also, make it an inline function for cleaner design.

Examines two objects given to, and returns 1 if they can be merged together.

Check nrof variable before calling this.

Improvements made with merge: Better checking on potion, and also check weight

Note:
This function appears a lot longer than the macro it replaces (mostly for clarity). A decent compiler should hopefully reduce this to the same efficiency.
Parameters:
ob1 The first object
ob2 The second object
Returns:
1 if the two object can merge, 0 otherwise

Definition at line 366 of file object.c.

int can_pick ( object who,
object item 
)

Finds out if an object can be picked up.

Parameters:
who Who is trying to pick up. Can be a monster or a player.
item Item we're trying to pick up.
Returns:
1 if it can be picked up, 0 otherwise.
Note:
This introduces a weight limitation for monsters.

Definition at line 3148 of file object.c.

int can_see_monsterP ( mapstruct m,
int  x,
int  y,
int  dir 
)

Recursive routine to see if we can find a path to a certain point.

Parameters:
m Map we're on
x X coordinate.
y Y coordinate.
dir Direction we're going to. Must be less than SIZEOFFREE.
Returns:
1 if we can see a direct way to get it

Definition at line 3396 of file object.c.

int check_walk_off ( object op,
object originator,
int  flags 
)
Todo:
Document.

Definition at line 2615 of file object.c.

int check_walk_on ( object op,
object originator,
int  flags 
)
Todo:
Document.

Definition at line 2532 of file object.c.

void clear_owner ( object op  ) 

Clear pointer to owner of an object, including ownercount.

Parameters:
op The object to clear the owner for

Definition at line 706 of file object.c.

static int compare_ob_value_lists ( const object ob1,
const object ob2 
) [static]

Compares two object lists.

Parameters:
ob1 Object to compare.
ob2 Object to compare.
Returns:
1 if ob1 has the same key_values as ob2.

Definition at line 342 of file object.c.

static int compare_ob_value_lists_one ( const object wants,
const object has 
) [static]

Compares value lists.

Parameters:
wants What to search.
has Where to search.
Returns:
1 if every key_values in wants has a partner with the same value in has.

Definition at line 313 of file object.c.

void copy_object ( object op2,
object op 
)

Copy object first frees everything allocated by the second object, and then copies the contends of the first object into the second object, allocating what needs to be allocated.

Parameters:
op2 Object that we copy from.
op Object that we copy to.

Definition at line 870 of file object.c.

void copy_object_data ( object op2,
object op 
)

Same as copy_object(), but not touching the active list.

Parameters:
op2 
op 

Definition at line 953 of file object.c.

void copy_owner ( object op,
object clone 
)

Set the owner to clone's current owner and set the skill and experience objects to clone's objects (typically those objects that where the owner's current skill and experience objects at the time when clone's owner was set - not the owner's current skill and experience objects).

Use this function if player created an object (e.g. fire bullet, swarm spell), and this object creates further objects whose kills should be accounted for the player's original skill, even if player has changed skills meanwhile.

Parameters:
op The object.
clone The clone.

Definition at line 798 of file object.c.

object* decrease_ob_nr ( object op,
uint32  i 
)

Decreases a specified number from the amount of an object. If the amount reaches 0, the object is subsequently removed and freed.

This function will send an update to client if op is in a player inventory.

Parameters:
op Object to decrease.
i Number to remove.
Returns:
'op' if something is left, NULL if the amount reached 0.

Definition at line 2297 of file object.c.

void destroy_object ( object ob  ) 

Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects. This function is called automatically to free unused objects (it is called from return_poolchunk() during garbage collection in object_gc() ).

The object must have been removed by remove_ob() first for this function to succeed.

Parameters:
ob The object to destroy.

Definition at line 1515 of file object.c.

void destruct_ob ( object op  ) 

Drop op's inventory on the floor and remove op from the map.

Used mainly for physical destruction of normal objects and monsters.

Parameters:
op Object to destruct.

Definition at line 1600 of file object.c.

int dirdiff ( int  dir1,
int  dir2 
)

Computes a direction difference.

Parameters:
dir1 First direction to compare.
dir2 Second direction to compare.
Returns:
How many 45-degrees differences there is between two directions (which are expected to be absolute (see absdir()).

Definition at line 3096 of file object.c.

void drop_ob_inv ( object ob  ) 

Drops the inventory of ob into ob's current environment.

Makes some decisions whether to actually drop or not, and/or to create a corpse for the stuff.

Parameters:
ob The object to drop the inventory for.

Definition at line 1351 of file object.c.

void dump_object ( object op,
StringBuffer sb 
)

Dumps an object.

Parameters:
op Object to dump. Can be NULL.
sb Buffer that will contain object information. Must not be NULL.

Definition at line 647 of file object.c.

int find_dir ( mapstruct m,
int  x,
int  y,
object exclude 
)

Searches some close squares in the given map at the given coordinates for alive objects.

Parameters:
m Map.
x X position on map.
y Y position on map.
exclude An object that will be ignored. Can be NULL.
Returns:
Direction toward the first/closest live object if it finds any, otherwise 0.

Definition at line 2958 of file object.c.

int find_dir_2 ( int  x,
int  y 
)

Computes a direction which you should travel to move of x and y.

Parameters:
x Delta.
y Delta.
Returns:
Direction

Definition at line 3007 of file object.c.

int find_first_free_spot ( archetype at,
object op,
mapstruct m,
int  x,
int  y 
)

Works like find_free_spot(), but it will search max number of squares.

It will return the first available spot, not a random choice.

Todo:
Document.

Definition at line 2873 of file object.c.

int find_first_free_spot2 ( archetype at,
mapstruct m,
int  x,
int  y,
int  start,
int  range 
)
Todo:
Document.

Definition at line 2890 of file object.c.

int find_free_spot ( archetype at,
object op,
mapstruct m,
int  x,
int  y,
int  start,
int  stop 
)

Will search for a spot at the given map and coordinates which will be able to contain the given archetype. start and stop specifies how many squares to search (see the freearr_x/y[] definition).

It returns a random choice among the alternatives found. start and stop are where to start relative to the free_arr array (1,9 does all 4 immediate directions). This returns the index into the array of the free spot, -1 if no spot available (dir 0 = x,y)

Note:
This only checks to see if there is space for the head of the object - if it is a multispace object, this should be called for all pieces.
Todo:
Document.

Definition at line 2842 of file object.c.

void free_all_object_data (  ) 

Destroys all allocated objects.

Definition at line 671 of file object.c.

void free_key_values ( object op  ) 

Zero the key_values on op, decrementing the shared-string refcounts and freeing the links.

Parameters:
op Object to clear.

Definition at line 3432 of file object.c.

int get_dir_to_target ( object op,
object target,
rv_vector range_vector 
)

Get direction from one object to another.

If the first object is a player, this will set the player's facing direction to the returned direction.

Parameters:
op The first object
target The target object
range_vector Range vector pointer to use
Returns:
The direction

Definition at line 3117 of file object.c.

object* get_object (  ) 

Grabs an object from the list of unused objects, makes sure it is initialized, and returns it.

If there are no free objects, expand_objects() is called to get more.

Returns:
The new object.

Definition at line 1030 of file object.c.

object* get_owner ( object op  ) 

Returns the object which this object marks as being the owner.

An ID scheme is used to avoid pointing to objects which have been freed and are now reused. If this is detected, the owner is set to NULL, and NULL is returned.

(This scheme should be changed to a refcount scheme in the future)

Parameters:
op The object to get owner for
Returns:
Owner of the object if any, NULL if no owner

Definition at line 686 of file object.c.

void get_search_arr ( int *  search_arr  ) 

New function to make monster searching more efficient, and effective! This basically returns a randomized array (in the passed pointer) of the spaces to find monsters. In this way, it won't always look for monsters to the north first. However, the size of the array passed covers all the spaces, so within that size, all the spaces within the 3x3 area will be searched, just not in a predictable order.

Parameters:
search_arr Array that will be initialized. Must contain at least SIZEOFFREE elements.

Definition at line 2935 of file object.c.

object* get_split_ob ( object orig_ob,
int  nr,
char *  err,
size_t  size 
)

Splits up ob into two parts. The part which is returned contains nr objects, and the remaining parts contains the rest (or is removed and freed if that number is 0).

Parameters:
orig_ob Object from which to split.
nr Number of elements to split.
err Buffer that will contain failure reason if NULL is returned. Can be NULL.
size err's size.
Returns:
Split object, or NULL on failure.

Definition at line 2229 of file object.c.

void init_materials (  ) 

Initialize materials from file.

Definition at line 145 of file object.c.

void init_object_initializers (  ) 

Initialize the table of object initializers.

Definition at line 3638 of file object.c.

void initialize_object ( object op  ) 

Frees everything allocated by an object, and also initializes all variables and flags to default settings.

Parameters:
op The object

Definition at line 832 of file object.c.

object* insert_ob_in_map ( object op,
mapstruct m,
object originator,
int  flag 
)

This function inserts the object in the two-way linked list which represents what is on a map.

Parameters:
op Object to insert.
m Map to insert into.
originator What caused op to be inserted.
flag Combination of INS_xxx values.
Returns:
NULL if 'op' was destroyed, 'op' otherwise.

Definition at line 1822 of file object.c.

object* insert_ob_in_ob ( object op,
object where 
)

This function inserts the object op in the linked list inside the object environment.

Parameters:
op Object to insert. Must be removed and not NULL. Must not be multipart. May become invalid after return, so use return value of the function.
where Object to insert into. Must not be NULL. Should be the head part.
Returns:
Pointer to inserted item, which will be different than op if object was merged.

Definition at line 2404 of file object.c.

object* is_player_inv ( object op  ) 

Finds the player carrying an object.

Parameters:
op Item for which we want the carrier (player).
Returns:
The player, or NULL if not in an inventory.

Definition at line 629 of file object.c.

object* load_object_str ( char *  obstr  ) 

Creates an object using a string representing its content.

Basically, we save the content of the string to a temp file, then call load_object on it.

Parameters:
obstr String to load the object from.
Returns:
The newly created object.

Definition at line 3261 of file object.c.

void mark_object_removed ( object ob  ) 

Put an object in the list of removal candidates.

If the object has still FLAG_REMOVED set at the end of the server timestep it will be freed.

Parameters:
ob The object.

Definition at line 251 of file object.c.

object* merge_ob ( object op,
object top 
)

This function goes through all objects below and including top, and merges op to the first matching object. If top is NULL, it is calculated.

Parameters:
op The object
top The top object
Returns:
Pointer to object if it succeded in the merge, NULL otherwise

Definition at line 498 of file object.c.

object* object_create_clone ( object asrc  ) 

Create clone from one object to another.

Parameters:
asrc Object to clone.
Returns:
Clone of asrc, including inventory and 'more' body parts.

Definition at line 3189 of file object.c.

void object_gc (  ) 

Go through all objects in the removed list and free the forgotten ones.

Definition at line 274 of file object.c.

key_value* object_get_key_link ( const object ob,
const char *  key 
)

Search for a field by key.

Parameters:
ob Object to search in.
key Key to search. Must be a shared string.
Returns:
The link from the list if ob has a field named key, NULL otherwise.

Definition at line 3469 of file object.c.

const char* object_get_value ( const object op,
const char *const   key 
)

Get an extra value by key.

Parameters:
op Object we're considering.
key Key of which to retrieve the value. Doesn't need to be a shared string.
Returns:
The value if found, NULL otherwise.
Note:
The returned string is shared.

Definition at line 3491 of file object.c.

int object_set_value ( object op,
const char *  key,
const char *  value,
int  add_key 
)

Updates the key in op to value.

Parameters:
op Object we're considering.
key Key to set or update. Doesn't need to be a shared string.
value Value to set. Doesn't need to be a shared string.
add_key If 0, will not add the key if it doesn't exist in op.
Returns:
1 if key was updated or added, 0 otherwise.
Note:
This function is merely a wrapper to object_set_value_s() to ensure the key is a shared string.

Definition at line 3615 of file object.c.

static int object_set_value_s ( object op,
const char *  canonical_key,
const char *  value,
int  add_key 
) [static]

Updates or sets a key value.

Parameters:
op Object we're considering.
canonical_key Key to set or update. Must be a shared string.
value Value to set. Doesn't need to be a shared string.
add_key If 0, will not add the key if it doesn't exist in op.
Returns:
1 if key was updated or added, 0 otherwise.

Definition at line 3521 of file object.c.

static void permute ( int *  arr,
int  begin,
int  end 
) [static]

Randomly permutes an array.

Parameters:
arr Array to permute.
begin First index to permute.
end Second index to permute.

Definition at line 2910 of file object.c.

object* present ( uint8  type,
mapstruct m,
int  x,
int  y 
)

Searches for any objects with a matching type at the given map and coordinates.

Parameters:
type Type to find.
m Map.
x X coordinate on map.
y Y coordinate on map.
Returns:
First matching object, or NULL if none matches.

Definition at line 2765 of file object.c.

object* present_arch ( archetype at,
mapstruct m,
int  x,
int  y 
)

Searches for any objects with a matching archetype at the given map and coordinates.

Parameters:
at Archetype to look for.
m Map.
x X coordinate on map.
y Y coordinate on map.
Returns:
First matching object, or NULL if none matches.

Definition at line 2736 of file object.c.

object* present_arch_in_ob ( archetype at,
object op 
)

Searches for any objects with a matching archetype in the inventory of the given object.

Parameters:
at Archetype to search for.
op Where to search.
Returns:
First matching object, or NULL if none matches.

Definition at line 2813 of file object.c.

object* present_in_ob ( uint8  type,
object op 
)

Searches for any objects with a matching type variable in the inventory of the given object.

Parameters:
type Type to search for.
op Object to search into.
Returns:
First matching object, or NULL if none matches.

Definition at line 2792 of file object.c.

void remove_ob ( object op  ) 

This function removes the object op from the linked list of objects which it is currently tied to. When this function is done, the object will have no environment. If the object previously had an environment, the x and y coordinates will be updated to the previous environment.

Note:
If you want to remove a lot of items in player's inventory, set FLAG_NO_FIX_PLAYER on the player first and then explicitly call fix_player() on the player.
Parameters:
op Object to remove.

Definition at line 1622 of file object.c.

static void remove_ob_inv ( object op  )  [static]

Recursively remove the inventory of an object.

Parameters:
op Object.

Definition at line 1795 of file object.c.

void replace_insert_ob_in_map ( char *  arch_string,
object op 
)

This function inserts an object of a specified archetype in the map, but if it finds objects of its own type, it'll remove them first.

Parameters:
arch_string Object's archetype to insert.
op Object to insert under, supplies coordinates and the map.

Definition at line 2197 of file object.c.

void set_owner ( object op,
object owner 
)

Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects.

Parameters:
op The object.
owner The owner.

Definition at line 767 of file object.c.

static void set_owner_simple ( object op,
object owner 
) [static]

Sets the owner of the first object to the second object.

Also checkpoints a backup id scheme which detects freeing (and reusage) of the owner object.

Parameters:
op The object to set the owner for
owner The owner
See also:
get_owner()

Definition at line 725 of file object.c.

static void sub_weight ( object op,
sint32  weight 
) [static]

Recursively (outwards) subtracts a number from the weight of an object (and what is carried by its environment(s)).

Parameters:
op The object
weight The weight to subtract

Definition at line 604 of file object.c.

signed long sum_weight ( object op  ) 

Recursive function to calculate the weight an object is carrying.

It goes through in figures out how much containers are carrying, and sums it up.

Parameters:
op The object to calculate the weight for
Returns:
The calculated weight

Definition at line 543 of file object.c.

void update_ob_speed ( object op  ) 

Updates the speed of an object. If the speed changes from 0 to another value, or vice versa, then add/remove the object from the active list. This function needs to be called whenever the speed of an object changes.

Parameters:
op The object

Definition at line 1061 of file object.c.

void update_object ( object op,
int  action 
)

Updates the array which represents the map.

It takes into account invisible objects (and represent squares covered by invisible objects by whatever is below them (unless it's another invisible object, etc).

If the object being updated is beneath a player, the below window of that player is updated.

Parameters:
op Object to update
action Hint of what the caller believes need to be done. One of Object update flags values.

Definition at line 1149 of file object.c.

void update_turn_face ( object op  ) 

If an object with the IS_TURNABLE() flag needs to be turned due to the closest player being on the other side, this function can be called to update the face variable, <u>and</u> how it looks on the map.

Parameters:
op The object to update.

Definition at line 1045 of file object.c.

int was_destroyed ( object op,
tag_t  old_tag 
)

Check if object has been destroyed.

Parameters:
op Object.
old_tag Object's tag.
Returns:
1 if it was destroyed (removed from map, old_tag does not match object's count or it is freed), 0 otherwise.

Definition at line 3249 of file object.c.


Variable Documentation

List of active objects that need to be processed

Definition at line 48 of file object.c.

int freearr_x[SIZEOFFREE]
Initial value:
{
    0, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1,
    0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1
}

X offset when searching around a spot.

Definition at line 218 of file object.c.

int freearr_y[SIZEOFFREE]
Initial value:
{
    0, -1, -1, 0, 1, 1, 1, 0, -1, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2,
    -3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3
}

Y offset when searching around a spot.

Definition at line 225 of file object.c.

int freedir[SIZEOFFREE]
Initial value:
{
    0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 2, 2, 3, 4, 4, 4, 5, 6, 6, 6, 7, 8, 8, 8,
    1, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 7, 8, 8, 8, 8, 8
}

Direction we're pointing on this spot.

Definition at line 239 of file object.c.

materialtype material[NROFMATERIALS]
Initial value:
{
    {"paper",          {15, 10, 17, 9, 5, 7,13, 0, 20, 15, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"metal",          {2, 12, 3, 12, 2,10, 7, 0, 20, 15, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"crystal",        {14, 11, 8, 3, 10, 5, 1, 0, 20, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"leather",        {5, 10, 10, 3, 3, 10,10, 0, 20, 15, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"wood",           {10, 11, 13, 2, 2, 10, 9, 0, 20, 15, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"organics",       {3, 12, 9, 11, 3, 10, 9, 0, 20, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"stone",          {2, 5, 2, 2, 2, 2, 1, 0, 20, 15, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"cloth",          {14, 11, 13, 4, 4, 5, 10, 0, 20, 15, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"magic material", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"liquid",         {0, 8, 9, 6, 17, 0, 15, 0, 20, 15, 12, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"soft metal",     {6, 12, 6, 14, 2, 10, 1, 0, 20, 15, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"bone",           {10, 9, 4, 5, 3, 10, 10, 0, 20, 15, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0}},
    {"ice",            {14, 11, 16, 5, 0, 5, 6, 0, 20, 15, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0}}
}

Material types

Definition at line 115 of file object.c.

material_real_struct material_real[NUM_MATERIALS_REAL]

Real material types. This array is initialized by init_materials().

Definition at line 137 of file object.c.

int maxfree[SIZEOFFREE]
Initial value:
{
    0, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 27, 30, 31, 32, 33, 36, 37, 39, 39, 42, 43, 44, 45,
    48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49
}

Number of spots around a location, including that location (except for 0)

Definition at line 232 of file object.c.

const int reduction_dir[SIZEOFFREE][3] [static]

Basically, this is a table of directions, and what directions one could go to go back to us. Eg, entry 15 below is 4, 14, 16. This basically means that if direction is 15, then it could either go direction 4, 14, or 16 to get back to where we are.

Definition at line 61 of file object.c.

List of objects that have been removed during the last server timestep.

Definition at line 45 of file object.c.

Container for objects without real maps or envs

Definition at line 54 of file object.c.


Generated by  doxygen 1.6.2