![]() |
Crossfire Server, Trunk
1.75.0
|
#include "global.h"
#include <assert.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/uio.h>
#include "loader.h"
#include "object.h"
#include "skills.h"
#include "sproto.h"
#include "stringbuffer.h"
Go to the source code of this file.
Functions | |
int | absdir (int d) |
Computes an absolute direction. More... | |
object * | add_force (object *op, const char *name, int duration) |
Add or return an existing force inside 'op' with the given 'name' and 'duration' in units of 100 ticks (12 seconds under default settings). More... | |
static void | ADD_STRINGLINE_ENTRY (StringBuffer *sb, const char *name, const char *value) |
Adds a line to the buffer. More... | |
object * | arch_present_in_ob (const archetype *at, const object *op) |
Searches for any objects with a matching archetype in the inventory of the given object. More... | |
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. More... | |
static int | compare_ob_value_lists (const object *ob1, const object *ob2) |
Compares two object lists. More... | |
static int | compare_ob_value_lists_one (const object *wants, const object *has) |
Compares value lists. More... | |
int | dirdiff (int dir1, int dir2) |
Computes a direction difference. More... | |
static void | expand_objects (void) |
Allocates more objects for the list of unused objects. More... | |
static void | FAST_SAVE_DOUBLE (StringBuffer *sb, const char *name, const double value) |
Adds a double to the buffer. More... | |
static void | FAST_SAVE_LONG (StringBuffer *sb, const char *name, const long value) |
Adds a long to the buffer. More... | |
int | find_dir_2 (int x, int y) |
Computes a direction which you should travel to move of x and y. More... | |
object * | find_force (object *op, const char *name) |
Find a force with the given 'name' in the slaying field. More... | |
static object * | find_insert_pos (object *op, const int flag) |
int | flags_differ (ob_flags *diff) |
Return the index of the first difference in the given object flag difference set (computed by compare_flags) or -1 if there is no difference. More... | |
void | get_ob_diff (StringBuffer *sb, const object *op, const object *op2) |
Returns a pointer to a static string which contains all variables which are different in the two given objects. More... | |
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. More... | |
static void | get_string_move_type (StringBuffer *sb, MoveType mt) |
This returns a string of the integer movement type. More... | |
void | init_objects (void) |
Sets up and initialises the linked list of free and used objects. More... | |
object * | map_find_by_archetype (mapstruct *m, int x, int y, const archetype *at) |
Searches for any objects with a matching archetype at the given map and coordinates. More... | |
object * | map_find_by_type (mapstruct *m, int x, int y, uint8_t type) |
Searches for any objects with a matching type variable at the given map and coordinates. More... | |
void | object_add_weight (object *op, signed long weight) |
object_add_weight(object, weight) adds the specified weight to an object, and also updates how much the environment(s) is/are carrying. More... | |
int | object_can_merge (object *ob1, object *ob2) |
Examines the 2 objects given to it, and returns true if they can be merged together, including inventory. More... | |
int | object_can_pick (const object *who, const object *item) |
Finds out if an object can be picked up. More... | |
int | object_check_move_on (object *op, object *originator) |
Checks if any objects has a move_type that matches objects that effect this object on this space. More... | |
void | object_clear (object *op) |
Frees everything allocated by an object, and also clears all variables and flags to default settings. More... | |
void | object_clear_owner (object *op) |
Clears the owner of specified object. More... | |
void | object_copy (const object *src_ob, object *dest_ob) |
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. More... | |
void | object_copy_no_speed (const object *src_ob, object *dest_ob) |
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. More... | |
void | object_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). More... | |
void | object_copy_with_inv (const object *src_ob, object *dest_ob, bool update_speed) |
Copy an object with an inventory, duplicate the inv too. More... | |
int | object_count_active (void) |
Objects statistics. More... | |
int | object_count_free (void) |
Objects statistics. More... | |
int | object_count_used (void) |
Object statistics. More... | |
object * | object_create_clone (object *asrc) |
Create clone from object to another. More... | |
object * | object_decrease_nrof (object *op, uint32_t i) |
Decreases a specified number from the amount of an object. More... | |
int | object_distance (const object *ob1, const object *ob2) |
Return the square of the distance between the two given objects. More... | |
void | object_dump (const object *op, StringBuffer *sb) |
Dumps an object. More... | |
void | object_dump_all (void) |
Dumps all objects to console. More... | |
object * | object_find_by_arch_name (const object *who, const char *name) |
Find object in inventory by archetype name. More... | |
object * | object_find_by_flag (const object *who, int flag) |
Find object in inventory by flag. More... | |
object * | object_find_by_flag_applied (const object *who, int flag) |
Find applied object in inventory by flag. More... | |
object * | object_find_by_name (const object *who, const char *name) |
Finds an object in inventory name. More... | |
object * | object_find_by_name_global (const char *str) |
Finds an object by name. More... | |
object * | object_find_by_tag (const object *who, tag_t tag) |
Find object in inventory. More... | |
object * | object_find_by_tag_global (tag_t i) |
Returns the object which has the count-variable equal to the argument. More... | |
object * | object_find_by_type (const object *who, int type) |
Find object in inventory. More... | |
object * | object_find_by_type2 (const object *who, int type1, int type2) |
Find object in inventory. More... | |
object * | object_find_by_type_and_arch_name (const object *who, int type, const char *name) |
Find object in inventory by type and archetype name. More... | |
object * | object_find_by_type_and_name (const object *who, int type, const char *name) |
Find object in inventory by type and name. More... | |
object * | object_find_by_type_and_race (const object *who, int type, const char *race) |
Find object in inventory by type and race. More... | |
object * | object_find_by_type_and_skill (const object *who, int type, const char *skill) |
Find object in inventory by type and skill. More... | |
object * | object_find_by_type_and_slaying (const object *who, int type, const char *slaying) |
Find object in inventory by type and slaying. More... | |
object * | object_find_by_type_applied (const object *who, int type) |
Find applied object in inventory. More... | |
object * | object_find_by_type_subtype (const object *who, int type, int subtype) |
Find object in inventory. More... | |
object * | object_find_by_type_without_flags (const object *who, int type, int *flags, int num_flags) |
Find an object in inventory that does not have any of the provided flags set. More... | |
int | object_find_first_free_spot (const object *ob, mapstruct *m, int x, int y) |
object_find_first_free_spot(archetype, mapstruct, x, y) works like object_find_free_spot(), but it will search max number of squares. More... | |
int | object_find_free_spot (const object *ob, mapstruct *m, int x, int y, int start, int stop) |
object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coordinates which will be able to contain the given object. More... | |
int | object_find_multi_free_spot_around (const object *ob, const object *gen, int16_t *hx, int16_t *hy) |
Sets hx and hy to the coords to insert a possibly multi-tile ob at, around gen. More... | |
int | object_find_multi_free_spot_within_radius (const object *ob, const object *gen, int *hx, int *hy) |
Sets hx and hy to the coords to insert a possibly multi-tile ob at, within radius of generator, which is stored in key_value "generator_radius". More... | |
void | object_fix_multipart (object *tmp) |
Ensures specified object has its more parts correctly inserted in map. More... | |
void | object_free (object *ob, int flags) |
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects. More... | |
void | object_free_all_data (void) |
Destroys all allocated objects. More... | |
void | object_free_drop_inventory (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. More... | |
void | object_free_inventory (object *ob) |
Frees the inventory of an object, without any callback. More... | |
void | object_free_key_values (object *op) |
Zero the key_values on op, decrementing the shared-string refcounts and freeing the links. More... | |
object * | object_get_env_recursive (object *op) |
Utility function. More... | |
key_value * | object_get_key_value (const object *ob, const char *key) |
Search for a field by key. More... | |
void | object_get_multi_size (const object *ob, int *sx, int *sy, int *hx, int *hy) |
Computes the size of a multitile object. More... | |
object * | object_get_owner (object *op) |
Returns the object which this object marks as being the owner. More... | |
static const object * | object_get_owner_const (const object *op) |
Returns the object which this object marks as being the owner, constant version. More... | |
object * | object_get_player_container (object *op) |
Finds the player carrying an object. More... | |
const char * | object_get_value (const object *op, const char *const key) |
Get an extra value by key. More... | |
void | object_handle_death_animation (object *op) |
static void | object_increase_nrof (object *op, uint32_t i) |
Increase the count of an object. More... | |
object * | object_insert_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. More... | |
object * | object_insert_in_map_at (object *op, mapstruct *m, object *originator, int flag, int x, int y) |
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing multi-part monsters. More... | |
object * | object_insert_in_ob (object *op, object *where) |
This function inserts the object op in the linked list inside the object environment. More... | |
void | object_insert_to_free_spot_or_free (object *op, mapstruct *map, int x, int y, int start, int stop, object *originator) |
Inserts an object into its map. More... | |
int | object_matches_string (object *pl, object *op, const char *name) |
This is a subset of the parse_id command. More... | |
object * | object_merge (object *op, object *top) |
This function goes through all objects below and including top, and merges op to the first matching object. More... | |
void | object_merge_spell (object *op, int16_t x, int16_t y) |
This sees if there are any objects on the space that can merge with op. More... | |
object * | object_new (void) |
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it. More... | |
object * | object_present_in_ob (uint8_t type, const object *op) |
Searches for any objects with a matching type variable in the inventory of the given object. More... | |
object * | object_present_in_ob_by_name (int type, const char *str, const object *op) |
Searches for any objects with a matching type & name variable in the inventory of the given object. More... | |
void | object_remove (object *op) |
This function removes the object op from the linked list of objects which it is currently tied to. More... | |
void | object_remove_from_active_list (object *op) |
This function removes object 'op' from the list of active objects. More... | |
void | object_replace_insert_in_map (const 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. More... | |
void | object_reset (object *op) |
Totally resets the specified object, without freeing associated memory. More... | |
void | object_set_cheat (object *op) |
object_set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in all it's inventory (recursively). More... | |
void | object_set_enemy (object *op, object *enemy) |
Sets the enemy of an object. More... | |
void | object_set_flag_inv (object *op, int flag) |
Activate recursively a flag on an object's inventory. More... | |
void | object_set_msg (object *op, const char *msg) |
Set the message field of an object. More... | |
void | object_set_owner (object *op, object *owner) |
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects. More... | |
int | object_set_value (object *op, const char *key, const char *value, int add_key) |
Updates the key in op to value. More... | |
static int | object_set_value_s (object *op, const char *canonical_key, const char *value, int add_key) |
Updates or sets a key value. More... | |
object * | object_split (object *orig_ob, uint32_t nr, char *err, size_t size) |
object_split(ob,nr) splits up ob into two parts. More... | |
void | object_sub_weight (object *op, signed long weight) |
Recursively (outwards) subtracts a number from the weight of an object (and what is carried by it's environment(s)). More... | |
signed long | object_sum_weight (object *op) |
object_sum_weight() is a recursive function which calculates the weight an object is carrying. More... | |
void | object_unset_flag_inv (object *op, int flag) |
Desactivate recursively a flag on an object inventory. More... | |
void | object_update (object *op, int action) |
object_update() updates the array which represents the map. More... | |
void | object_update_speed (object *op) |
Updates the speed of an object. More... | |
void | object_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, and how it looks on the map. More... | |
bool | object_value_set (const object *op, const char *const key) |
Determine if an extra value is set. More... | |
bool | object_value_set_shared (const object *op, sstring key) |
Determine if an extra value is set to a non empty or 0 value. More... | |
static void | permute (int *arr, int begin, int end) |
Randomly permutes an array. More... | |
int | save_object (FILE *fp, object *op, int flag) |
Dumps all variables in an object to a file. More... | |
void | save_object_in_sb (StringBuffer *sb, object *op, const int flag) |
Store a string representation of op in sb. More... | |
Variables | |
object * | active_objects |
List of active objects that need to be processed. More... | |
static const char *const | flag_names [NUM_FLAGS+1] |
This is a list of pointers that correspond to the FLAG_. More... | |
static object * | free_objects |
Pointer to the list of unused objects. More... | |
short | freearr_x [SIZEOFFREE] |
X offset when searching around a spot. More... | |
short | freearr_y [SIZEOFFREE] |
Y offset when searching around a spot. More... | |
int | freedir [SIZEOFFREE] |
Direction we're pointing on this spot. More... | |
int | maxfree [SIZEOFFREE] |
Number of spots around a location, including that location (except for 0) More... | |
const char *const | move_name [] |
Maps the MOVE_* values to names. More... | |
int | nrofallocobjects = STARTMAX |
How many OBs allocated (free + used) More... | |
int | nroffreeobjects = STARTMAX |
How many OBs allocated and free (free) More... | |
static object | objarray [STARTMAX] |
All objects, allocated this way at first. More... | |
object * | objects |
Pointer to the list of used objects. More... | |
static const int | reduction_dir [SIZEOFFREE][3] |
Basically, this is a table of directions, and what directions one could go to go back to us. More... | |
const char *const | spell_mapping [SPELL_MAPPINGS] |
This table is only necessary to convert objects that existed before the spell object conversion to the new object. More... | |
Everything related to objects, in their basic form.
Definition in file object.cpp.
int absdir | ( | int | d | ) |
Computes an absolute direction.
d | direction to convert. |
Definition at line 3714 of file object.cpp.
References d.
Referenced by adjust_dir(), check_spell_knockback(), common_process_projectile(), fire_arch_from_position(), fire_bolt(), flee_player(), forklightning(), get_randomized_dir(), monster_compute_path(), monster_dist_att(), monster_disthit_att(), monster_hitrun_att(), monster_move(), monster_run_att(), monster_wait_att(), monster_wait_att2(), move_ball_spell(), move_bolt(), move_bullet(), move_cone(), move_swarm_spell(), path_to_player(), pets_move(), pets_summon_object(), player_fire_bow(), pray_at_altar(), spinner_type_move_on(), and turn_transport().
Add or return an existing force inside 'op' with the given 'name' and 'duration' in units of 100 ticks (12 seconds under default settings).
If 'duration' is zero, the force will not expire by itself.
Definition at line 5430 of file object.cpp.
References add_string(), create_archetype(), find_force(), FORCE_NAME, name, object_insert_in_ob(), object_update_speed(), object::slaying, object::speed, and object::speed_left.
Referenced by commit_crime(), and move_marker().
|
inlinestatic |
Adds a line to the buffer.
Definition at line 4936 of file object.cpp.
References name, and stringbuffer_append_string().
Referenced by get_ob_diff(), and save_object_in_sb().
Searches for any objects with a matching archetype in the inventory of the given object.
at | archetype to search for. |
op | where to search. |
Definition at line 3222 of file object.cpp.
References object::arch, object::below, and object::inv.
Referenced by cast_heal(), cfapi_object_find_archetype_inside(), cfapi_object_get_property(), change_luck(), create_aura(), drain_specific_stat(), kill_player_not_permadeath(), perceive_self(), poison_living(), remove_depletion(), restore_player(), and slow_living_by().
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.
Modified to be map tile aware -.MSW
m | map we're on |
x | |
y | origin coordinates |
dir | direction we're going to. Must be less than SIZEOFFREE. |
Definition at line 3822 of file object.cpp.
References can_see_monsterP(), freearr_x, freearr_y, get_map_flags(), m, P_BLOCKSVIEW, P_OUT_OF_MAP, and reduction_dir.
Referenced by can_see_monsterP(), do_skill_ident(), monster_find_nearest_enemy(), and spell_find_dir().
Compares two object lists.
ob1 | |
ob2 | objects to compare. |
Definition at line 404 of file object.cpp.
References compare_ob_value_lists_one().
Referenced by object_can_merge().
Compares value lists.
wants | what to search |
has | where to search. |
Definition at line 363 of file object.cpp.
References FALSE, key_value::key, object::key_values, key_value::next, object_get_key_value(), TRUE, and key_value::value.
Referenced by compare_ob_value_lists().
int dirdiff | ( | int | dir1, |
int | dir2 | ||
) |
Computes a direction difference.
dir1 | |
dir2 | directions to compare. |
Definition at line 3732 of file object.cpp.
References d.
Referenced by monster_cast_spell(), monster_use_range(), monster_use_scroll(), and monster_use_skill().
|
static |
Allocates more objects for the list of unused objects.
It is called from object_new() if the unused list is empty.
If there is not enough memory, fatal() is called.
Definition at line 1231 of file object.cpp.
References CALLOC, fatal(), FLAG_FREED, FLAG_REMOVED, free_objects, object::next, nrofallocobjects, nroffreeobjects, OBJ_EXPAND, OUT_OF_MEMORY, object::prev, and SET_FLAG.
Referenced by object_new().
|
inlinestatic |
Adds a double to the buffer.
name must have a space at the end.
Definition at line 4950 of file object.cpp.
References name, and stringbuffer_append_printf().
Referenced by get_ob_diff().
|
inlinestatic |
Adds a long to the buffer.
name must have a space at the end.
Definition at line 4943 of file object.cpp.
References name, stringbuffer_append_char(), stringbuffer_append_int64(), and stringbuffer_append_string().
Referenced by get_ob_diff(), and save_object_in_sb().
int find_dir_2 | ( | int | x, |
int | y | ||
) |
Computes a direction which you should travel to move of x and y.
x | |
y | delta. |
Definition at line 3677 of file object.cpp.
Referenced by enter_map(), get_rangevector(), and get_rangevector_from_mapcoord().
Find a force with the given 'name' in the slaying field.
These forces are used as markers that may expire, for example, in the marker type. This is a thin wrapper around object_find_by_type_and_slaying().
Definition at line 5425 of file object.cpp.
References FORCE, name, and object_find_by_type_and_slaying().
Referenced by add_force(), is_criminal(), and move_marker().
Definition at line 2297 of file object.cpp.
References FLAG_IS_FLOOR, FLAG_NO_PICK, FLAG_OVERLAY_FLOOR, floor, FOR_MAP_FINISH, FOR_MAP_PREPARE, GET_MAP_TOP, INS_ABOVE_FLOOR_ONLY, INS_ON_TOP, object::map, MOVE_FLY_HIGH, MOVE_FLY_LOW, QUERY_FLAG, object::x, and object::y.
Referenced by object_insert_in_map().
int flags_differ | ( | ob_flags * | diff | ) |
Return the index of the first difference in the given object flag difference set (computed by compare_flags) or -1 if there is no difference.
Then modify the difference set so that the subsequent call on the same set returns the next difference.
Definition at line 4960 of file object.cpp.
Referenced by get_ob_diff().
void get_ob_diff | ( | StringBuffer * | sb, |
const object * | op, | ||
const object * | op2 | ||
) |
Returns a pointer to a static string which contains all variables which are different in the two given objects.
This function is typically used to dump objects (op2=empty object), or to save objects
sb | buffer that will contain the difference. |
op | what object the different values will be taken from. |
op2 | object's original archetype. |
Definition at line 4986 of file object.cpp.
References living::ac, ADD_STRINGLINE_ENTRY(), object::anim_suffix, object::animation, object::attack_movement, object::attacktype, object::body_info, body_locations, object::carrying, living::Cha, object::client_type, compare_flags(), living::Con, living::dam, object::dam_modifier, living::Dex, object::direction, object::duration, object::duration_modifier, object::elevation, living::exp, object::expmul, object::face, FAST_SAVE_DOUBLE(), FAST_SAVE_LONG(), FLAG_ANIMATE, FLAG_IS_LINKED, flag_names, flags_differ(), FMT64, living::food, object::gen_sp_armour, get_button_value(), get_string_move_type(), object::glow_radius, living::grace, living::hp, living::Int, object::invisible, object::item_power, key_value::key, object::key_values, object::last_eat, object::last_grace, object::last_heal, object::last_sp, object::level, object::lore, living::luck, object::magic, object::map_layer, map_layer_name, object::material, object::materialname, living::maxgrace, living::maxhp, living::maxsp, object::move_allow, object::move_block, object::move_off, object::move_on, object::move_slow, object::move_slow_penalty, object::move_status, object::move_type, object::msg, Face::name, Animations::name, treasurelist::name, object::name, archetype::name, object::name_pl, key_value::next, object::nrof, NROFATTACKS, NUM_BODY_LOCATIONS, object_get_key_value(), object::other_arch, object::path_attuned, object::path_denied, object::path_repelled, object::pick_up, living::Pow, QUERY_FLAG, object::race, object::randomitems, object::range, object::range_modifier, object::resist, resist_save, object::run_away, object::skill, object::slaying, object::smoothlevel, object::sound_chance, living::sp, object::speed, object::speed_left, object::state, object::stats, living::Str, stringbuffer_append_string(), object::subtype, object::title, object::total_exp, object::type, key_value::value, object::value, living::wc, object::weapon_speed, object::weapon_speed_left, object::weapontype, object::weight, object::weight_limit, object::will_apply, living::Wis, object::x, and object::y.
Referenced by add_one_item(), command_diff(), doWrite(), object_dump(), Archetypes::recursive_update(), save_object_in_sb(), and ArtifactWriter::write().
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. |
Definition at line 3642 of file object.cpp.
References permute(), SIZEOFFREE, SIZEOFFREE1, and SIZEOFFREE2.
Referenced by monster_find_nearest_enemy(), pets_get_enemy(), and spell_find_dir().
|
static |
This returns a string of the integer movement type.
sb | buffer that will contain the description. Must not be NULL. |
mt | move to describe. |
Definition at line 4892 of file object.cpp.
References MAX_BUF, MOVE_ALL, move_name, and stringbuffer_append_string().
Referenced by get_ob_diff().
void init_objects | ( | void | ) |
Sets up and initialises the linked list of free and used objects.
Allocates a certain chunk of objects and puts them on the free list. Called by init_library();
Definition at line 327 of file object.cpp.
References active_objects, FLAG_FREED, FLAG_REMOVED, free_objects, object::next, objarray, objects, object::prev, SET_FLAG, and STARTMAX.
Referenced by init_library().
Searches for any objects with a matching archetype at the given map and coordinates.
m | |
x | |
y | where to search. Must be valid position. |
at | archetype to search for. |
Definition at line 3118 of file object.cpp.
References FOR_MAP_FINISH, FOR_MAP_PREPARE, llevError, LOG(), m, and OUT_OF_REAL_MAP.
Referenced by cfapi_map_find_by_archetype_name(), put_in_icecube(), and town_portal_destroy_existing().
Searches for any objects with a matching type variable at the given map and coordinates.
m | |
x | |
y | where to search. Must be valid position. |
type | type to get. |
Definition at line 3145 of file object.cpp.
References FOR_MAP_FINISH, FOR_MAP_PREPARE, m, OUT_OF_REAL_MAP, and is_valid_types_gen::type.
Referenced by identify(), remove_door(), and remove_locked_door().
void object_add_weight | ( | object * | op, |
signed long | weight | ||
) |
object_add_weight(object, weight) adds the specified weight to an object, and also updates how much the environment(s) is/are carrying.
Takes container weight reduction into account.
op | object to which we add weight. |
weight | weight to add. |
Definition at line 2833 of file object.cpp.
References object::carrying, CONTAINER, object::env, object::stats, living::Str, object::type, and weight.
Referenced by make_item_from_recipe(), object_decrease_nrof(), object_increase_nrof(), and object_insert_in_ob().
Examines the 2 objects given to it, and returns true if they can be merged together, including inventory.
Note that this function appears a lot longer than the macro it replaces - this is mostly for clarity - a decent compiler should hopefully reduce this to the same efficiency.
Check nrof variable before calling object_can_merge()
Improvements made with merge: Better checking on potion, and also check weight
ob1 | |
ob2 | objects to try to merge. |
Definition at line 433 of file object.cpp.
References object::animation, object::arch, object::attacktype, object::client_type, compare_ob_value_lists(), FABS, FLAG_ANIMATE, FLAG_APPLIED, FLAG_BEEN_APPLIED, FLAG_IDENTIFIED, object::flags, object::inv, object::item_power, object::key_values, object::level, object::lore, object::magic, object::map_layer, object::materialname, MIN_ACTIVE_SPEED, object::move_allow, object::move_block, object::move_off, object::move_on, object::move_slow, object::move_slow_penalty, object::move_type, object::msg, object::name, object::nrof, object_can_merge(), QUERY_FLAG, object::resist, SCROLL, SET_FLAG, object::skill, object::slaying, speed, object::speed, object::stats, object::subtype, object::title, object::type, object::value, and object::weight.
Referenced by cfapi_object_get_property(), check_loaded_object(), give_initial_items(), object_can_merge(), object_insert_in_map(), object_insert_in_ob(), and object_merge().
Finds out if an object can be picked up.
Add a check so we can't pick up invisible objects (0.93.8)
who | who is trying to pick up. Can be a monster or a player. |
item | item we're trying to pick up. |
Definition at line 3867 of file object.cpp.
References object::carrying, object::contr, FLAG_ALIVE, FLAG_NO_PICK, get_weight_limit(), object::head, object::invisible, object::more, PLAYER, QUERY_FLAG, object::stats, living::Str, TRANSPORT, object::type, and object::weight.
Referenced by cfapi_object_get_property(), check_pick(), do_skill_detect_curse(), do_skill_detect_magic(), esrv_move_object(), examine_autoidentify(), matcher_name(), matcher_number(), monster_can_pick(), and pick_up().
Checks if any objects has a move_type that matches objects that effect this object on this space.
Call apply() to process these events.
Any speed-modification due to SLOW_MOVE() of other present objects will affect the speed_left of the object. 4-21-95 added code to check if appropriate skill was readied - this will permit faster movement by the player through this terrain. -b.t.
MSW 2001-07-08: Check all objects on space, not just those below object being inserted. object_insert_in_map may not put new objects on top.
op | object that may trigger something. |
originator | player, monster or other object that caused 'op' to be inserted into 'map'. May be NULL. |
Definition at line 3012 of file object.cpp.
References object::above, object::count, FABS, find_skill_by_number(), FLAG_IS_HILLY, FLAG_IS_WOODED, FLAG_NO_APPLY, FLAG_NO_PICK, FLAG_WIZPASS, FOR_OB_AND_ABOVE_FINISH, FOR_OB_AND_ABOVE_PREPARE, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, GET_MAP_MOVE_BLOCK, GET_MAP_MOVE_ON, GET_MAP_MOVE_SLOW, GET_MAP_OB, m, object::map, object::move_block, MOVE_FLY_LOW, object::move_on, object::move_slow, object::move_slow_penalty, object::move_type, MOVE_WALK, ob_move_on(), object_was_destroyed, PLAYER, QUERY_FLAG, SK_CLIMBING, SK_WOODSMAN, object::speed, object::speed_left, object::type, object::x, and object::y.
Referenced by change_abil(), and object_insert_in_map().
void object_clear | ( | object * | op | ) |
Frees everything allocated by an object, and also clears all variables and flags to default settings.
op | object to clear |
Definition at line 983 of file object.cpp.
References object::above, object::active_next, object::active_prev, object::attacked_by_count, object::below, blank_face, Settings::casting_time, object::casting_time, object::container, object::contr, object::env, object::expmul, object::face, FLAG_FRIENDLY, FLAG_REMOVED, FREE_AND_CLEAR_STR, free_dialog_information(), object::head, object::inv, object::lore, object::map, object::materialname, object::more, object::msg, name, object::name, object::name_pl, object_free_key_values(), offsetof, QUERY_FLAG, object::race, remove_friendly_object(), SET_FLAG, settings, object::skill, object::slaying, and object::title.
Referenced by cfapi_object_clear(), get_archetype_struct(), object_new(), and object_reset().
void object_clear_owner | ( | object * | op | ) |
Clears the owner of specified object.
op | object we want to clear the owner of. Can be NULL. |
Definition at line 823 of file object.cpp.
References object::owner, and object::ownercount.
Referenced by do_mood_floor(), fix_stopped_arrow(), object_get_owner(), object_set_owner(), and stop_projectile().
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.
Basically, any data that is malloc'd needs to be re-malloc/copied. Otherwise, if the first object is freed, the pointers in the new object will point at garbage. Will call object_update_speed() on the copied object.
src_ob | object that we copy.from |
dest_ob | object that we copy to. |
Definition at line 1192 of file object.cpp.
References object_copy_no_speed(), and object_update_speed().
Referenced by add_abilities(), apply_race_and_class(), cast_create_food(), cfapi_object_clone(), change_book(), check_loaded_object(), command_create(), do_learn_spell(), enter_exit(), explosion(), forklightning(), infect_object(), key_change_class(), magic_wall(), make_throw_ob(), move_bolt(), move_cone(), object_copy_with_inv(), object_create_clone(), pay_from_container(), place_special_exit(), polymorph_item(), put_decor(), put_doors(), sell_item(), while(), write_note(), write_rune(), and write_scroll().
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.
Basically, any data that is malloc'd needs to be re-malloc/copied. Otherwise, if the first object is freed, the pointers in the new object will point at garbage. Will not call object_update_speed() on the copied object.
src_ob | object that we copy.from |
dest_ob | object that we copy to. |
Definition at line 1061 of file object.cpp.
References add_refcount(), object::anim_suffix, object::arch, object::artifact, BITMASK_VALID, CLEAR_FLAG, object::event_bitmask, FLAG_DIALOG_PARSED, FLAG_FREED, FLAG_REMOVED, FREE_AND_CLEAR, free_dialog_information(), free_string(), key_value::key, object::key_values, object::lore, object::materialname, object::msg, name, object::name, object::name_pl, key_value::next, object_free_key_values(), offsetof, QUERY_FLAG, object::race, RANDOM, archetype::reference_count, SET_FLAG, object::skill, object::slaying, object::speed, object::speed_left, SPELL_TAG_SIZE, object::spell_tags, object::title, and key_value::value.
Referenced by object_copy(), object_copy_with_inv(), and while().
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 | object to update. |
clone | object from which to get the owner. |
Definition at line 893 of file object.cpp.
References object_get_owner(), object_set_owner(), PLAYER, and object::type.
Referenced by animate_bomb(), explode_bullet(), fire_arch_from_position(), and poison_living().
Copy an object with an inventory, duplicate the inv too.
src_ob | object to copy. |
dest_ob | where to copy. |
update_speed | if true then call update_speed() on the duplicated objects, else don't. |
Definition at line 1208 of file object.cpp.
References FOR_INV_FINISH, FOR_INV_PREPARE, object_copy(), object_copy_no_speed(), object_copy_with_inv(), object_insert_in_ob(), and object_new().
Referenced by arch_to_object(), include_map_in_map(), object_copy_with_inv(), place_chest(), place_fountain_with_specials(), place_monsters(), Archetypes::recursive_update(), and Archetypes::replace().
int object_count_active | ( | void | ) |
Objects statistics.
Definition at line 1783 of file object.cpp.
References object::active_next, and active_objects.
Referenced by malloc_info().
int object_count_free | ( | void | ) |
Objects statistics.
Definition at line 1751 of file object.cpp.
References free_objects, and object::next.
Referenced by malloc_info().
int object_count_used | ( | void | ) |
Object statistics.
Definition at line 1767 of file object.cpp.
References object::next, and objects.
Referenced by malloc_info().
Create clone from object to another.
asrc | object to clone. |
Definition at line 3909 of file object.cpp.
References FOR_INV_FINISH, FOR_INV_PREPARE, object::head, HEAD, object::more, object_copy(), object_create_clone(), object_insert_in_ob(), and object_new().
Referenced by cfapi_object_clone(), do_item_conversion(), generate_monster_arch(), generate_monster_inv(), move_creator(), object_create_clone(), and object_split().
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. |
Definition at line 2676 of file object.cpp.
References object::container, object::env, esrv_update_item(), first_player, fix_object(), FLAG_REMOVED, FOR_MAP_FINISH, FOR_MAP_PREPARE, object::map, player::next, object::nrof, player::ob, object_add_weight(), object_free_drop_inventory(), object_get_player_container(), object_remove(), object_sub_weight(), QUERY_FLAG, UPD_NROF, UPD_WEIGHT, object::weight, object::x, and object::y.
Referenced by cfapi_object_set_property(), check_altar_sacrifice(), do_item_conversion(), eat_item(), object_split(), operate_altar(), save_throw_object(), and spell_consume_items().
Return the square of the distance between the two given objects.
ob1 | |
ob2 | objects we want to compute the distance of. |
Definition at line 3661 of file object.cpp.
References object::x, and object::y.
Referenced by cfapi_object_distance().
void object_dump | ( | const object * | op, |
StringBuffer * | sb | ||
) |
Dumps an object.
op | object to dump. Can be NULL. |
sb | buffer that will contain object information. Must not be NULL. |
Definition at line 645 of file object.cpp.
References object::arch, object::artifact, object::attacked_by, archetype::clone, object::count, empty_archetype, object::enemy, object::env, get_ob_diff(), object::head, object::inv, object::more, object::name, archetype::name, object_get_owner_const(), stringbuffer_append_printf(), and stringbuffer_append_string().
Referenced by animate_object(), command_dump(), do_dump(), dump_arch(), gate_type_process(), object_dump_all(), object_free(), object_insert_in_map(), object_insert_in_ob(), object_remove(), and process_events().
void object_dump_all | ( | void | ) |
Dumps all objects to console.
This is really verbose...Can be triggered by the dumpallobjects command while in DM mode.
All objects are dumped to stderr (or alternate logfile, if in server-mode)
Definition at line 704 of file object.cpp.
References object::count, llevDebug, LOG(), object::next, object_dump(), objects, stringbuffer_finish(), and stringbuffer_new().
Referenced by command_dumpallobjects().
Find object in inventory by archetype name.
who | where to search. |
name | what to search. |
Definition at line 4252 of file object.cpp.
References object::arch, object::below, object::inv, name, and archetype::name.
Referenced by annotate_ob(), cfapi_object_find_by_arch_name(), converter_type_apply(), dialog_preparse(), and dragon_ability_gain().
Find object in inventory by flag.
who | where to search. |
flag | what to search. |
Definition at line 4206 of file object.cpp.
References object::below, object::inv, and QUERY_FLAG.
Referenced by use_alchemy().
Find applied object in inventory by flag.
who | where to search. |
flag | what to search. |
Definition at line 4229 of file object.cpp.
References object::below, FLAG_APPLIED, object::inv, and QUERY_FLAG.
Referenced by save_life().
Finds an object in inventory name.
who | the object to search |
name | name to search for |
Definition at line 3956 of file object.cpp.
References add_string(), object::below, free_string(), object::inv, name, and object::name.
Referenced by apply_changes_to_player(), apply_race_and_class(), cfapi_object_find_by_name(), check_login(), key_change_class(), and move_detector().
object* object_find_by_name_global | ( | const char * | str | ) |
Finds an object by name.
Used only by the patch command, but not all that useful. Enables features like "patch name-of-other-player food 999"
str | name to search for. Must not be allocated by add_string(). |
Definition at line 747 of file object.cpp.
References add_string(), free_string(), name, object::name, object::next, and objects.
Referenced by command_possess(), and find_object_both().
Find object in inventory.
who | where to search. |
tag | what to search. |
Definition at line 4060 of file object.cpp.
References object::below, object::count, and object::inv.
Referenced by command_cast_spell().
Returns the object which has the count-variable equal to the argument.
i | tag. |
Definition at line 727 of file object.cpp.
References object::count, object::next, and objects.
Referenced by cftimer_process_event(), command_diff(), command_insert_into(), command_inventory(), command_possess(), command_stack_list(), dm_stack_peek(), find_object_both(), and get_dm_object().
Find object in inventory.
who | where to search. |
type | what to search. |
Definition at line 3980 of file object.cpp.
References object::below, object::inv, is_valid_types_gen::type, and object::type.
Referenced by fire_bow(), has_ability(), and transport_type_apply().
Find object in inventory.
who | where to search. |
type1 | what to search. |
type2 | what to search. |
Definition at line 4037 of file object.cpp.
References object::below, object::inv, and object::type.
Referenced by dispel_rune(), and hit_player().
Find object in inventory by type and archetype name.
who | where to search. |
type | what to search. |
name | what to search. |
Definition at line 4277 of file object.cpp.
References object::arch, object::below, object::inv, name, archetype::name, is_valid_types_gen::type, and object::type.
Referenced by check_login(), command_resistances(), dragon_eat_flesh(), dragon_focus_type_apply(), dragon_level_gain(), and perceive_self().
Find object in inventory by type and name.
who | where to search. |
type | what to search. |
name | what to search |
Definition at line 4108 of file object.cpp.
References object::below, object::inv, name, object::name, is_valid_types_gen::type, and object::type.
Referenced by check_probe(), check_spell_known(), describe_monster(), do_symptoms(), examine_monster(), find_symptom(), grant_immunity(), and infect_object().
Find object in inventory by type and race.
who | where to search. |
type | what to search. |
race | what to search |
Definition at line 4133 of file object.cpp.
References object::below, object::inv, object::race, is_valid_types_gen::type, and object::type.
Referenced by monster_check_apply().
Find object in inventory by type and skill.
who | where to search. |
type | what to search. |
skill | what to search |
Definition at line 4183 of file object.cpp.
References object::below, object::inv, object::skill, skill, is_valid_types_gen::type, and object::type.
Referenced by do_skill().
Find object in inventory by type and slaying.
who | where to search. |
type | what to search. |
slaying | what to search |
Definition at line 4158 of file object.cpp.
References object::below, object::inv, object::slaying, is_valid_types_gen::type, and object::type.
Referenced by attempt_recipe(), enter_exit(), find_force(), find_key(), move_detector(), and op_on_battleground().
Find applied object in inventory.
who | where to search. |
type | what to search. |
Definition at line 4083 of file object.cpp.
References object::below, FLAG_APPLIED, object::inv, QUERY_FLAG, is_valid_types_gen::type, and object::type.
Referenced by apply_can_apply_object(), attack_hth(), cast_create_missile(), do_skill_attack(), god_enchants_weapon(), monster_check_good_armour(), and monster_check_good_weapon().
Find object in inventory.
who | where to search. |
type | |
subtype | what to search. |
Definition at line 4301 of file object.cpp.
References object::below, object::inv, object::subtype, is_valid_types_gen::type, and object::type.
Referenced by become_follower(), cast_word_of_recall(), cftimer_create(), deep_swamp_type_process(), determine_god(), do_hidden_move(), eventListener(), god_examines_priest(), and monster_can_pick().
object* object_find_by_type_without_flags | ( | const object * | who, |
int | type, | ||
int * | flags, | ||
int | num_flags | ||
) |
Find an object in inventory that does not have any of the provided flags set.
who | where to search. |
type | what to search. |
flags | Array of integers corresponding to the set of flags that cannot have any set on the found item. |
num_flags | The size of the array flags above |
Definition at line 4004 of file object.cpp.
References object::below, flags, object::inv, QUERY_FLAG, and is_valid_types_gen::type.
Referenced by find_key().
object_find_first_free_spot(archetype, mapstruct, x, y) works like object_find_free_spot(), but it will search max number of squares.
It will return the first available spot, not a random choice. Changed 0.93.2: Have it return -1 if there is no free spot available.
ob | object to insert. |
m | |
x | |
y | where to insert the object. |
Definition at line 3599 of file object.cpp.
References freearr_x, freearr_y, m, ob_blocked(), and SIZEOFFREE.
Referenced by find_enclosed_spot(), keyplace(), object_teleport(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), polymorph_living(), put_a_monster(), and transfer_ob().
object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coordinates which will be able to contain the given object.
It returns a random choice among the alternatives found.
ob | object to insert. |
m | |
x | |
y | where to insert the object. |
start | |
stop | first (inclusive) and last (exclusive) positions, in the freearr_ arrays, to search. |
Definition at line 3559 of file object.cpp.
References AB_NO_PASS, freearr_x, freearr_y, m, maxfree, ob_blocked(), RANDOM, and SIZEOFFREE.
Referenced by animate_weapon(), cfapi_object_insert(), command_summon(), command_teleport(), do_follow(), do_harvest(), enter_map(), gate_type_process(), mimic_type_apply(), object_insert_to_free_spot_or_free(), pets_follow_owner(), pets_summon_golem(), pets_summon_object(), shop_mat_type_move_on(), teleport(), and transfer_ob().
int object_find_multi_free_spot_around | ( | const object * | ob, |
const object * | gen, | ||
int16_t * | hx, | ||
int16_t * | hy | ||
) |
Sets hx and hy to the coords to insert a possibly multi-tile ob at, around gen.
ob | object to insert. Must not be NULL. | |
gen | where to insert. Must not be NULL. | |
[out] | hx | |
[out] | hy | coordinates at which insertion is possible. |
Definition at line 3296 of file object.cpp.
References HEAD, object::map, MAP_HEIGHT, MAP_WIDTH, ob_blocked(), object_get_multi_size(), RANDOM, object::x, and object::y.
Referenced by change_object().
int object_find_multi_free_spot_within_radius | ( | const object * | ob, |
const object * | gen, | ||
int * | hx, | ||
int * | hy | ||
) |
Sets hx and hy to the coords to insert a possibly multi-tile ob at, within radius of generator, which is stored in key_value "generator_radius".
Radius defaults to 1.
ob | object to insert. Must not be NULL. | |
gen | where to insert. Must not be NULL. | |
[out] | hx | |
[out] | hy | coordinates at which insertion is possible. |
Definition at line 3412 of file object.cpp.
References get_map_flags(), HEAD, object::map, ob_blocked(), object_get_multi_size(), object_get_value(), P_OUT_OF_MAP, RANDOM, object::x, and object::y.
Referenced by generate_monster_arch(), and generate_monster_inv().
void object_fix_multipart | ( | object * | tmp | ) |
Ensures specified object has its more parts correctly inserted in map.
Extracted from common/map.c:link_multipart_objects
tmp | object we want to fix. Must be on a map. |
Definition at line 4685 of file object.cpp.
References add_string(), object::arch, arch_to_object(), free_string(), object::head, INS_ABOVE_FLOOR_ONLY, INS_NO_MERGE, INS_NO_WALK_ON, llevError, LOG(), object::map, object::more, archetype::more, object::name, object_insert_in_map(), object::title, object::x, and object::y.
Referenced by change_object(), generate_monster_inv(), link_multipart_objects(), and object_handle_death_animation().
void object_free | ( | object * | ob, |
int | flags | ||
) |
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
The IS_FREED() flag is set in the object.
The object must have been removed by object_remove() first for this function to succeed.
ob | object to free. Will become invalid when function returns. |
flags | the flags; see FREE_OBJ_xxx constants. |
Definition at line 1592 of file object.cpp.
References object::anim_suffix, object::arch, object::artifact, object::count, EVENT_DESTROY, events_execute_object_event(), FLAG_ALIVE, FLAG_FREED, FLAG_FRIENDLY, FLAG_IS_A_TEMPLATE, FLAG_NO_DROP, FLAG_REMOVED, FLAG_STARTEQUIP, flags, FOR_INV_FINISH, FOR_INV_PREPARE, FREE_AND_CLEAR, FREE_AND_CLEAR_STR, FREE_AND_CLEAR_STR_IF, free_arch(), free_dialog_information(), FREE_OBJ_DROP_ABOVE_FLOOR, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, free_objects, GET_MAP_MOVE_BLOCK, mapstruct::in_memory, INS_ABOVE_FLOOR_ONLY, object::inv, llevError, llevMonster, LOG(), object::lore, object::map, MAP_IN_MEMORY, object::materialname, object::more, MOVE_ALL, object::msg, object::name, object::name_pl, object::next, nroffreeobjects, object_dump(), object_free(), object_free_drop_inventory(), object_free_key_values(), object_insert_in_map_at(), object_insert_to_free_spot_or_free(), object_remove(), object_update_speed(), objects, object::prev, QUERY_FLAG, object::race, RANDOM, archetype::reference_count, remove_friendly_object(), RUNE, SCRIPT_FIX_NOTHING, SET_FLAG, SIZEOFFREE, object::skill, object::slaying, object::speed, object::spell_tags, stringbuffer_finish(), stringbuffer_new(), object::title, TRAP, object::x, and object::y.
Referenced by add_one_item(), alchemy_object(), apply_auto(), apply_by_living(), apply_race_and_class(), cast_create_missile(), cast_create_town_portal(), cfapi_object_insert(), clear_player(), command_create(), command_learn_spell_or_prayer(), command_reset(), command_summon(), command_teleport(), counterspell(), do_execute_event(), do_forget_spell(), do_goto(), do_harvest(), do_single_item(), enter_exit(), enter_player_savebed(), eventListener(), free_all_objects(), free_no_drop(), god_gives_present(), move_aura(), object_free(), object_free_drop_inventory(), object_free_inventory(), object_insert_in_map(), object_insert_in_ob(), object_merge(), object_split(), peacemaker_type_process(), player_arrest(), polymorph_item(), polymorph_living(), polymorph_melt(), process_events(), process_object(), recharge(), recipe_get_face(), save_object_in_sb(), scroll_failure(), stop_projectile(), town_portal_destroy_existing(), town_portal_find_force(), and write_scroll().
void object_free_all_data | ( | void | ) |
Destroys all allocated objects.
Definition at line 767 of file object.cpp.
References FLAG_FREED, free_objects, llevDebug, LOG(), object::name, object::next, nrofallocobjects, nroffreeobjects, objects, QUERY_FLAG, and STARTMAX.
Referenced by cleanup().
void object_free_drop_inventory | ( | 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.
The IS_FREED() flag is set in the object. The object must have been removed by object_remove() first for this function to succeed.
Inventory will be dropped on the ground if in a map, else freed too.
ob | object to free. Will become invalid when function returns. |
Definition at line 1560 of file object.cpp.
References object_free().
Referenced by add_abilities(), add_npc_to_point(), add_npc_to_zone(), adjust_sign_msg(), alchemy_failure_effect(), apply_auto(), apply_builder_floor(), apply_builder_item(), apply_builder_remove(), apply_builder_wall(), apply_builder_window(), arrow_type_process(), artifact_describe(), become_follower(), blindness_type_process(), cast_cause_disease(), cast_dust(), cast_raise_dead_spell(), cast_smite_spell(), cfapi_object_delete(), cfapi_object_insert(), change_book(), change_object(), check_bullet(), clean_object(), command_cast_spell(), command_free(), command_kill_pets(), common_process_projectile(), cure_disease(), decay_objects(), delete_unique_items(), destroy_object(), dispel_rune(), do_item_conversion(), do_turn(), drop(), drop_object(), eat_special_food(), enter_map(), eventListener(), execute_word_of_recall(), explode_bullet(), explosion(), fire_arch_from_position(), fire_bolt(), fire_bow(), fix_generated_item(), fix_stopped_arrow(), fix_walls(), follower_remove_given_items(), free_player(), generate_monster(), generate_treasure(), give_initial_items(), god_intervention(), hit_player(), hit_with_arrow(), insert_objects(), key_change_class(), kill_object(), kill_player_permadeath(), load_objects(), locate_recipe_artifact(), lock_and_hide_doors(), loot_object(), monster_move(), monster_move_no_enemy(), move_aura(), move_bolt(), move_bullet(), move_cone(), move_creator(), move_disease(), move_duplicator(), move_marker(), move_player_mover(), move_swarm_spell(), move_symptom(), move_teleporter(), nuke_map_region(), object_decrease_nrof(), object_free(), object_insert_to_free_spot_or_free(), object_merge_spell(), object_replace_insert_in_map(), pay_from_container(), pets_attempt_follow(), pets_move(), pets_move_golem(), pets_summon_golem(), pets_terminate_all(), pick_up_object(), place_chest(), place_exits(), place_fountain_with_specials(), poisoning_type_process(), prayer_failure(), print_monsters(), receive_play_again(), remove_adjacent_doors(), remove_contents(), remove_depletion(), remove_door(), remove_force(), remove_locked_door(), remove_marking_runes(), remove_monsters(), remove_special_prayers(), remove_symptoms(), remove_unpaid_objects(), restore_player(), retrofit_joined_wall(), rune_attack(), save_life(), save_throw_object(), spell_effect_type_move_on(), spell_failure(), spring_trap(), stop_item(), stop_projectile(), tailor_god_spell(), tear_down_wall(), and thrown_object_type_process().
void object_free_inventory | ( | object * | ob | ) |
Frees the inventory of an object, without any callback.
ob | object to free the inventory of. |
Definition at line 1568 of file object.cpp.
References FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, object::inv, object_free(), and object_remove().
Referenced by asset_destroy(), Archetypes::recursive_update(), and Archetypes::replace().
void object_free_key_values | ( | object * | op | ) |
Zero the key_values on op, decrementing the shared-string refcounts and freeing the links.
op | object to clear. |
Definition at line 954 of file object.cpp.
References FREE_AND_CLEAR_STR, key_value::key, object::key_values, key_value::next, and key_value::value.
Referenced by free_arch(), free_artifact(), object_clear(), object_copy_no_speed(), and object_free().
Utility function.
op | object we want the environment of. Can't be NULL. |
Definition at line 590 of file object.cpp.
References object::env.
Referenced by animate_bomb(), cfapi_object_set_property(), do_execute_event(), explode_bullet(), and spring_trap().
Search for a field by key.
ob | object where search |
key | key to search. Must be a passed in shared string - otherwise, this won't do the desired thing. |
Definition at line 4321 of file object.cpp.
References key_value::key, object::key_values, and key_value::next.
Referenced by compare_ob_value_lists_one(), get_ob_diff(), object_set_value_s(), and process_object().
void object_get_multi_size | ( | const object * | ob, |
int * | sx, | ||
int * | sy, | ||
int * | hx, | ||
int * | hy | ||
) |
Computes the size of a multitile object.
ob | object we compute the size of. | |
[out] | sx | |
[out] | sy | will contain the coords of the bottom right tail relative to the head. Must not be NULL. |
[out] | hx | |
[out] | hy | will contain the coords of the head tile relative to the top left tile. Can be NULL. |
Definition at line 4744 of file object.cpp.
References object::arch, archetype::clone, HEAD, archetype::more, object::x, and object::y.
Referenced by object_find_multi_free_spot_around(), object_find_multi_free_spot_within_radius(), object_on_exit(), process_map(), and update_transport_block().
Returns the object which this object marks as being the owner.
A 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.
op | item to search owner of. |
Definition at line 804 of file object.cpp.
References object::count, FLAG_FREED, FLAG_REMOVED, object_clear_owner(), object::owner, object::ownercount, and QUERY_FLAG.
Referenced by adj_attackroll(), attack_message(), attack_ob_simple(), blame(), blind_living(), cast_spell(), cfapi_object_get_property(), change_object(), command_kill_pets(), common_process_projectile(), common_projectile_move_on(), cone_drop(), counterspell(), do_mood_floor(), do_symptoms(), explode_bullet(), find_target_for_friendly_spell(), find_traps(), fire_arch_from_position(), fix_summon_pet(), friendly_fire(), get_real_owner(), hit_player(), hit_with_drain(), hit_with_one_attacktype(), infect_object(), is_enemy(), kill_object(), monster_cast_spell(), monster_check_enemy(), monster_move(), monster_use_bow(), monster_use_range(), monster_use_scroll(), monster_use_skill(), move_ball_spell(), move_missile(), move_player_attack(), move_swarm_spell(), object_copy_owner(), object_set_owner(), peacemaker_type_process(), pets_attempt_follow(), pets_get_enemy(), pets_move(), pets_move_golem(), pets_summon_golem(), pets_summon_object(), poison_living(), polymorph_living(), push_ob(), remove_trap(), save_object_in_sb(), save_objects(), scare_creature(), steal(), tailor_god_spell(), trap_disarm(), and use_oratory().
Returns the object which this object marks as being the owner, constant version.
Mostly written for object_dump, which takes a const object.
op | item to search owner of. |
Definition at line 624 of file object.cpp.
References object::count, FLAG_FREED, FLAG_REMOVED, llevError, LOG(), object::owner, object::ownercount, and QUERY_FLAG.
Referenced by object_dump().
Finds the player carrying an object.
op | item for which we want the carrier (player). |
Definition at line 607 of file object.cpp.
References object::env, PLAYER, and object::type.
Referenced by cfapi_object_set_property(), do_light(), drain_wand_charge(), identify(), lamp_type_apply(), object_decrease_nrof(), object_increase_nrof(), object_insert_in_ob(), object_remove(), pick_up_object(), remove_force(), and send_changed_object().
const char* object_get_value | ( | const object * | op, |
const char *const | key | ||
) |
Get an extra value by key.
op | object we're considering |
key | key of which to retrieve the value. Doesn't need to be a shared string. |
Definition at line 4346 of file object.cpp.
References find_string(), key_value::key, object::key_values, key_value::next, and key_value::value.
Referenced by add_abilities(), add_object_to_socklist(), adjust_sign_msg(), append_spell(), apply_check_personalized_blessings(), apply_check_race_restrictions(), apply_handle_yield(), calculate_difficulty(), cfapi_object_get_key(), cfapi_object_get_property(), change_book(), check_spell_expiry(), command_cast_spell(), command_rename_item(), create_player_cmd(), do_harvest(), do_monster(), esrv_add_spells(), esrv_update_item(), eventListener(), examine(), fix_player(), follower_remove_given_items(), generate_monster(), generate_monster_arch(), generate_monster_inv(), god_enchants_weapon(), knowledge_monster_validate(), knowledge_read(), monster_move_randomly(), monster_npc_call_help(), mood_change(), move_aura(), object_find_multi_free_spot_within_radius(), object_give_identified_properties(), object_handle_death_animation(), object_matches_string(), object_try_get_value(), object_value_set(), price_base(), send_arch_info(), set_object_face_main(), set_object_face_other(), shop_price_buy(), shop_price_sell(), SP_level_wc_adjust(), spell_consume_items(), and transport_type_apply().
void object_handle_death_animation | ( | object * | op | ) |
Definition at line 5410 of file object.cpp.
References object::arch, create_archetype(), object::map, archetype::more, object_fix_multipart(), object_get_value(), object_insert_in_map_at(), sstring, object::x, and object::y.
Referenced by generate_monster(), and kill_object().
|
static |
Increase the count of an object.
This function will send an update to client if needed.
op | object to increase. |
i | number to add. |
Definition at line 2763 of file object.cpp.
References object::container, object::env, esrv_update_item(), first_player, FLAG_REMOVED, FOR_MAP_FINISH, FOR_MAP_PREPARE, object::map, player::next, object::nrof, player::ob, object_add_weight(), object_get_player_container(), object_sub_weight(), QUERY_FLAG, UPD_NROF, object::weight, object::x, and object::y.
Referenced by object_insert_in_ob(), and object_merge().
This function inserts the object in the two-way linked list which represents what is on a map.
It will update player count if the op is a player.
Player ground window will be updated if needed.
op | object to insert. Must be removed. Its coordinates must be valid for the map. |
m | map to insert into. Must not be NULL. |
originator | player, monster or other object that caused 'op' to be inserted into 'm'. May be NULL. |
flag | bitmask about special things to do (or not do) when this function is called. See the object.h file for the INS_xxx values. Passing 0 for flag gives proper default values, so flag really only needs to be set if special handling is needed. |
Definition at line 2361 of file object.cpp.
References object::above, object::below, CLEAR_FLAG, object::contr, player::do_los, find_insert_pos(), FLAG_ALIVE, FLAG_APPLIED, FLAG_FREED, FLAG_INV_LOCKED, FLAG_NO_STEAL, FLAG_REMOVED, floor, FOR_MAP_FINISH, FOR_MAP_PREPARE, FOR_OB_AND_ABOVE_FINISH, FOR_OB_AND_ABOVE_PREPARE, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, get_map_from_coord(), GET_MAP_OB, object::glow_radius, object::head, player::hidden, INS_BELOW_ORIGINATOR, INS_MAP_LOAD, INS_NO_MERGE, INS_NO_WALK_ON, LAMP, llevError, LOG(), m, object::map, MAP_DARKNESS, object::more, object::nrof, object_can_merge(), object_check_move_on(), object_dump(), object_free(), object_insert_in_map(), object_merge_spell(), object_remove(), object_update(), object::other_arch, out_of_map(), OUT_OF_REAL_MAP, object::ox, object::oy, PLAYER, mapstruct::players, QUERY_FLAG, object::range, SET_MAP_OB, SET_MAP_TOP, player::socket, object::speed, object::speed_left, SPELL_EFFECT, stringbuffer_finish(), stringbuffer_new(), player::transport, object::type, UP_OBJ_INSERT, update_all_los(), socket_struct::update_look, object::x, and object::y.
Referenced by change_object(), fix_stopped_item(), object_fix_multipart(), object_insert_in_map(), object_insert_in_map_at(), and pick_up().
object* object_insert_in_map_at | ( | object * | op, |
mapstruct * | m, | ||
object * | originator, | ||
int | flag, | ||
int | x, | ||
int | y | ||
) |
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing multi-part monsters.
op | object to insert. |
m | map to insert into. |
originator | what caused op to be inserted. |
flag | Combination of INS_xxx values. |
x | |
y | coordinates to insert at. |
Definition at line 2100 of file object.cpp.
References object::arch, archetype::clone, HEAD, m, object::map, object::more, object_insert_in_map(), object::x, and object::y.
Referenced by alchemy_failure_effect(), animate_bomb(), animate_weapon(), apply_auto(), apply_builder_floor(), apply_builder_item(), apply_builder_wall(), apply_builder_window(), apply_container(), apply_handle_yield(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_cone(), cast_consecrate(), cast_create_obj(), cast_create_town_portal(), cast_curse(), cast_destruction(), cast_detection(), cast_heal(), cast_light(), cast_magic_storm(), cast_polymorph(), cast_raise_dead_spell(), cast_smite_spell(), cfapi_object_insert(), cfapi_object_transfer(), charge_mana_effect(), command_create(), command_reset(), common_process_projectile(), cone_drop(), convert_item(), converter_type_apply(), converter_type_move_on(), create_bomb(), dimension_door(), do_follow(), do_harvest(), do_throw(), drop_object(), eat_special_food(), enter_map(), explode_bullet(), explosion(), fire_arch_from_position(), fire_bolt(), fire_bow(), fire_swarm(), fix_walls(), forklightning(), gate_type_process(), generate_monster_arch(), generate_monster_inv(), hit_with_arrow(), identify_object_with_skill(), include_map_in_map(), key_change_class(), keyplace(), kill_player(), kill_player_not_permadeath(), kill_player_permadeath(), load_objects(), lock_and_hide_doors(), loot_object(), magic_wall(), make_map_floor(), make_map_walls(), mimic_type_apply(), mood_change(), move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_cone(), move_creator(), move_ob(), move_symptom(), object_free(), object_handle_death_animation(), object_insert_to_free_spot_or_free(), object_replace_insert_in_map(), object_teleport(), pets_follow_owner(), pets_summon_golem(), pets_summon_object(), pick_up_object(), place_alchemy_objects(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), polymorph_item(), polymorph_living(), potion_type_apply(), push_ob(), put_a_monster(), put_decor(), put_doors(), put_floor(), put_in_icecube(), put_object_in_sack(), put_treasure(), recharge(), remove_door(), remove_force(), remove_locked_door(), remove_unpaid_objects(), retrofit_joined_wall(), roll_ob(), save_throw_object(), shop_mat_type_move_on(), spell_effect(), spell_failure(), spring_trap(), stop_jump(), stop_projectile(), surround_by_doors(), teleport(), transfer_ob(), transport_type_apply(), trap_show(), treasure_type_apply(), turn_one_transport(), write_mark(), and write_rune().
This function inserts the object op in the linked list inside the object environment.
It will send to client where is a player.
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. |
Definition at line 2857 of file object.cpp.
References above, object::above, object::arch, object::below, BITMASK_EVENT, object::carrying, CLEAR_FLAG, CONTAINER, object::contr, object::count, object::env, esrv_send_item(), object::event_bitmask, EVENT_CONNECTOR, living::exp, fix_object(), FLAG_APPLIED, FLAG_NO_FIX_PLAYER, FLAG_OBJ_ORIGINAL, FLAG_REMOVED, FOR_ABOVE_FINISH, FOR_ABOVE_PREPARE, FOR_INV_FINISH, FOR_INV_PREPARE, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, object::glow_radius, object::head, HEAD, object::inv, llevDebug, llevError, LOG(), object::map, MAP_DARKNESS, object::more, object::name, archetype::name, object::nrof, object_add_weight(), object_can_merge(), object_dump(), object_free(), object_get_player_container(), object_increase_nrof(), object::ox, object::oy, P_NEED_UPDATE, QUERY_FLAG, SET_FLAG, SET_MAP_FLAGS, SKILL, object::skill, object::stats, stringbuffer_finish(), stringbuffer_new(), object::subtype, object::total_exp, object::type, update_all_los(), update_position(), object::weight, object::x, and object::y.
Referenced by add_abilities(), add_force(), alchemy_failure_effect(), animate_weapon(), apply_auto(), apply_container(), apply_handle_yield(), apply_special(), attempt_recipe(), blind_living(), cast_bless(), cast_change_ability(), cast_create_town_portal(), cast_curse(), cast_word_of_recall(), cfapi_object_insert(), change_luck(), change_object(), check_loaded_object(), command_create(), command_insert_into(), command_use(), confuse_living(), converter_type_apply(), create_aura(), create_player_cmd(), dialog_preparse(), do_harvest(), do_learn_spell(), do_symptoms(), do_throw(), do_turn(), dragon_ability_gain(), drain_specific_stat(), eat_special_food(), examine_monster(), find_or_create_connection_for_map(), fix_generated_item(), get_npc(), give_skill_by_name(), god_gives_present(), grant_immunity(), hit_with_arrow(), identify_object_with_skill(), improve_armour(), infect_object(), insert_objects(), keyplace(), kill_player_not_permadeath(), lamp_type_apply(), lighter_type_apply(), magic_wall(), make_object_glow(), make_throw_ob(), mimic_type_apply(), monster_check_pickup(), move_aura(), msgfile_msg(), object_copy_with_inv(), object_create_clone(), pick_up_object(), place_chest(), poison_living(), potion_type_apply(), put_in_icecube(), put_object_in_sack(), put_treasure(), remove_force(), save_throw_object(), sell_item(), slow_living_by(), stick_arrow(), swap_random_stats(), town_portal_find_force(), transmute_item_to_flower(), transport_type_apply(), while(), write_note(), write_rune(), and write_scroll().
void object_insert_to_free_spot_or_free | ( | object * | op, |
mapstruct * | map, | ||
int | x, | ||
int | y, | ||
int | start, | ||
int | stop, | ||
object * | originator | ||
) |
Inserts an object into its map.
The object is inserted into a free spot (as returned by object_find_free_spot()). If no free spot can be found, the object is freed.
op | the object to insert or free |
map | the map to insert into |
x | the x-coordinate to insert into |
y | the y-coordinate to insert into |
start | first (inclusive) position in the freearr_ arrays to search |
stop | last (exclusive) position in the freearr_ arrays to search |
originator | what caused op to be inserted. |
Definition at line 4791 of file object.cpp.
References freearr_x, freearr_y, object_find_free_spot(), object_free_drop_inventory(), and object_insert_in_map_at().
Referenced by change_object(), and object_free().
This is a subset of the parse_id command.
Basically, name can be a string separated lists of things to match, with certain keywords. pl is the player (only needed to set count properly) op is the item we are trying to match. Calling function takes care of what action might need to be done and if it is valid (pickup, drop, etc.) Return NONZERO if we have a match. A higher value means a better match. 0 means no match.
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.
Details on values output (highest is output):
nothing 0 'all' 1 'unpaid' 2 'cursed' 2 'unlocked' 2 partial custom name 3 op->name with count >1 4 op->name with count <2 6 op->name_pl with count >1 6 inside base name 12 inside short name 12 begin of base name 14 custom name 15 base name 16 short name 18 full name 20 (note, count is extracted from begin of name parameter or from pl->contr->count, name has priority)
pl | object we're searching an item for. Must not be NULL. |
op | object we're considering. Must not be NULL. |
name | string we're searching. |
Definition at line 4574 of file object.cpp.
References object::contr, player::count, CUSTOM_NAME_FIELD, FLAG_CURSED, FLAG_DAMNED, FLAG_INV_LOCKED, FLAG_KNOWN_CURSED, FLAG_UNPAID, HUGE_BUF, MAX_BUF, name, object::name, object::name_pl, object_get_value(), PLAYER, query_base_name(), QUERY_FLAG, query_name(), query_short_name(), safe_strncpy, sstring, strcasecmp(), and object::type.
Referenced by check_pick(), find_best_apply_object_match(), matcher_name(), and write_rune().
This function goes through all objects below and including top, and merges op to the first matching object.
Will correctly send updated objects to client if needed.
op | object to merge. |
top | from which item to merge. If NULL, it is calculated. |
Definition at line 2051 of file object.cpp.
References object::above, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, object::nrof, object_can_merge(), object_free(), object_increase_nrof(), and object_remove().
Referenced by cfapi_object_merge(), command_lock_item(), command_rename_item(), fix_stopped_item(), hit_with_arrow(), identify(), identify_object_with_skill(), lock_item_cmd(), shop_pay_unpaid_callback(), stop_projectile(), and unapply_special().
void object_merge_spell | ( | object * | op, |
int16_t | x, | ||
int16_t | y | ||
) |
This sees if there are any objects on the space that can merge with op.
Note that op does not need to actually be inserted on the map (when called from object_insert_in_map, it won't be), but op->map should be set correctly.
Note that even if we find a match on the space, we keep progressing looking for more. This is because op->range is set to 0 in explosion, so what may not have been mergable now is.
op | object to try to merge into. |
x | |
y | coordinates to look at for merging. |
Definition at line 2129 of file object.cpp.
References object::attacktype, living::dam, object::direction, object::duration, FOR_MAP_FINISH, FOR_MAP_PREPARE, FREE_AND_CLEAR, object::level, llevError, LOG(), object::map, MAX, living::maxhp, OB_SPELL_TAG_HASH, OB_SPELL_TAG_MATCH, object_free_drop_inventory(), object_remove(), object::owner, object::ownercount, object::range, object::speed, object::speed_left, Statistics::spell_hash_full, Statistics::spell_merges, SPELL_TAG_SIZE, object::spell_tags, statistics, object::stats, object::subtype, object::type, and living::wc.
Referenced by explosion(), and object_insert_in_map().
object* object_new | ( | void | ) |
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
If there are no free objects, expand_objects() is called to get more.
Definition at line 1273 of file object.cpp.
References object::active_next, object::active_prev, BITMASK_VALID, object::count, object::event_bitmask, expand_objects(), fatal(), FLAG_FREED, FLAG_REMOVED, free_objects, llevError, LOG(), object::lore, object::materialname, object::msg, object::name, object::name_pl, object::next, nroffreeobjects, ob_count, object_clear(), objects, OUT_OF_MEMORY, object::prev, QUERY_FLAG, object::race, SET_FLAG, object::skill, object::slaying, object::spell_tags, and object::title.
Referenced by add_abilities(), arch_to_object(), artifact_describe(), cast_create_food(), cfapi_object_clone(), cfapi_object_create(), command_reset(), command_summon(), command_teleport(), create_singularity(), do_goto(), do_learn_spell(), enter_exit(), enter_player_savebed(), explosion(), forklightning(), generate_treasure(), get_jail_exit(), infect_object(), key_change_class(), load_objects(), magic_wall(), make_throw_ob(), move_bolt(), move_cone(), object_copy_with_inv(), object_create_clone(), pay_from_container(), place_chest(), place_fountain_with_specials(), place_special_exit(), polymorph_item(), sell_item(), while(), write_note(), write_rune(), and write_scroll().
Searches for any objects with a matching type variable in the inventory of the given object.
type | type to search for. |
op | object to search into. |
Definition at line 3168 of file object.cpp.
References object::below, object::inv, is_valid_types_gen::type, and object::type.
Referenced by blind_living(), cfapi_object_get_property(), check_probe(), and examine_monster().
Searches for any objects with a matching type & name variable in the inventory of the given object.
This is mostly used by spell effect code, so that we only have one spell effect at a time. type can be used to narrow the search - if type is set, the type must also match. -1 can be passed for the type, in which case the type does not need to pass. str is the string to match against. Note that we match against the object name, not the archetype name. this is so that the spell code can use one object type (force), but change it's name to be unique.
type | object type to search for. -1 means to ignore it. |
str | object name to search for. |
op | where to search. |
Definition at line 3203 of file object.cpp.
References object::below, object::inv, object::name, is_valid_types_gen::type, and object::type.
Referenced by apply_changes_to_player(), become_follower(), cast_heal(), cfapi_object_get_property(), confuse_living(), and create_aura().
void object_remove | ( | 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.
Will inform the client of the removal if needed.
op | object to remove. Must not be removed yet, else abort() is called. |
Definition at line 1833 of file object.cpp.
References above, object::above, object::below, object::carrying, CLEAR_FLAG, CONTAINER, object::contr, object::count, object::env, esrv_del_item(), esrv_update_item(), object::event_bitmask, EVENT_CONNECTOR, fix_object(), FLAG_APPLIED, FLAG_BLOCKSVIEW, FLAG_NO_APPLY, FLAG_NO_FIX_PLAYER, FLAG_REMOVED, FOR_MAP_FINISH, FOR_MAP_PREPARE, get_map_from_coord(), GET_MAP_OB, object::glow_radius, object::head, player::hidden, mapstruct::in_memory, object::inv, llevError, LOG(), LOOK_OBJ, m, object::map, MAP_SAVING, object::more, object::move_type, object::nrof, ob_move_on(), object_dump(), object_get_player_container(), object_remove(), object_sub_weight(), object_update(), object_was_destroyed, object::ox, object::oy, P_NEED_UPDATE, mapstruct::path, PLAYER, mapstruct::players, QUERY_FLAG, SET_FLAG, SET_MAP_FLAGS, SET_MAP_OB, SET_MAP_TOP, stringbuffer_finish(), stringbuffer_new(), object::type, UP_OBJ_REMOVE, UPD_FLAGS, update_all_los(), update_position(), object::weight, object::x, and object::y.
Referenced by add_abilities(), adjust_sign_msg(), alchemy_object(), animate_bomb(), animate_weapon(), apply_auto(), apply_builder_floor(), apply_builder_item(), apply_builder_remove(), apply_builder_wall(), apply_builder_window(), apply_by_living(), apply_race_and_class(), apply_savebed(), arrow_type_process(), attempt_jump(), become_follower(), blindness_type_process(), cast_consecrate(), cast_create_town_portal(), cast_dust(), cast_raise_dead_spell(), cfapi_object_insert(), cfapi_object_remove(), change_object(), check_altar_sacrifice(), check_bullet(), check_login(), clean_object(), command_cast_spell(), command_free(), command_insert_into(), command_kill_pets(), command_remove(), command_reset(), common_process_projectile(), counterspell(), create_player_cmd(), cure_disease(), decay_objects(), delete_unique_items(), destroy_object(), dimension_door(), dispel_rune(), do_execute_event(), do_follow(), do_forget_spell(), do_harvest(), do_item_conversion(), do_throw(), do_turn(), drop(), drop_object(), enter_exit(), enter_map(), eventListener(), execute_word_of_recall(), explode_bullet(), explosion(), fire_bow(), fix_generated_item(), fix_stopped_arrow(), fix_walls(), follower_remove_given_items(), free_all_objects(), free_no_drop(), free_player(), gate_type_process(), generate_monster(), generate_treasure(), give_initial_items(), hit_player(), hit_with_arrow(), key_change_class(), key_confirm_quit(), kill_object(), kill_player_permadeath(), leave(), lock_and_hide_doors(), loot_object(), mimic_type_apply(), monster_move(), monster_move_no_enemy(), move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_cone(), move_disease(), move_duplicator(), move_marker(), move_ob(), move_player_mover(), move_swarm_spell(), move_symptom(), move_teleporter(), nuke_map_region(), object_decrease_nrof(), object_free(), object_free_inventory(), object_insert_in_map(), object_merge(), object_merge_spell(), object_remove(), object_replace_insert_in_map(), object_split(), object_teleport(), pay_from_container(), peacemaker_type_process(), pets_follow_owner(), pets_move(), pets_move_golem(), pets_summon_golem(), pets_terminate_all(), pick_up_object(), place_exits(), play_again(), poisoning_type_process(), polymorph_item(), polymorph_living(), polymorph_melt(), process_object(), push_ob(), put_in_icecube(), put_object_in_sack(), recharge(), remove_adjacent_doors(), remove_contents(), remove_depletion(), remove_door(), remove_force(), remove_locked_door(), remove_marking_runes(), remove_monsters(), remove_special_prayers(), remove_symptoms(), remove_unpaid_objects(), restore_player(), retrofit_joined_wall(), roll_ob(), rune_attack(), save_life(), save_throw_object(), shop_mat_type_move_on(), spell_effect_type_move_on(), spring_trap(), stick_arrow(), stop_item(), stop_projectile(), tear_down_wall(), teleport(), thrown_object_type_process(), town_portal_destroy_existing(), transfer_ob(), transmute_item_to_flower(), transport_type_apply(), treasure_type_apply(), turn_one_transport(), and write_scroll().
void object_remove_from_active_list | ( | object * | op | ) |
This function removes object 'op' from the list of active objects.
This should only be used for style maps or other such reference maps where you don't want an object that isn't in play chewing up cpu time getting processed. The reverse of this is to call object_update_speed(), which will do the right thing based on the speed of the object.
op | object to remove. |
Definition at line 1392 of file object.cpp.
References object::active_next, active_objects, and object::active_prev.
Referenced by load_objects(), and object_update_speed().
void object_replace_insert_in_map | ( | const 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.
arch_string | object's archetype to insert. |
op | object to insert it under: supplies x and the map. |
Definition at line 2597 of file object.cpp.
References arch_to_object(), find_archetype(), FOR_MAP_FINISH, FOR_MAP_PREPARE, INS_BELOW_ORIGINATOR, object::map, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object::x, and object::y.
Referenced by save_throw_object().
void object_reset | ( | object * | op | ) |
Totally resets the specified object, without freeing associated memory.
op | object to reset. |
Definition at line 934 of file object.cpp.
References object::lore, object::materialname, object::msg, object::name, object::name_pl, object_clear(), object::race, object::skill, object::slaying, and object::title.
Referenced by cfapi_object_reset(), check_login(), and ArtifactLoader::load().
void object_set_cheat | ( | object * | op | ) |
object_set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in all it's inventory (recursively).
If checksums are used, a player will get object_set_cheat called for him/her-self and all object carried by a call to this function.
op | object for which to set the flag. |
Definition at line 3274 of file object.cpp.
References FLAG_WAS_WIZ, object_set_flag_inv(), and SET_FLAG.
Referenced by cfapi_object_set_property().
Sets the enemy of an object.
op | the object of which to set the enemy |
enemy | the new enemy for op; can be NULL to clear the enemy |
Definition at line 915 of file object.cpp.
References object::count, object::enemy, llevDebug, LOG(), object::name, PLAYER, and object::type.
Referenced by alchemy_failure_effect(), cfapi_object_set_property(), command_mon_aggr(), do_mood_floor(), enter_map(), fix_summon_pet(), flee_player(), hit_player(), monster_check_enemy(), monster_find_enemy(), monster_move(), monster_npc_call_help(), mood_change(), pets_get_enemy(), pets_move(), pets_summon_object(), push_ob(), and scare_creature().
void object_set_flag_inv | ( | object * | op, |
int | flag | ||
) |
Activate recursively a flag on an object's inventory.
op | object to recurse. Can have an empty inventory. |
flag | flag to set. |
Definition at line 3239 of file object.cpp.
References object::below, object::inv, object_set_flag_inv(), and SET_FLAG.
Referenced by check_loaded_object(), object_set_cheat(), and object_set_flag_inv().
void object_set_msg | ( | object * | op, |
const char * | msg | ||
) |
Set the message field of an object.
op | the object to modify |
msg | the new message to set or NULL to clear |
Definition at line 4811 of file object.cpp.
References add_string(), free_string(), object::msg, stringbuffer_append_string(), stringbuffer_finish_shared(), and stringbuffer_new().
Referenced by add_abilities(), adjust_sign_msg(), apply_race_and_class(), cast_create_town_portal(), change_book(), commit_crime(), copy_message(), do_symptoms(), find_or_create_connection_for_map(), key_change_class(), kill_player(), kill_player_not_permadeath(), kill_player_permadeath(), make_formula_book(), place_exits(), place_special_exit(), tailor_readable_ob(), while(), write_mark(), write_note(), and write_rune().
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects.
op | object of which to set the owner |
owner | new owner for object. Can be NULL, in which case it's equivalent of calling object_clear_owner(op) |
Definition at line 840 of file object.cpp.
References object::count, object_clear_owner(), object_get_owner(), object::owner, and object::ownercount.
Referenced by animate_weapon(), cast_cause_disease(), cast_cone(), cast_smite_spell(), cfapi_object_set_property(), change_object(), cone_drop(), create_aura(), create_bomb(), do_mood_floor(), do_symptoms(), do_throw(), fire_arch_from_position(), fire_bolt(), fire_bow(), fire_swarm(), fix_summon_pet(), hit_with_arrow(), infect_object(), magic_wall(), mood_change(), object_copy_owner(), pets_summon_golem(), pets_summon_object(), polymorph_living(), use_oratory(), and write_rune().
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. |
Definition at line 4499 of file object.cpp.
References add_string(), FALSE, find_string(), free_string(), object_set_value_s(), and TRUE.
Referenced by add_abilities(), add_key_value(), cfapi_object_set_key(), cfapi_object_set_property(), change_book(), command_rename_item(), do_harvest(), eventListener(), generate_monster(), generate_monster_arch(), generate_monster_inv(), get_npc(), god_enchants_weapon(), god_gives_present(), god_info_msg(), make_formula_book(), mon_info_msg(), monster_do_talk_npc(), monster_move_randomly(), mood_change(), msgfile_msg(), object_give_identified_properties(), place_fountain_with_specials(), sell_item(), set_object_face_other(), and store_spell_expiry().
|
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. |
Definition at line 4416 of file object.cpp.
References add_refcount(), add_string(), object::arch, archetype::clone, FALSE, FREE_AND_CLEAR_STR, key_value::key, object::key_values, key_value::next, object_get_key_value(), TRUE, and key_value::value.
Referenced by object_set_value().
object_split(ob,nr) 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). On failure, NULL is returned, and the reason LOG()ed.
This function will send an update to the client if the remaining object is in a player inventory.
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 |
Definition at line 2637 of file object.cpp.
References FLAG_REMOVED, FREE_OBJ_FREE_INVENTORY, llevDebug, LOG(), MAX, object::name, object::nrof, NROF(), object_create_clone(), object_decrease_nrof(), object_free(), object_remove(), and QUERY_FLAG.
Referenced by animate_weapon(), apply_container(), apply_special(), cfapi_object_split(), do_harvest(), do_throw(), drop_object(), fire_bow(), identify_object_with_skill(), improve_armour(), lamp_type_apply(), lighter_type_apply(), loot_object(), monster_check_pickup(), pick_up_object(), and put_object_in_sack().
void object_sub_weight | ( | object * | op, |
signed long | weight | ||
) |
Recursively (outwards) subtracts a number from the weight of an object (and what is carried by it's environment(s)).
Takes into account the container's weight reduction.
op | object to which weight is substracted. |
weight | weight to remove. |
Definition at line 1807 of file object.cpp.
References object::carrying, CONTAINER, object::env, object::stats, living::Str, object::type, and weight.
Referenced by make_item_from_recipe(), object_decrease_nrof(), object_increase_nrof(), and object_remove().
signed long object_sum_weight | ( | object * | op | ) |
object_sum_weight() is a recursive function which calculates the weight an object is carrying.
It goes through in figures out how much containers are carrying, and sums it up.
This takes into account the container's weight reduction.
op | object we want the weight of. |
Definition at line 568 of file object.cpp.
References object::carrying, CONTAINER, FOR_INV_FINISH, FOR_INV_PREPARE, NROF(), object_sum_weight(), object::stats, living::Str, and object::type.
Referenced by cfapi_object_set_property(), check_login(), command_fix_me(), fix_weight(), load_objects(), object_sum_weight(), and transport_type_apply().
void object_unset_flag_inv | ( | object * | op, |
int | flag | ||
) |
Desactivate recursively a flag on an object inventory.
op | object to recurse. Can have an empty inventory. |
flag | flag to unset. |
Definition at line 3256 of file object.cpp.
References object::below, CLEAR_FLAG, object::inv, and object_unset_flag_inv().
Referenced by do_item_conversion(), generate_monster_inv(), move_creator(), and object_unset_flag_inv().
void object_update | ( | object * | op, |
int | action | ||
) |
object_update() 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 look-window of that player is updated (this might be a suboptimal way of updating that window, though, since object_update() is called often)
op | object to update |
action | Hint of what the caller believes need to be done. One of UP_OBJ_xxx values. For example, if the only thing that has changed is the face (due to an animation), we don't need to call update_position until that actually comes into view of a player. OTOH, many other things, like addition/removal of walls or living creatures may need us to update the flags now. |
Definition at line 1434 of file object.cpp.
References object::contr, object::env, esrv_update_item(), FLAG_ALIVE, FLAG_BLOCKSVIEW, FLAG_CLIENT_ANIM_RANDOM, FLAG_CLIENT_ANIM_SYNC, FLAG_DAMNED, FLAG_NO_MAGIC, flags, GET_MAP_FLAGS, GET_MAP_MOVE_BLOCK, GET_MAP_MOVE_OFF, GET_MAP_MOVE_ON, GET_MAP_MOVE_SLOW, GET_MAP_PLAYER, mapstruct::in_memory, llevDebug, llevError, LOG(), object::map, MAP_HEIGHT, MAP_SAVING, MAP_WIDTH, object::more, object::move_allow, object::move_block, object::move_off, object::move_on, object::move_slow, object_update(), P_BLOCKSVIEW, P_IS_ALIVE, P_NEED_UPDATE, P_NO_CLERIC, P_NO_ERROR, P_NO_MAGIC, P_PLAYER, PLAYER, QUERY_FLAG, SET_MAP_FLAGS, player::socket, object::type, UP_OBJ_CHANGE, UP_OBJ_FACE, UP_OBJ_INSERT, UP_OBJ_REMOVE, UPD_FACE, socket_struct::update_look, update_position(), object::x, and object::y.
Referenced by animate_object(), animate_trigger(), animate_turning(), apply_race_and_class(), cast_invisible(), cf_handle_type_apply(), cfapi_object_set_property(), cfapi_object_update(), check_trigger(), command_invisible(), common_trap_type_process(), do_skill_attack(), fix_stopped_arrow(), gate_type_process(), hide(), hit_map(), identify(), key_change_class(), make_visible(), move_hole(), object_insert_in_map(), object_remove(), object_update(), pets_move_golem(), tear_down_wall(), trapdoor_type_move_on(), trigger_connected(), trigger_type_process(), unblock_exits(), and update_button().
void object_update_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.
op | object to update. Must not be freed and still have a speed. |
Definition at line 1349 of file object.cpp.
References object::active_next, active_objects, object::active_prev, FABS, FLAG_FREED, llevError, LOG(), MIN_ACTIVE_SPEED, object::name, object_remove_from_active_list(), QUERY_FLAG, and object::speed.
Referenced by add_abilities(), add_force(), animate_weapon(), apply_auto_fix(), apply_savebed(), cast_detection(), cast_word_of_recall(), cfapi_object_set_property(), check_loaded_object(), check_login(), check_trigger(), command_remove(), do_auto_apply(), do_mood_floor(), do_throw(), drain_wand_charge(), eat_special_food(), enter_exit(), find_or_create_connection_for_map(), fire_bow(), fix_object(), fix_stopped_arrow(), gate_type_process(), kill_object(), move_cone(), move_detector(), move_hole(), move_player_mover(), object_copy(), object_free(), place_fountain_with_specials(), power_crystal_type_apply(), process_events(), recharge(), remove_door(), remove_locked_door(), swap_random_stats(), timed_gate_type_process(), transmute_item_to_flower(), trigger_connected(), trigger_move(), and while().
void object_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, and how it looks on the map.
op | object to update. |
Definition at line 1332 of file object.cpp.
References animate_object(), object::animation, object::direction, FLAG_IS_TURNABLE, and QUERY_FLAG.
Referenced by animate_bomb(), common_process_projectile(), director_type_move_on(), do_throw(), fire_arch_from_position(), fire_bolt(), fire_bow(), forklightning(), move_bolt(), move_bullet(), move_missile(), and spinner_type_move_on().
bool object_value_set | ( | const object * | op, |
const char *const | key | ||
) |
Determine if an extra value is set.
Wrapper around object_get_value(), but also recognizes empty string and "0".
Definition at line 4376 of file object.cpp.
References object_get_value().
Referenced by attack_ob_simple(), do_harvest(), generate_monster(), matches_sacrifice(), monster_check_enemy(), monster_find_enemy(), mood_change(), singing(), turn_transport(), and use_oratory().
Determine if an extra value is set to a non empty or 0 value.
op | object which may contain the value. |
key | value to search for, must be a shared string. |
Definition at line 4390 of file object.cpp.
References object::key_values, and key_value::next.
Referenced by update_position().
|
static |
Randomly permutes an array.
arr | array to permute. |
begin | |
end | first and last (exclusive) indexes to permute. |
Definition at line 3618 of file object.cpp.
References RANDOM.
Referenced by get_search_arr().
int save_object | ( | FILE * | fp, |
object * | op, | ||
int | flag | ||
) |
Dumps all variables in an object to a file.
fp | file to write to. |
op | object to save. |
flag | combination of SAVE_FLAG_xxx flags. |
Definition at line 5397 of file object.cpp.
References SAVE_ERROR_OK, SAVE_ERROR_WRITE, save_object_in_sb(), stringbuffer_finish(), and stringbuffer_new().
Referenced by save_player().
void save_object_in_sb | ( | StringBuffer * | sb, |
object * | op, | ||
const int | flag | ||
) |
Store a string representation of op in sb.
Suitable for saving an object to a file.
Definition at line 5311 of file object.cpp.
References ADD_STRINGLINE_ENTRY(), object::arch, arch_to_object(), artifact, object::artifact, archetype::clone, empty_archetype, FAST_SAVE_LONG(), find_archetype(), find_artifact(), FLAG_NO_SAVE, FLAG_UNPAID, FOR_INV_FINISH, FOR_INV_PREPARE, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, get_ob_diff(), give_artifact_abilities(), living::grace, living::hp, artifact::item, llevError, LOG(), archetype::name, object_free(), object_get_owner(), QUERY_FLAG, archetype::reference_count, SAVE_FLAG_SAVE_UNPAID, save_object_in_sb(), living::sp, object::stats, stringbuffer_append_string(), object::type, object::x, and object::y.
Referenced by save_object(), save_object_in_sb(), and save_objects().
object* active_objects |
List of active objects that need to be processed.
Definition at line 296 of file object.cpp.
Referenced by init_objects(), object_count_active(), object_remove_from_active_list(), object_update_speed(), and process_events().
|
static |
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 loaded/saved.
Definition at line 4851 of file object.cpp.
Referenced by get_ob_diff().
|
static |
Pointer to the list of unused objects.
Definition at line 295 of file object.cpp.
Referenced by expand_objects(), init_objects(), object_count_free(), object_free(), object_free_all_data(), and object_new().
short freearr_x[SIZEOFFREE] |
X offset when searching around a spot.
Definition at line 299 of file object.cpp.
Referenced by animate_bomb(), animate_weapon(), apply_builder_floor(), apply_builder_remove(), apply_map_builder(), attempt_jump(), can_see_monsterP(), cast_cause_disease(), cast_cone(), cast_create_obj(), cast_light(), cast_polymorph(), cast_raise_dead_spell(), cast_spell(), cast_transfer(), cfapi_object_insert(), command_summon(), command_teleport(), common_process_projectile(), counterspell(), create_bomb(), dimension_door(), dispel_rune(), do_follow(), do_harvest(), do_skill_ident(), do_throw(), enter_map(), expand_sight(), explosion(), find_closest_monster(), find_doors_in_room_recursive(), find_enclosed_spot(), find_monster_in_room_recursive(), find_spot_in_room_recursive(), find_target_for_friendly_spell(), find_traps(), fix_summon_pet(), forklightning(), gate_type_process(), get_pointed_target(), hideability(), hit_map(), keyplace(), magic_wall(), mimic_type_apply(), monster_communicate(), monster_compute_path(), monster_find_nearest_enemy(), monster_use_bow(), move_ball_spell(), move_bolt(), move_cone(), move_ob(), move_player_attack(), move_player_mover(), move_swarm_spell(), object_find_first_free_spot(), object_find_free_spot(), object_insert_to_free_spot_or_free(), path_to_player(), pets_follow_owner(), pets_get_enemy(), pets_move(), pets_summon_golem(), pets_summon_object(), pick_arrow_target(), pick_lock(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), player_fire_bow(), polymorph_living(), probe(), push_ob(), put_a_monster(), remove_adjacent_doors(), remove_door(), remove_locked_door(), remove_trap(), roll_ob(), shop_mat_type_move_on(), singing(), skill_attack(), spell_find_dir(), stand_near_hostile(), steal(), surround_by_doors(), teleport(), transfer_ob(), turn_one_transport(), use_oratory(), and write_rune().
short freearr_y[SIZEOFFREE] |
Y offset when searching around a spot.
Definition at line 305 of file object.cpp.
Referenced by animate_weapon(), apply_builder_floor(), apply_builder_remove(), apply_map_builder(), attempt_jump(), can_see_monsterP(), cast_cause_disease(), cast_cone(), cast_create_obj(), cast_light(), cast_polymorph(), cast_raise_dead_spell(), cast_spell(), cast_transfer(), cfapi_object_insert(), command_summon(), command_teleport(), common_process_projectile(), counterspell(), create_bomb(), dimension_door(), dispel_rune(), do_follow(), do_harvest(), do_skill_ident(), do_throw(), enter_map(), expand_sight(), explosion(), find_closest_monster(), find_doors_in_room_recursive(), find_enclosed_spot(), find_monster_in_room_recursive(), find_spot_in_room_recursive(), find_target_for_friendly_spell(), find_traps(), fix_summon_pet(), forklightning(), gate_type_process(), get_pointed_target(), hideability(), hit_map(), keyplace(), magic_wall(), mimic_type_apply(), monster_communicate(), monster_compute_path(), monster_find_nearest_enemy(), monster_use_bow(), move_ball_spell(), move_bolt(), move_cone(), move_ob(), move_player_attack(), move_player_mover(), move_swarm_spell(), object_find_first_free_spot(), object_find_free_spot(), object_insert_to_free_spot_or_free(), path_to_player(), pets_follow_owner(), pets_get_enemy(), pets_move(), pets_summon_golem(), pets_summon_object(), pick_arrow_target(), pick_lock(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), player_fire_bow(), polymorph_living(), probe(), push_ob(), put_a_monster(), remove_adjacent_doors(), remove_door(), remove_locked_door(), remove_trap(), roll_ob(), shop_mat_type_move_on(), singing(), skill_attack(), spell_find_dir(), stand_near_hostile(), steal(), surround_by_doors(), teleport(), transfer_ob(), turn_one_transport(), use_oratory(), and write_rune().
int freedir[SIZEOFFREE] |
Direction we're pointing on this spot.
Definition at line 317 of file object.cpp.
Referenced by pets_summon_object(), and spell_find_dir().
int maxfree[SIZEOFFREE] |
Number of spots around a location, including that location (except for 0)
Definition at line 311 of file object.cpp.
Referenced by object_find_free_spot().
const char* const move_name[] |
Maps the MOVE_* values to names.
Definition at line 4832 of file object.cpp.
Referenced by get_string_move_type(), and set_move().
int nrofallocobjects = STARTMAX |
How many OBs allocated (free + used)
Definition at line 291 of file object.cpp.
Referenced by expand_objects(), malloc_info(), and object_free_all_data().
int nroffreeobjects = STARTMAX |
How many OBs allocated and free (free)
Definition at line 290 of file object.cpp.
Referenced by expand_objects(), malloc_info(), object_free(), object_free_all_data(), and object_new().
All objects, allocated this way at first.
Definition at line 289 of file object.cpp.
Referenced by init_objects().
object* objects |
Pointer to the list of used objects.
Definition at line 294 of file object.cpp.
Referenced by free_all_objects(), init_objects(), insert_objects(), object_count_used(), object_dump_all(), object_find_by_name_global(), object_find_by_tag_global(), object_free(), object_free_all_data(), and object_new().
|
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. Moved from spell_util.c to object.c with the other related direction functions.
peterm: do LOS stuff for ball lightning. Go after the closest VISIBLE monster.
Definition at line 3752 of file object.cpp.
Referenced by can_see_monsterP().
const char* const spell_mapping[SPELL_MAPPINGS] |
This table is only necessary to convert objects that existed before the spell object conversion to the new object.
It was not practical to go through every mapping looking for every potion, rod, wand, etc that had a sp set and update to the new value. So this maps the old spell numbers to the name of the new archs. If you are adding a new spell, you should not modify this - your new spell won't have been used, and thus won't have any legacy object. NULL entries in this table are valid - to denote objects that should not be updated for whatever reason.
Definition at line 74 of file object.cpp.
Referenced by fix_generated_item().