|
Atrinik Server 2.5
|
Go to the source code of this file.
Defines | |
| #define | NUM_MATERIALS_REAL NROFMATERIALS * NROFMATERIALS_REAL + 1 |
Functions | |
| static void | remove_ob_inv (object *op) |
| 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) |
| object * | merge_ob (object *op, object *top) |
| signed long | sum_weight (object *op) |
| void | add_weight (object *op, sint32 weight) |
| void | sub_weight (object *op, sint32 weight) |
| object * | get_env_recursive (object *op) |
| object * | is_player_inv (object *op) |
| void | dump_object (object *op, StringBuffer *sb) |
| void | dump_object_rec (object *op, StringBuffer *sb) |
| object * | get_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, int no_speed) |
| void | copy_object_with_inv (object *src_ob, object *dest_ob) |
| object * | get_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) |
| object * | insert_ob_in_map (object *op, mapstruct *m, object *originator, int flag) |
| void | replace_insert_ob_in_map (char *arch_string, object *op) |
| object * | get_split_ob (object *orig_ob, int nr, char *err, size_t size) |
| object * | decrease_ob_nr (object *op, uint32 i) |
| object * | insert_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) |
| object * | present_arch (archetype *at, mapstruct *m, int x, int y) |
| object * | present (uint8 type, mapstruct *m, int x, int y) |
| object * | present_in_ob (uint8 type, object *op) |
| object * | present_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) |
| void | permute (int *arr, int begin, int end) |
| void | get_search_arr (int *search_arr) |
| 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) |
| object * | object_create_clone (object *asrc) |
| int | was_destroyed (object *op, tag_t old_tag) |
| object * | load_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_value * | object_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 () |
| int | item_matched_string (object *pl, object *op, const char *name) |
| int | object_get_gender (object *op) |
| object * | object_need_esrv_update (object *op) |
| void | object_remove_esrv_update (object *op) |
Variables | |
| struct mempool_chunk * | removed_objects |
| object * | active_objects |
| static int | static_walk_semaphore = 0 |
| object | void_container |
| static const int | reduction_dir [SIZEOFFREE][3] |
| const char * | gender_noun [GENDER_MAX] |
| const char * | gender_subjective [GENDER_MAX] |
| const char * | gender_subjective_upper [GENDER_MAX] |
| const char * | gender_objective [GENDER_MAX] |
| const char * | gender_possessive [GENDER_MAX] |
| const char * | gender_reflexive [GENDER_MAX] |
| materialtype | materials [NROFMATERIALS] |
| material_real_struct | material_real [NUM_MATERIALS_REAL] |
| int | freearr_x [SIZEOFFREE] |
| int | freearr_y [SIZEOFFREE] |
| int | maxfree [SIZEOFFREE] |
| int | freedir [SIZEOFFREE] |
| const char * | object_flag_names [NUM_FLAGS+1] |
Object related code.
Definition in file object.c.
| int absdir | ( | int | d | ) |
| int auto_apply | ( | object * | op | ) |
Process object with FLAG_AUTO_APPLY.
Basically creates treasure for objects like shop floors and treasures.
| op | The object to process. |
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
| ob1 | The first object |
| ob2 | The second object |
| int can_see_monsterP | ( | mapstruct * | m, |
| int | x, | ||
| int | y, | ||
| int | dir | ||
| ) |
| void clear_owner | ( | object * | op | ) |
Copy object first frees everything allocated by the second object, and then copies the contents of the first object into the second object, allocating what needs to be allocated.
| op2 | Object that we copy from. |
| op | Object that we copy to. |
| no_speed | If set, do not touch the active list. |
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.
| op | The object. |
| clone | The clone. |
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.
| op | Object to decrease. |
| i | Number to remove. |
| 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.
| ob | The object to destroy. |
| void destruct_ob | ( | object * | op | ) |
| int dirdiff | ( | int | dir1, |
| int | dir2 | ||
| ) |
| void drop_ob_inv | ( | object * | ob | ) |
| void dump_object | ( | object * | op, |
| StringBuffer * | sb | ||
| ) |
| void dump_object_rec | ( | object * | op, |
| StringBuffer * | sb | ||
| ) |
| int find_dir_2 | ( | 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.
| 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)
| void free_key_values | ( | object * | op | ) |
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.
| op | The first object |
| target | The target object |
| range_vector | Range vector pointer to use |
| object* get_object | ( | ) |
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)
| op | The object to get owner for |
| 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.
| search_arr | Array that will be initialized. Must contain at least SIZEOFFREE elements. |
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).
| 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. |
| void init_object_initializers | ( | ) |
| void initialize_object | ( | object * | op | ) |
This function inserts the object op in the linked list inside the object environment.
| 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. |
This is a subset of the parse_id command. Basically, name can be a string separated lists of things to match, with certain keywords.
Calling function takes care of what action might need to be done and if it is valid (pickup, drop, etc).
Brief outline of the procedure:
We take apart the name variable into the individual components. cases for 'all' and unpaid are pretty obvious.
Next, we check for a count (either specified in name, or in the player object). If count is 1, make a quick check on the name. If count is >1, we need to make plural name. Return if match.
Last, make a check on the full name.
| pl | Player (only needed to set count properly). |
| op | The item we're trying to match. |
| name | String we're searching. |
| object* load_object_str | ( | char * | obstr | ) |
| void mark_object_removed | ( | object * | ob | ) |
| void object_gc | ( | ) |
| int object_get_gender | ( | object * | op | ) |
Get object's gender ID, as defined in Gender IDs..
| op | Object to get gender ID of. |
| const char* object_get_value | ( | const object * | op, |
| const char *const | key | ||
| ) |
Figure out whether an object needs to be updated for the player (because it's getting removed, modified, etc).
| op | Object about to be removed/modified/etc. |
| void object_remove_esrv_update | ( | object * | op | ) |
| int object_set_value | ( | object * | op, |
| const char * | key, | ||
| const char * | value, | ||
| int | add_key | ||
| ) |
Updates the key in op to value.
| 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. |
| 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.
| 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. |
| void permute | ( | int * | arr, |
| int | begin, | ||
| int | end | ||
| ) |
| 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.
| op | Object to remove. |
| static void remove_ob_inv | ( | object * | op | ) | [static] |
| void replace_insert_ob_in_map | ( | char * | arch_string, |
| object * | op | ||
| ) |
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.
| op | The object to set the owner for |
| owner | The owner |
| signed long sum_weight | ( | object * | op | ) |
| void update_ob_speed | ( | object * | op | ) |
| 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.
| op | Object to update |
| action | Hint of what the caller believes need to be done. One of Object update flags values. |
| void update_turn_face | ( | object * | op | ) |
| int freearr_x[SIZEOFFREE] |
| int freearr_y[SIZEOFFREE] |
| int freedir[SIZEOFFREE] |
| const char* gender_noun[GENDER_MAX] |
| const char* gender_objective[GENDER_MAX] |
| const char* gender_possessive[GENDER_MAX] |
| const char* gender_reflexive[GENDER_MAX] |
| const char* gender_subjective[GENDER_MAX] |
| const char* gender_subjective_upper[GENDER_MAX] |
| material_real_struct material_real[NUM_MATERIALS_REAL] |
Real material types. This array is initialized by init_materials().
| materialtype materials[NROFMATERIALS] |
| int maxfree[SIZEOFFREE] |
{
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)
| const char* object_flag_names[NUM_FLAGS+1] |
This is a list of pointers that correspond to the FLAG_.. values. This is a simple 1:1 mapping - if FLAG_FRIENDLY is 15, then the 15'th element of this array should match that name.
If an entry is NULL, that is a flag not to be loaded/saved.
const int reduction_dir[SIZEOFFREE][3] [static] |
| struct mempool_chunk* removed_objects |
1.7.4