Crossfire Server, Trunk
libproto.h File Reference
#include "bufferreader.h"
+ Include dependency graph for libproto.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int absdir (int d)
 
void add_abilities (object *op, const object *change)
 
void add_button_link (object *button, mapstruct *map, int connected)
 
void add_friendly_object (object *op)
 
void add_statbonus (object *op)
 
int adjust_dir (int dir, int destination_dir)
 
int allowed_class (const object *op)
 
void animate_object (object *op, int dir)
 
void animate_turning (object *op)
 
void animation_load_block (FILE *file, const char *full_path, const char *animation_name)
 
void apply_anim_suffix (object *who, const char *suffix)
 
void apply_death_exp_penalty (object *op)
 
objectarch_present_in_ob (const archetype *at, const object *op)
 
objectarch_to_object (archetype *at)
 
void artifact_compute_chance_for_item (const object *op, const artifact *art, int *numerator, int *denominator)
 
uint16_t artifact_get_face (const artifact *art)
 
int atnr_is_dragon_enabled (int attacknr)
 
int blocked_link (object *ob, mapstruct *m, int16_t sx, int16_t sy)
 
int book_overflow (const char *buf1, const char *buf2, size_t booksize)
 
int calc_item_power (const object *op)
 
void calc_perm_exp (object *op)
 
int calculate_difficulty (mapstruct *m)
 
int can_see_monsterP (mapstruct *m, int x, int y, int dir)
 
int change_abil (object *op, object *tmp)
 
void change_attr_value (living *stats, int attr, int8_t value)
 
void change_exp (object *op, int64_t exp, const char *skill_name, int flag)
 
void change_luck (object *op, int value)
 
int change_map_light (mapstruct *m, int change)
 
int check_altar_sacrifice (const object *altar, const object *sacrifice, int remove_others, int *toremove)
 
int64_t check_exp_adjust (const object *op, int64_t exp)
 
int64_t check_exp_loss (const object *op, int64_t exp)
 
bool check_formulae (void)
 
void check_inv (object *op, object *trig)
 
objectcheck_inv_recursive (object *op, const object *trig)
 
int check_path (const char *name, int prepend_dir)
 
bool check_recipes ()
 
void check_stat_bounds (living *stats, int8_t min_stat, int8_t max_stat)
 
int check_trigger (object *op, object *cause)
 
void clean_friendly_list (void)
 
void clean_object (object *op)
 
void clean_tmp_map (mapstruct *m)
 
void clear_friendly_list (void)
 
void clear_los (player *pl)
 
void clear_player (player *pl)
 
objectcreate_archetype (const char *name)
 
objectcreate_archetype_by_object_name (const char *name)
 
void create_overlay_pathname (const char *name, char *buf, size_t size)
 
char * create_pathname (const char *name, char *buf, size_t size)
 
objectcreate_singularity (const char *name)
 
void create_template_pathname (const char *name, char *buf, size_t size)
 
void create_treasure (treasurelist *t, object *op, int flag, int difficulty, int tries)
 
void decay_objects (mapstruct *m)
 
void delete_map (mapstruct *m)
 
StringBufferdescribe_attacktype (const char *attack, int value, StringBuffer *buf)
 
int describe_god (const object *god, int what, StringBuffer *buf, size_t maxlen)
 
StringBufferdescribe_item (const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
 
StringBufferdescribe_monster (const object *op, int use_media_tags, StringBuffer *buf)
 
StringBufferdescribe_resistance (const object *op, int newline, int use_media_tags, StringBuffer *buf)
 
StringBufferdescribe_spellpath_attenuation (const char *attenuation, int value, StringBuffer *buf)
 
int did_make_save (const object *op, int level, int bonus)
 
int die_roll (int num, int size, const object *op, int goodbad)
 
int dirdiff (int dir1, int dir2)
 
void drain_specific_stat (object *op, int deplete_stats)
 
void drain_stat (object *op)
 
void dump_abilities (void)
 
void dump_alchemy (void)
 
void dump_alchemy_costs (void)
 
void dump_all_archetypes (void)
 
void dump_all_maps (void)
 
void dump_animations (void)
 
void dump_arch (archetype *at, StringBuffer *sb)
 
void dump_artifacts (void)
 
void dump_experience (void)
 
void dump_faces (void)
 
void dump_friendly_objects (void)
 
void dump_gods (void)
 
void dump_map (const mapstruct *m)
 
void dump_monster_treasure (const char *name)
 
int exp_level (int64_t exp)
 
void fatal (enum fatal_error err) __attribute__((noreturn))
 
Animationsfind_animation (const char *name)
 
archetypefind_archetype (const char *name)
 
archetypefind_archetype_by_object_name (const char *name)
 
archetypefind_archetype_by_object_type_name (int type, const char *name)
 
const artifactfind_artifact (const object *op, const char *name)
 
artifactlistfind_artifactlist (int type)
 
uint8_t find_color (const char *name)
 
int find_dir_2 (int x, int y)
 
const Facefind_face (const char *name)
 
const objectfind_god (const char *name)
 
recipefind_recipe_for_tool (const char *tool, recipe *from)
 
int find_smooth (const Face *face, const Face **smoothed)
 
archetypefind_treasure_by_name (const treasure *t, const char *name, int depth)
 
treasurelistfind_treasurelist (const char *name)
 
void first_arch_pass (FILE *fp, const char *filename)
 
void fix_generated_item (object *op, object *creator, int difficulty, int max_magic, int flags)
 
void fix_object (object *op)
 
void free_all_artifacts (void)
 
void free_all_god (void)
 
void free_all_maps (void)
 
void free_all_readable (void)
 
void free_all_recipes (void)
 
void free_arch (archetype *at)
 
void free_charlinks (linked_char *lc)
 
void free_dialog_information (object *op)
 
void free_experience (void)
 
void free_globals (void)
 
void free_loader (void)
 
void free_map (mapstruct *m)
 
void free_objectlink (objectlink *ol)
 
void free_objectlinkpt (oblinkpt *obp)
 
void free_player (player *pl)
 
void generate_artifact (object *op, int difficulty)
 
objectgenerate_treasure (treasurelist *t, int difficulty)
 
archetypeget_archetype_by_skill_name (const char *skill, int type)
 
archetypeget_archetype_by_type_subtype (int type, int subtype)
 
archetypeget_archetype_struct (void)
 
int8_t get_attr_value (const living *stats, int attr)
 
int get_button_value (const object *button)
 
int get_cha_bonus (int stat)
 
int get_cleric_chance (int stat)
 
client_spellget_client_spell_state (player *pl, object *spell)
 
const char * get_colorname (uint8_t index)
 
int get_dam_bonus (int stat)
 
int get_dex_bonus (int stat)
 
int get_dialog_message (object *op, const char *text, struct_dialog_message **message, struct_dialog_reply **reply)
 
artifactget_empty_artifact (void)
 
artifactlistget_empty_artifactlist (void)
 
mapstructget_empty_map (int sizex, int sizey)
 
treasureget_empty_treasure ()
 
const Faceget_face_by_id (uint16_t id)
 
int get_face_fallback (int faceset, uint16_t imageno)
 
size_t get_faces_count (void)
 
int get_fear_bonus (int stat)
 
recipelistget_formulalist (int i)
 
objectlinkget_friends_of (const object *owner)
 
const char * get_god_for_race (const char *race)
 
objectget_jail_exit (object *op)
 
int get_learn_spell (int stat)
 
void get_levelnumber (int i, char *buf, size_t size)
 
mapstructget_linked_map (void)
 
int get_map_flags (mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
 
mapstructget_map_from_coord (mapstruct *m, int16_t *x, int16_t *y)
 
sstring get_message_body (const GeneralMessage *message)
 
const Faceget_message_face (const GeneralMessage *message)
 
const GeneralMessageget_message_from_identifier (const char *identifier)
 
sstring get_message_title (const GeneralMessage *message)
 
const char * get_month_name (const int index)
 
const char * get_name_of_region_for_map (const mapstruct *m)
 
archetypeget_next_archetype (archetype *current)
 
objectget_next_friend (object *current)
 
void get_ob_diff (StringBuffer *sb, const object *op, const object *op2)
 
objectlinkget_objectlink (void)
 
oblinkptget_objectlinkpt (void)
 
const char * get_periodofday (const int index)
 
int get_power_from_ench (int ench)
 
const objectget_rand_god (void)
 
int get_random_dir (void)
 
objectget_random_mon (int level)
 
recipeget_random_recipe (recipelist *rpl)
 
int get_randomized_dir (int dir)
 
int get_rangevector (object *op1, const object *op2, rv_vector *retval, int flags)
 
int get_rangevector_from_mapcoord (const mapstruct *m, int x, int y, const object *op2, rv_vector *retval)
 
const readable_message_typeget_readable_message_type (object *readable)
 
regionget_region_by_map (mapstruct *m)
 
regionget_region_by_name (const char *region_name)
 
regionget_region_from_string (const char *name)
 
const char * get_region_longname (const region *r)
 
const char * get_region_msg (const region *r)
 
regionget_region_struct (void)
 
void get_search_arr (int *search_arr)
 
const char * get_season_name (const int index)
 
long get_sleep_remaining (void)
 
float get_speed_bonus (int stat)
 
int get_thaco_bonus (int stat)
 
void get_tod (timeofday_t *tod)
 
int get_turn_bonus (int stat)
 
const typedataget_typedata (int itemtype)
 
const typedataget_typedata_by_name (const char *name)
 
const char * get_weekday (const int index)
 
uint32_t get_weight_limit (int stat)
 
void give_artifact_abilities (object *op, const object *artifact)
 
objectgive_skill_by_name (object *op, const char *skill_name)
 
int has_ability (const object *ob)
 
mapstructhas_been_loaded (const char *name)
 
int has_carried_lights (const object *op)
 
const char * i18n (const object *who, const char *code)
 
language_t i18n_find_language_by_code (const char *code)
 
void i18n_free (void)
 
language_t i18n_get_language_by_code (const char *code)
 
sstring i18n_get_language_code (language_t language)
 
void i18n_init (void)
 
void i18n_list_languages (object *who)
 
objectidentify (object *op)
 
int ihypot (int a, int b)
 
void init_archetype_pointers (void)
 
void init_attackmess (BufferReader *reader, const char *filename)
 
void void init_block (void)
 
void init_experience (void)
 
void init_formulae (BufferReader *reader, const char *filename)
 
void init_globals (void)
 
void init_gods (void)
 
void init_library (void)
 
void init_msgfile (FILE *file, const char *filename)
 
void init_ob_method_struct (ob_methods *methods, ob_methods *fallback)
 
void init_ob_types (ob_methods *base_type)
 
void init_objects (void)
 
void init_readable (void)
 
void init_regions (BufferReader *reader, const char *filename)
 
void init_stats ()
 
int is_dragon_pl (const object *op)
 
int is_friendly (const object *op)
 
int is_identifiable_type (const object *op)
 
int is_identified (const object *op)
 
int is_magical (const object *op)
 
int is_old_wraith_pl (object *op)
 
int is_type_valid (uint8_t type)
 
int is_valid_faceset (int fsn)
 
int is_wraith_pl (object *op)
 
int isqrt (int n)
 
void jump_time (void)
 
int legal_artifact_combination (const object *op, const artifact *art)
 
int64_t level_exp (int level, double expmul)
 
void link_player_skills (object *op)
 
int load_face_file (FILE *file, const char *full_path)
 
void load_image_info (FILE *file, const char *filename)
 
int load_object (FILE *fp, object *op, int bufstate, int map_flags, bool artifact_init)
 
int load_object_from_reader (BufferReader *reader, object *op, int map_flags, bool arch_init, bool artifact_init)
 
int load_png_file (FILE *file, const char *full_path)
 
void load_treasures (void)
 
const artifactlocate_recipe_artifact (const recipe *rp, size_t idx)
 
void LOG (LogLevel logLevel, const char *format,...) PRINTF_ARGS(2
 
void make_list_like (char *input)
 
void make_path_to_file (const char *filename)
 
void make_sure_not_seen (const object *op)
 
void make_sure_seen (const object *op)
 
objectmap_find_by_archetype (mapstruct *m, int x, int y, const archetype *at)
 
objectmap_find_by_flag (mapstruct *map, int x, int y, int flag)
 
objectmap_find_by_type (mapstruct *m, int x, int y, uint8_t type)
 
const char * map_get_path (const object *item)
 
void map_remove_unique_files (const mapstruct *map)
 
mapstructmapfile_load (const char *map, int flags)
 
materialtype_tname_to_material (const char *name)
 
int64_t new_exp (const object *ob)
 
int nstrtok (const char *buf1, const char *buf2)
 
method_ret ob_apply (object *op, object *applier, int aflags)
 
int ob_blocked (const object *ob, mapstruct *m, int16_t x, int16_t y)
 
char * ob_describe (const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
 
method_ret ob_move_on (object *op, object *victim, object *originator)
 
method_ret ob_process (object *op)
 
method_ret ob_trigger (object *op, object *cause, int state)
 
void object_add_weight (object *op, signed long weight)
 
int object_can_merge (object *ob1, object *ob2)
 
int object_can_pick (const object *who, const object *item)
 
int object_check_move_on (object *op, object *originator)
 
void object_clear (object *op)
 
void object_clear_owner (object *op)
 
void object_copy (const object *src_ob, object *dest_ob)
 
void object_copy_no_speed (const object *src_ob, object *dest_ob)
 
void object_copy_owner (object *op, object *clone)
 
void object_copy_with_inv (const object *src_ob, object *dest_ob, bool update_speed)
 
int object_count_active (void)
 
int object_count_free (void)
 
int object_count_used (void)
 
objectobject_create_arch (archetype *at)
 
objectobject_create_clone (object *asrc)
 
objectobject_decrease_nrof (object *op, uint32_t i)
 
int object_distance (const object *ob1, const object *ob2)
 
void object_dump (const object *op, StringBuffer *sb)
 
void object_dump_all (void)
 
objectobject_find_by_arch_name (const object *who, const char *name)
 
objectobject_find_by_flag (const object *who, int flag)
 
objectobject_find_by_flag_applied (const object *who, int flag)
 
objectobject_find_by_name (const object *who, const char *name)
 
objectobject_find_by_name_global (const char *str)
 
objectobject_find_by_tag (const object *who, tag_t tag)
 
objectobject_find_by_tag_global (tag_t i)
 
objectobject_find_by_type (const object *who, int type)
 
objectobject_find_by_type2 (const object *who, int type1, int type2)
 
objectobject_find_by_type_and_arch_name (const object *who, int type, const char *name)
 
objectobject_find_by_type_and_name (const object *who, int type, const char *name)
 
objectobject_find_by_type_and_race (const object *who, int type, const char *race)
 
objectobject_find_by_type_and_skill (const object *who, int type, const char *skill)
 
objectobject_find_by_type_and_slaying (const object *who, int type, const char *slaying)
 
objectobject_find_by_type_applied (const object *who, int type)
 
objectobject_find_by_type_subtype (const object *who, int type, int subtype)
 
objectobject_find_by_type_without_flags (const object *who, int type, int *flags, int num_flags)
 
int object_find_first_free_spot (const object *ob, mapstruct *m, int x, int y)
 
int object_find_free_spot (const object *ob, mapstruct *m, int x, int y, int start, int stop)
 
int object_find_multi_free_spot_around (const object *ob, const object *gen, int16_t *hx, int16_t *hy)
 
int object_find_multi_free_spot_within_radius (const object *ob, const object *gen, int *hx, int *hy)
 
void object_fix_multipart (object *tmp)
 
void object_free (object *ob, int flags)
 
void object_free_all_data (void)
 
void object_free_drop_inventory (object *ob)
 
void object_free_inventory (object *ob)
 
void object_free_key_values (object *op)
 
objectobject_get_env_recursive (object *op)
 
key_valueobject_get_key_value (const object *ob, const char *key)
 
void object_get_multi_size (const object *ob, int *sx, int *sy, int *hx, int *hy)
 
objectobject_get_owner (object *op)
 
objectobject_get_player_container (object *op)
 
const char * object_get_value (const object *op, const char *const key)
 
void object_give_identified_properties (object *op)
 
void object_handle_death_animation (object *op)
 
objectobject_insert_in_map (object *op, mapstruct *m, object *originator, int flag)
 
objectobject_insert_in_map_at (object *op, mapstruct *m, object *originator, int flag, int x, int y)
 
objectobject_insert_in_ob (object *op, object *where)
 
void object_insert_to_free_spot_or_free (object *op, mapstruct *map, int x, int y, int start, int stop, object *originator)
 
int object_matches_pickup_mode (const object *item, int mode)
 
int object_matches_string (object *pl, object *op, const char *name)
 
objectobject_merge (object *op, object *top)
 
void object_merge_spell (object *op, int16_t x, int16_t y)
 
objectobject_new (void)
 
objectobject_present_in_ob (uint8_t type, const object *op)
 
objectobject_present_in_ob_by_name (int type, const char *str, const object *op)
 
void object_remove (object *op)
 
void object_remove_from_active_list (object *op)
 
void object_replace_insert_in_map (const char *arch_string, object *op)
 
void object_reset (object *op)
 
void object_set_cheat (object *op)
 
void object_set_enemy (object *op, object *enemy)
 
void object_set_flag_inv (object *op, int flag)
 
void object_set_msg (object *op, const char *msg)
 
void object_set_owner (object *op, object *owner)
 
int object_set_value (object *op, const char *key, const char *value, int add_key)
 
objectobject_split (object *orig_ob, uint32_t nr, char *err, size_t size)
 
void object_sub_weight (object *op, signed long weight)
 
signed long object_sum_weight (object *op)
 
void object_unset_flag_inv (object *op, int flag)
 
void object_update (object *op, int action)
 
void object_update_speed (object *op)
 
void object_update_turn_face (object *op)
 
bool object_value_set (const object *op, const char *const key)
 
bool object_value_set_shared (const object *op, sstring key)
 
int on_same_map (const object *op1, const object *op2)
 
int operate_altar (object *altar, object **sacrifice)
 
int out_of_map (mapstruct *m, int x, int y)
 
char * path_combine (const char *src, const char *dst, char *path, size_t size)
 
char * path_combine_and_normalize (const char *src, const char *dst, char *path, size_t size)
 
void path_normalize (char *path)
 
const char * player_get_own_title (const struct player *pl)
 
void player_get_title (const struct player *pl, char *buf, size_t bufsize)
 
int player_has_own_title (const struct player *pl)
 
void player_lvl_adj (object *who, object *op)
 
void player_set_dragon_title (struct player *pl, int level, const char *attack, int skin_resist)
 
void player_set_own_title (struct player *pl, const char *title)
 
void print_los (object *op)
 
void print_monsters (void)
 
void push_button (object *op)
 
void query_base_name (const object *op, int plural, char *buf, size_t size)
 
void query_name (const object *op, char *buf, size_t size)
 
void query_short_name (const object *op, char *buf, size_t size)
 
void query_weight (const object *op, char *buf, size_t size)
 
int random_roll (int min, int max, const object *op, int goodbad)
 
int64_t random_roll64 (int64_t min, int64_t max, const object *op, int goodbad)
 
const char * re_cmp (const char *str, const char *regexp)
 
mapstructready_map_name (const char *name, int flags)
 
const char * recipe_get_difficulty_string (int difficulty)
 
const Facerecipe_get_face (const recipe *rp)
 
int region_is_child_of_region (const region *child, const region *r)
 
void register_apply (int ob_type, apply_func method)
 
void register_describe (int ob_type, describe_func method)
 
void register_move_on (int ob_type, move_on_func method)
 
void register_process (int ob_type, process_func method)
 
void register_trigger (int ob_type, trigger_func method)
 
void remove_button_link (object *op)
 
int remove_depletion (object *op, int level)
 
void remove_directory (const char *path)
 
void remove_friendly_object (object *op)
 
void remove_statbonus (object *op)
 
void replace (const char *src, const char *key, const char *replacement, char *result, size_t resultsize)
 
void replace_unprintable_chars (char *buf)
 
void reset_sleep (void)
 
int rndm (int min, int max)
 
int save_map (mapstruct *m, int flag)
 
int save_object (FILE *fp, object *op, int flag)
 
void save_object_in_sb (StringBuffer *sb, object *op, const int flag)
 
long seconds (void)
 
void set_abs_magic (object *op, int magic)
 
void set_attr_value (living *stats, int attr, int8_t value)
 
void set_dragon_name (object *pl, const object *abil, const object *skin)
 
void set_map_reset_time (mapstruct *map)
 
void set_materialname (object *op)
 
void set_tick_duration (long t)
 
int set_variable (object *op, const char *buf)
 
void share_exp (object *op, int64_t exp, const char *skill, int flag)
 
size_t split_string (char *str, char *array[], size_t array_size, char sep)
 
void stringbuffer_append_multiline_block (StringBuffer *sb, const char *start, const char *content, const char *end)
 
void stringbuffer_append_printf (StringBuffer *sb, const char *format,...)
 
void stringbuffer_append_string (StringBuffer *sb, const char *str)
 
void stringbuffer_append_stringbuffer (StringBuffer *sb, const StringBuffer *sb2)
 
void stringbuffer_delete (StringBuffer *sb)
 
char * stringbuffer_finish (StringBuffer *sb)
 
sstring stringbuffer_finish_shared (StringBuffer *sb)
 
size_t stringbuffer_length (StringBuffer *sb)
 
StringBufferstringbuffer_new (void)
 
void strip_endline (char *buf)
 
int strtoint (const char *buf)
 
char * strtoktolin (const char *buf1, const char *buf2, char *retbuf, size_t size)
 
void tailor_readable_ob (object *book, int msg_type)
 
FILE * tempnam_secure (const char *dir, const char *pfx, char **filename)
 
void tick_game_time (void)
 
unsigned int tick_length (float seconds)
 
const char * time_format_time (const timeofday_t *tod, char *buf, size_t bufsize)
 
void time_info (object *op)
 
long timespec_diff (struct timespec *end, struct timespec *start)
 
void transmute_materialname (object *op, const object *change)
 
void treasure_free (treasure *t)
 
treasuretreasure_insert (treasurelist *list, int position)
 
void treasure_remove_item (treasurelist *list, int position)
 
void trigger_connected (objectlink *ol, object *cause, const int state)
 
Animationstry_find_animation (const char *name)
 
archetypetry_find_archetype (const char *name)
 
const Facetry_find_face (const char *name, const Face *error)
 
void update_all_los (const mapstruct *map, int x, int y)
 
void update_all_map_los (mapstruct *map)
 
void update_button (object *op)
 
void update_buttons (mapstruct *m)
 
void update_los (object *op)
 
void update_position (mapstruct *m, int x, int y)
 
void use_trigger (object *op)
 
long usec_elapsed (struct timespec first, struct timespec second)
 
void write_book_archive (void)
 
void write_todclock (void)
 
void yyfree (void *ptr)
 
int yyget_debug (void)
 
FILE * yyget_in (void)
 
int yyget_lineno (void)
 
FILE * yyget_out (void)
 
char * yyget_text (void)
 
int yylex_destroy (void)
 
void yypop_buffer_state (void)
 
void yyrestart (FILE *input_file)
 
void yyset_debug (int bdebug)
 
void yyset_in (FILE *in_str)
 
void yyset_lineno (int line_number)
 
void yyset_out (FILE *out_str)
 

Function Documentation

◆ absdir()

int absdir ( int  d)

Computes an absolute direction.

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

Definition at line 3714 of file object.cpp.

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().

+ Here is the caller graph for this function:

◆ add_abilities()

void add_abilities ( object op,
const object change 
)

Apply artifact properties to an object.

Parameters
opobject to apply changes to.
changechanges to apply, with fields handled as described in the artifacts file.

For items that do not need identifying, use their identified face/animation immediately. This should make seas of generated creatures look more interesting.

Neila Hawkins 2018-01-07

Add query flags to perform the same treatment for identified items or artifacts that come identified. Also make sure we have op->arch. Otherwise it segfaults when we don't.

2018-01-08

Definition at line 320 of file artifact.cpp.

References living::ac, add_refcount(), animate::anim, object::anim_speed, object::animation, arch_to_object(), object::attacktype, blank_face, buf, change_attr_value(), CLEAR_FLAG, compute_face_name(), living::dam, living::exp, object::face, FLAG_ALIVE, FLAG_ANIMATE, FLAG_BLIND, FLAG_CLIENT_ANIM_RANDOM, FLAG_CONFUSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_NO_SAVE, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_REFLECTING, FLAG_SEE_IN_DARK, FLAG_STAND_STILL, FLAG_STEALTH, FLAG_XRAYS, living::food, FOR_INV_FINISH, FOR_INV_PREPARE, free_string(), object::gen_sp_armour, get_attr_value(), living::grace, living::hp, make_face_from_files::int, commongive::inv, object::inv, is_identified(), object::item_power, key_value::key, castle_read::key, KEY_ANIMATION_SUFFIX, KEY_FACE_SUFFIX, object::key_values, object::last_sp, object::level, llevDebug, LOG(), living::luck, object::material, object::materialname, MAX_BUF, living::maxgrace, living::maxhp, living::maxsp, object::move_type, object::msg, Face::name, Animations::name, object::name, key_value::next, object::nrof, NROFATTACKS, NUM_STATS, Face::number, object_copy(), object_free_drop_inventory(), object_get_value(), object_give_identified_properties(), object_insert_in_ob(), object_new(), object_remove(), object_set_msg(), object_set_value(), object_update_speed(), give::op, object::other_arch, object::path_attuned, object::path_denied, object::path_repelled, POTION, QUERY_FLAG, object::race, object::resist, ROD, set_abs_magic(), SET_FLAG, object::slaying, living::sp, sstring, object::stats, Ice::tmp, try_find_animation(), try_find_face(), key_value::value, object::value, living::wc, and object::weight.

Referenced by artifact_describe(), give_artifact_abilities(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_button_link()

void add_button_link ( object button,
mapstruct map,
int  connected 
)

Links specified object in the map.

Parameters
buttonobject to link. Must not be NULL.
mapmap we are on. Should not be NULL.
connectedconnection value for the item.

Definition at line 656 of file button.cpp.

References push::connected, object::count, FLAG_IS_LINKED, free_objectlink(), get_objectlink(), get_objectlinkpt(), objectlink::id, oblinkpt::link, llevError, LOG(), disinfect::map, objectlink::next, oblinkpt::next, objectlink::ob, SET_FLAG, and oblinkpt::value.

Referenced by apply_builder_item(), include_map_in_map(), and while().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_friendly_object()

void add_friendly_object ( object op)

Add a new friendly object to the list of friendly objects. Will log an error if the object is already on that list.

Parameters
opobject to add to the list.

Definition at line 32 of file friend.cpp.

References friends, is_friendly(), llevError, LOG(), and give::op.

Referenced by add_player(), animate_weapon(), cfapi_object_set_property(), change_object(), do_mood_floor(), fix_summon_pet(), mood_change(), pets_summon_golem(), pets_summon_object(), polymorph_living(), receive_play_again(), START_TEST(), use_oratory(), and while().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_statbonus()

void add_statbonus ( object op)

Adds stat-bonuses given by the class which the player has chosen.

Parameters
opobject which must be a player with contr not NULL.

Definition at line 868 of file living.cpp.

References give::op.

Referenced by apply_race_and_class(), key_change_class(), and key_roll_stat().

+ Here is the caller graph for this function:

◆ adjust_dir()

int adjust_dir ( int  dir,
int  destination_dir 
)

Adjusts a given direction by +/-1 towards a destination direction.

Parameters
dirthe direction to adjust
destination_dirthe destination direction to adjust towards
Returns
the adjusted direction

Definition at line 426 of file utils.cpp.

References absdir(), destination_dir, and rndm().

Referenced by move_ball_spell(), and move_missile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ allowed_class()

int allowed_class ( const object op)

Returns true if the given player is a legal class. The function to add and remove class-bonuses to the stats doesn't check if the stat becomes negative, thus this function merely checks that all stats are 1 or more, and returns false otherwise.

Parameters
opobject to check.
Returns
1 if allowed, 0 else.

Definition at line 1657 of file living.cpp.

References give::op.

Referenced by apply_race_and_class(), and key_change_class().

+ Here is the caller graph for this function:

◆ animate_object()

void animate_object ( object op,
int  dir 
)

Updates the face-variable of an object. If the object is the head of a multi-object, all objects are animated. The object's state is not changed, but merely updated if needed (out of bounds of new animation, reached end of animation, ...). This function correctly handles FLAG_IS_TURNABLE too.

Parameters
opis the object to animate.
diris the direction the object is facing. This is generally same as op->direction, but in some cases, op->facing is used instead - the caller has a better idea which one it really wants to be using, so let it pass along the right one. This parameter is ignored if the object has a head or is turnable.

Definition at line 44 of file anim.cpp.

References animate_object(), blank_face, CLEAR_FLAG, FLAG_ALIVE, FLAG_IS_TURNABLE, llevError, LOG(), NUM_ANIMATIONS, NUM_FACINGS, object_dump(), object_update(), give::op, PLAYER, QUERY_FLAG, SET_ANIMATION, SET_FLAG, stringbuffer_finish(), stringbuffer_new(), and UP_OBJ_FACE.

Referenced by animate_object(), apply_anim_suffix(), apply_changes_to_player(), dragon_ability_gain(), face_player(), fix_stopped_arrow(), monster_move(), monster_use_scroll(), move_aura(), move_hole(), move_player(), move_to(), object_give_identified_properties(), object_update_turn_face(), process_events(), process_object(), turn_one_transport(), and turn_transport().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ animate_turning()

void animate_turning ( object op)

Animates one step of object.

Parameters
opobject to animate.
Note
animate_object() should be used instead of this, but it can't handle animations in the 8 directions
Todo:
check if object is really animated?

Definition at line 270 of file button.cpp.

References FIREWALL, NUM_ANIMATIONS, object_update(), give::op, SET_ANIMATION, and UP_OBJ_FACE.

Referenced by director_process(), legacy_ob_process(), and trigger_connected().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ animation_load_block()

void animation_load_block ( FILE *  file,
const char *  full_path,
const char *  animation_name 
)

◆ apply_anim_suffix()

void apply_anim_suffix ( object who,
const char *  suffix 
)

Applies a compound animation to an object.

Parameters
whoobject to apply the animation to. Must not be NULL.
suffixanimation suffix to apply. Must not be NULL.

Definition at line 150 of file anim.cpp.

References animate::anim, animate_object(), object::animation, buf, object::facing, HEAD, object::last_anim, MAX_BUF, object::more, Animations::name, object::state, castle_read::suffix, object::temp_anim_speed, object::temp_animation, try_find_animation(), and autojail::who.

Referenced by apply_by_living(), attack_ob_simple(), cast_spell(), do_skill(), fire_bow(), and god_intervention().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apply_death_exp_penalty()

void apply_death_exp_penalty ( object op)

Applies a death penalty experience, the size of this is defined by the settings death_penalty_percentage and death_penalty_levels, and by the amount of permenent experience, whichever gives the lowest loss.

Parameters
opvictim of the penalty. Must not be NULL.

Definition at line 2240 of file living.cpp.

References check_exp_loss(), Settings::death_penalty_level, Settings::death_penalty_ratio, FOR_INV_FINISH, FOR_INV_PREPARE, levels, MAX, MIN, give::op, player_lvl_adj(), settings, SKILL, and Ice::tmp.

Referenced by kill_player_not_permadeath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ arch_present_in_ob()

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.

Parameters
atarchetype to search for.
opwhere to search.
Returns
first matching object, or NULL if none matches.

Definition at line 3222 of file object.cpp.

References give::op, and Ice::tmp.

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(), slow_living_by(), and START_TEST().

+ Here is the caller graph for this function:

◆ arch_to_object()

object* arch_to_object ( archetype at)

Creates and returns a new object which is a copy of the given archetype. This function returns NULL if given a NULL pointer, else an object.

Parameters
atarchetype from which to get an object.
Returns
object of specified type.
Note
object_new() will either allocate memory or call fatal(), so returned value is never NULL.

Definition at line 229 of file arch.cpp.

References archetype::clone, llevError, LOG(), object_copy_with_inv(), object_new(), and give::op.

Referenced by add_abilities(), add_one_item(), animate_bomb(), animate_weapon(), apply_builder_floor(), apply_builder_window(), ArtifactPanel::artifactChanged(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_cone(), cast_consecrate(), cast_curse(), cast_destruction(), cast_detection(), cast_heal(), cast_light(), cast_polymorph(), cast_raise_dead_spell(), cast_smite_spell(), change_luck(), change_object(), command_create(), cone_drop(), create_archetype(), create_archetype_by_object_name(), create_aura(), create_bomb(), create_player_cmd(), do_single_item(), do_test(), do_turn(), dragon_ability_gain(), drain_specific_stat(), eat_special_food(), explode_bullet(), fire_arch_from_position(), fire_bolt(), fire_swarm(), fix_container_multipart(), fix_summon_pet(), fix_walls(), get_npc(), get_player(), get_spell_by_name(), give_skill_by_name(), god_gives_present(), kill_player(), kill_player_not_permadeath(), kill_player_permadeath(), magic_wall(), make_map_floor(), make_map_walls(), mood_change(), move_aura(), move_ball_spell(), move_symptom(), object_create_arch(), object_fix_multipart(), object_replace_insert_in_map(), pets_summon_object(), pick_joined_wall(), place_exits(), poison_living(), potion_type_apply(), print_monsters(), put_a_monster(), put_decor(), put_doors(), put_floor(), put_in_icecube(), recipe_get_face(), remove_door(), remove_locked_door(), retrofit_joined_wall(), save_object_in_sb(), slow_living_by(), spell_effect(), spring_trap(), START_TEST(), town_portal_find_force(), write_mark(), and write_rune().

+ Here is the call graph for this function:

◆ artifact_compute_chance_for_item()

void artifact_compute_chance_for_item ( const object op,
const artifact art,
int *  numerator,
int *  denominator 
)

Compute the chance for a specified item to become the specified artifact. This does not take into account the 10% chance of an item being made an artifact.

Parameters
opitem to consider.
artartifact to compute the chance of.
numeratorchance in denominator for the artifact to be generated.
denominatordenominator, will never be 0.

Definition at line 133 of file artifact.cpp.

References artifact::chance, bigchest::check, find_artifactlist(), legal_artifact_combination(), guildoracle::list, and give::op.

Referenced by ArtifactWrapper::displayName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ artifact_get_face()

uint16_t artifact_get_face ( const artifact art)

Get a suitable face number for representing an artifact.

Parameters
artwhat to get the face of.
Returns
face, -1 as unsigned if none could be found.

Definition at line 638 of file artifact.cpp.

References artifact::allowed, archininventory::arch, blank_face, object::face, find_archetype_by_object_name(), get_next_archetype(), artifact::item, give::name, Face::number, try_find_archetype(), and object::type.

Referenced by ArtifactWrapper::displayIcon(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ atnr_is_dragon_enabled()

int atnr_is_dragon_enabled ( int  attacknr)

Determine if the attacktype represented by the specified attack-number is enabled for dragon players. A dragon player (quetzal) can gain resistances for all enabled attacktypes.

Parameters
attacknrattacktype to check
Returns
TRUE if player can gain resistances in that, FALSE else.

Definition at line 103 of file player.cpp.

References ATNR_ACID, ATNR_COLD, ATNR_ELECTRICITY, ATNR_FIRE, ATNR_MAGIC, and ATNR_POISON.

Referenced by command_resistances(), describe_item(), describe_resistance(), dragon_eat_flesh(), dragon_level_gain(), perceive_self(), and set_dragon_name().

+ Here is the caller graph for this function:

◆ blocked_link()

int blocked_link ( object ob,
mapstruct m,
int16_t  sx,
int16_t  sy 
)

Returns true if the given coordinate is blocked except by the object passed is not blocking. This is used with multipart monsters - if we want to see if a 2x2 monster can move 1 space to the left, we don't want its own area to block it from moving there.

Parameters
obobject we ignore. Must not be NULL.
mmap we're considering.
sx
sytarget coordinates
Returns
TRUE if the space is blocked by something other than ob.
Note
the coordinates & map passed in should have been updated for tiling by the caller.

Definition at line 344 of file map.cpp.

References CHECK_INV, check_inv_recursive(), DOOR, draw_ext_info(), FLAG_ALIVE, FLAG_WIZ, FOR_MAP_FINISH, FOR_MAP_PREPARE, GET_MAP_MOVE_BLOCK, HEAD, llevError, LOG(), m, MSG_TYPE_ATTACK, MSG_TYPE_ATTACK_NOKEY, NDI_NAVY, NDI_UNIQUE, guildjoin::ob, OB_MOVE_BLOCK, OB_TYPE_MOVE_BLOCK, OUT_OF_REAL_MAP, P_IS_ALIVE, PLAYER, QUERY_FLAG, Ice::tmp, and TRANSPORT.

Referenced by move_ob(), and path_to_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ book_overflow()

int book_overflow ( const char *  buf1,
const char *  buf2,
size_t  booksize 
)

Checks if buf1 and buf2 can be combined.

Parameters
buf1
buf2buffer we plan on combining.
booksizemaximum book size.
Returns
0 if buffers can be combined, 1 else.

Definition at line 719 of file readable.cpp.

References BOOK_BUF, booksize, and buf_overflow().

Referenced by write_note().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calc_item_power()

int calc_item_power ( const object op)

This takes an object 'op' and figures out what its item_power rating should be. This should only really be used by the treasure generation code, and when loading legacy objects. It returns the item_power it calculates.

Parameters
opobject of which to compute the item_power
Returns
op's item power.

Definition at line 235 of file item.cpp.

References AMULET, ARMOUR, bits_set(), BOOTS, BRACERS, CLOAK, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_XRAYS, get_attr_value(), get_power_from_ench(), GIRDLE, GLOVES, HELMET, if(), INORGANIC, NROFATTACKS, NUM_STATS, give::op, QUERY_FLAG, RING, SHIELD, Ice::tmp, and WEAPON.

Referenced by add_one_item(), fix_generated_item(), and local_check_loaded_object().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calc_perm_exp()

void calc_perm_exp ( object op)

Ensure that the permanent experience requirements in an exp object are met. This really just checks 'op to make sure the perm_exp value is within proper range. Note that the checking of what is passed through has been reduced. Since there is now a proper field for perm_exp, this can now work on a much larger set of objects.

Parameters
opobject to check.

Definition at line 1910 of file living.cpp.

References MAX_EXPERIENCE, give::op, Settings::permanent_exp_ratio, and settings.

Referenced by add_player_exp(), and command_addexp().

+ Here is the caller graph for this function:

◆ calculate_difficulty()

int calculate_difficulty ( mapstruct m)

This routine is supposed to find out the difficulty of the map. Difficulty does not have a lot to do with character level, but does have a lot to do with treasure on the map.

Difficulty can now be set by the map creature. If the value stored in the map is zero, then use this routine. Maps should really have a difficulty set than using this function - human calculation is much better than this functions guesswork.

Parameters
mmap for which to compute difficulty.
Returns
difficulty of the map.

Definition at line 1896 of file map.cpp.

References archetype::clone, living::exp, FLAG_GENERATOR, FLAG_MONSTER, FOR_MAP_FINISH, FOR_MAP_PREPARE, if(), level_exp(), m, MAP_DIFFICULTY, MAP_HEIGHT, MAP_WIDTH, object_get_value(), give::op, QUERY_FLAG, object::stats, diamondslots::x, and diamondslots::y.

Referenced by cfapi_map_get_map_property(), generate_random_map(), mapfile_load(), and CREMapInformationManager::process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ can_see_monsterP()

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

Parameters
mmap we're on
x
yorigin coordinates
dirdirection we're going to. Must be less than SIZEOFFREE.
Returns
1 if we can see a direct way to get it
Todo:
better document, can't figure what it does :)

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, reduction_dir, diamondslots::x, and diamondslots::y.

Referenced by can_see_monsterP(), do_skill_ident(), monster_find_nearest_enemy(), and spell_find_dir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change_abil()

int change_abil ( object op,
object tmp 
)

Permanently alters an object's stats/flags based on another object.

Returns
1 if we sucessfully changed a stat, 0 if nothing was changed.
Note
flag is set to 1 if we are applying the object, -1 if we are removing the object.
It is the calling functions responsibilty to check to see if the object can be applied or not. The main purpose of calling this function is the messages that are displayed - fix_object should really always be called after this when removing an object - that is because it is impossible to know if some object is the only source of an attacktype or spell attunement, so this function will clear the bits, but the player may still have some other object that gives them that ability.
Todo:
check logic, and things like that. Is the call to fix_object always required?

Definition at line 394 of file living.cpp.

References add_string(), AT_CONFUSION, ATNR_PHYSICAL, BOW, change_attr_value(), change_resist_msg, check_stat_bounds(), CLEAR_FLAG, DIFF_MSG, draw_ext_info(), draw_ext_info_format(), fix_object(), FLAG_APPLIED, FLAG_BLIND, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_UNDEAD, FLAG_WIZ, FLAG_XRAYS, free_string(), gain_msg, get_attr_value(), lose_msg, Settings::max_stat, MIN_STAT, MOVE_FLY_HIGH, MOVE_FLY_LOW, MOVE_SWIM, object::move_type, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_ATTACKTYPE_GAIN, MSG_TYPE_ATTRIBUTE_ATTACKTYPE_LOSS, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START, MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END, MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_START, MSG_TYPE_ATTRIBUTE_MOVE, MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN, MSG_TYPE_ATTRIBUTE_PROTECTION_LOSS, MSG_TYPE_ATTRIBUTE_RACE, MSG_TYPE_ATTRIBUTE_STAT_GAIN, MSG_TYPE_ATTRIBUTE_STAT_LOSS, NDI_BLUE, NDI_UNIQUE, NROFATTACKS, NUM_STATS, object_check_move_on(), give::op, PLAYER, POTION, QUERY_FLAG, object::resist, set_attr_value(), SET_FLAG, settings, SKILL, and Ice::tmp.

Referenced by apply_special(), become_follower(), blind_living(), blindness_type_process(), cast_bless(), cast_change_ability(), cast_curse(), cfapi_object_change_abil(), create_aura(), eat_special_food(), potion_type_apply(), remove_force(), swap_random_stats(), and unapply_special().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change_attr_value()

void change_attr_value ( living stats,
int  attr,
int8_t  value 
)

Like set_attr_value(), but instead the value (which can be negative) is added to the specified stat.

Parameters
statsitem to modify. Must not be NULL.
attrattribute to change.
valuedelta (can be positive).
Todo:
check if attr is valid? Checks result valus is valid?

Definition at line 264 of file living.cpp.

References living::Cha, CHARISMA, living::Con, CONSTITUTION, living::Dex, DEXTERITY, living::Int, INTELLIGENCE, llevError, LOG(), living::Pow, POWER, living::Str, STRENGTH, autojail::value, living::Wis, and WISDOM.

Referenced by add_abilities(), alchemy_failure_effect(), apply_changes_to_player(), change_abil(), drain_specific_stat(), fix_object(), and kill_player_not_permadeath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change_exp()

void change_exp ( object op,
int64_t  exp,
const char *  skill_name,
int  flag 
)

Changes experience to a player/monster. This does bounds checking to make sure we don't overflow the max exp.

The exp passed is typically not modified much by this function - it is assumed the caller has modified the exp as needed. skill_name is the skill that should get the exp added. flag is what to do if player doesn't have the skill. these last two values are only used for players.

Parameters
opvictim to alter.
expexperience to gain (positive) or lose (negative).
skill_nameskill to change. Can be NULL.
flag
  • if experience gain, what to do if player doesn't have the skill
  • if experience loss, whether to remove from all skills or only specified skill
See also
share_exp() for a party-aware version.

Definition at line 2175 of file living.cpp.

References add_player_exp(), ADD_TOTALEXP, FABS, FLAG_ALIVE, level_exp(), llevError, LOG(), MAX_EXPERIENCE, give::op, PLAYER, QUERY_FLAG, subtract_player_exp(), and WEAPON.

Referenced by attempt_do_alchemy(), book_type_apply(), cfapi_object_change_exp(), cure_disease(), do_harvest(), do_hidden_move(), do_skill(), examine_autoidentify(), god_examines_priest(), hit_with_drain(), peacemaker_type_process(), scroll_type_apply(), sell_item(), share_exp(), shop_pay_unpaid_callback(), spellbook_type_apply(), and try_leave_cult().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change_luck()

void change_luck ( object op,
int  value 
)

Alter the object's luck.

Parameters
opobject to altar.
valuedelta to apply. 0 indicates timeout (moves luck towards 0), otherwise change the luck of the object via an applied bad_luck object in inventory.

Definition at line 796 of file living.cpp.

References arch_present_in_ob(), arch_to_object(), FABS, find_archetype(), FLAG_APPLIED, object_insert_in_ob(), give::op, RANDOM, SET_FLAG, Ice::tmp, and autojail::value.

Referenced by fix_luck(), and kill_object().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change_map_light()

int change_map_light ( mapstruct m,
int  change 
)

Used to change map light level (darkness) up or down. It should now be possible to change a value by more than 1.

Move this from los.c to map.c since this is more related to maps than los. postive values make it darker, negative make it brighter

Will inform players on the map.

Parameters
mmap to change.
changedelta of light.
Returns
TRUE if light changed, FALSE else.

Definition at line 1994 of file map.cpp.

References ext_info_map(), m, MAX_DARKNESS, MSG_SUBTYPE_NONE, MSG_TYPE_MISC, NDI_BLACK, and update_all_map_los().

Referenced by cast_change_map_lightlevel(), cfapi_map_change_light(), dawn_to_dusk(), generate_random_map(), and set_darkness_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_altar_sacrifice()

int check_altar_sacrifice ( const object altar,
const object sacrifice,
int  remove_others,
int *  toremove 
)

Checks whether the altar has enough to sacrifice.

Function put in (0.92.1) so that identify altars won't grab money unnecessarily - we can see if there is sufficient money, see if something needs to be identified, and then remove money if needed.

0.93.4: Linked objects (ie, objects that are connected) can not be sacrificed. This fixes a bug of trying to put multiple altars/related objects on the same space that take the same sacrifice.

The function will now check for all items sitting on the altar, so that the player can put various matching but non merging items on the altar.

This function can potentially remove other items, if remove_others is set.

Parameters
altaritem to which there is a sacrifice
sacrificeobject that may be sacrifed
remove_othersif 1, will remove enough items apart sacrifice to compensate for not having enough in sacrifice itself.
[out]toremovewill contain the nrof of sacrifice to really remove to finish operating. Will be set if not NULL only if the function returns 1.
Returns
1 if the sacrifice meets the needs of the altar, 0 else

Definition at line 347 of file button.cpp.

References altar_valkyrie::altar, ARCH_SACRIFICE, FLAG_UNPAID, FOR_ABOVE_FINISH, FOR_ABOVE_PREPARE, llevError, LOG(), matches_sacrifice(), object::nrof, NROF(), NROF_SACRIFICE, object_decrease_nrof(), object_remove(), QUERY_FLAG, ring_occidental_mages::rest, Ice::tmp, and object::value.

Referenced by identify_altar_type_move_on(), and operate_altar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_exp_adjust()

int64_t check_exp_adjust ( const object op,
int64_t  exp 
)

Returns the maximum experience the object can gain or lose.

Parameters
opobject which will be the victim.
expexperience to gain or lose.
Returns
maximum value op can gain or lose (can be positive or negative).

Definition at line 2098 of file living.cpp.

References check_exp_loss(), MAX_EXPERIENCE, MIN, and give::op.

Referenced by command_addexp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_exp_loss()

int64_t check_exp_loss ( const object op,
int64_t  exp 
)

This function checks to make sure that object 'op' can lose 'exp' experience. It basically makes adjustments based on permanent exp and the like. This function should always be used for losing experience - the 'exp' value passed should be positive - this is the amount that should get subtract from the player.

Parameters
opobject from which to subtract.
expexperience to lose.
Returns
the amount of exp object 'op' can in fact lose -

Definition at line 2073 of file living.cpp.

References give::op, PERM_EXP, PERM_EXP_MAX_LOSS_RATIO, Settings::permanent_exp_ratio, and settings.

Referenced by apply_death_exp_penalty(), check_exp_adjust(), kill_object(), and subtract_player_exp().

+ Here is the caller graph for this function:

◆ check_formulae()

bool check_formulae ( void  )

Check if formula don't have the same index.

Since we are doing a squential search on the formulae lists now, we have to be carefull that we dont have 2 formula with the exact same index value. Under the new nbatches code, it is possible to have multiples of ingredients in a cauldron which could result in an index formula mismatch. We *don't *check for that possibility here. -b.t.

LOG() to error level.

Todo:
check archetypes exist, check coherence (skill present, cauldron ok, and such things), set chance to 0 for combinations

Definition at line 292 of file recipe.cpp.

References recipe::arch_name, recipe::arch_names, recipe::cauldron, bigchest::check, formulalist, recipe::index, recipelist::items, llevDebug, llevError, LOG(), recipe::next, recipelist::next, recipe::title, recipe::tool, recipe::tool_size, and try_find_archetype().

Referenced by assets_end_load(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_inv()

void check_inv ( object op,
object trig 
)

Function to search the inventory, of a player and then based on a set of conditions, the square will activate connected items.

Monsters can't trigger this square (for now) Values are: last_sp = 1/0 obj/no obj triggers last_heal = 1/0 remove/dont remove obj if triggered -b.t. (thoma.nosp@m.s@no.nosp@m.mad.a.nosp@m.stro.nosp@m..psu..nosp@m.edu

Parameters
opobject to check. Must be a player.
trigtrigger object that may be activated.

Definition at line 825 of file button.cpp.

References check_inv_recursive(), object::last_heal, object::last_sp, push::match, object_decrease_nrof_by_one, give::op, PLAYER, and use_trigger().

Referenced by check_inv_type_move_on().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_inv_recursive()

object* check_inv_recursive ( object op,
const object trig 
)

Checks object and its inventory for specific item.

It will descend through containers to find the object. slaying = match object slaying flag race = match object archetype name flag hp = match object type (excpt type '0'== PLAYER) title = match object title unpaid = 1 -> match only unpaid, 0 -> match only not unpaid Searching by title only is not recommended, as it can be a rather slow operation; use it in combination with archetype or type.

Parameters
opobject of which to search inventory
trigwhat to search
Returns
object that matches, or NULL if none matched.

Definition at line 782 of file button.cpp.

References check_inv_recursive(), FLAG_UNPAID, FOR_INV_FINISH, FOR_INV_PREPARE, living::hp, give::op, QUERY_FLAG, object::race, object::slaying, object::stats, object::title, and Ice::tmp.

Referenced by blocked_link(), check_inv(), check_inv_recursive(), town_portal_destroy_existing(), and town_portal_find_force().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_path()

int check_path ( const char *  name,
int  prepend_dir 
)

This function checks if a file with the given path exists.

Parameters
namemap path to check.
prepend_dirIf set, then we call create_pathname (which prepends libdir & mapdir). Otherwise, we assume the name given is fully complete.
Returns
-1 if it fails, otherwise the mode of the file is returned.
Note
Only the editor actually cares about the writablity of this - the rest of the code only cares that the file is readable. when the editor goes away, the call to stat should probably be replaced by an access instead (similar to the windows one, but that seems to be missing the prepend_dir processing

Definition at line 201 of file map.cpp.

References buf, create_pathname(), MAX_BUF, give::name, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR, and strlcpy().

Referenced by cfapi_system_check_path(), and check_login().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_recipes()

bool check_recipes ( )

Ensure that all recipes have a valid artifact, and that archetypes are correct.

Definition at line 147 of file recipe.cpp.

References check_recipe(), formulalist, recipelist::items, recipe::next, and recipelist::next.

Referenced by assets_end_load(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_stat_bounds()

void check_stat_bounds ( living stats,
int8_t  min_stat,
int8_t  max_stat 
)

Ensures that all stats (str/dex/con/wis/cha/int) are within the passed in range of min_stat and max_stat. Often, the caller will pass in MIN_STAT and MAX_STAT, but in case of force objects or temporary calculations, we want things outside the range (force objects may have negative stats, but we don't want them too negative)

Parameters
statsattributes to check.
min_statlowest the stat can be
max_stathighest the stat can be

Definition at line 354 of file living.cpp.

References get_attr_value(), NUM_STATS, and set_attr_value().

Referenced by change_abil(), do_symptoms(), fix_object(), fix_player(), and kill_player_not_permadeath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_trigger()

int check_trigger ( object op,
object cause 
)
Todo:
document properly cause != NULL: something has moved on top of op

cause == NULL: nothing has moved, we have been called from animate_trigger().

TRIGGER_ALTAR: Returns 1 if 'cause' was destroyed, 0 if not.

TRIGGER: Returns 1 if handle could be moved, 0 if not.

TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0.

Definition at line 518 of file button.cpp.

References FOR_ABOVE_FINISH, FOR_ABOVE_PREPARE, llevDebug, LOG(), object::move_type, NROF(), NUM_ANIMATIONS, object_update(), object_update_speed(), give::op, operate_altar(), PLAYER, push(), object::race, SET_ANIMATION, Ice::tmp, TRIGGER, TRIGGER_ALTAR, TRIGGER_BUTTON, trigger_move(), TRIGGER_PEDESTAL, object::type, and UP_OBJ_FACE.

Referenced by animate_trigger(), apply_auto_fix(), cfapi_object_check_trigger(), do_auto_apply(), trigger_altar_type_move_on(), trigger_button_type_move_on(), trigger_pedestal_type_move_on(), trigger_type_apply(), and trigger_type_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clean_friendly_list()

void clean_friendly_list ( void  )

It traverses the friendly list removing objects that should not be here (ie, do not have friendly flag set, freed, etc)

Definition at line 80 of file friend.cpp.

References disinfect::count, FLAG_FREED, FLAG_FRIENDLY, friends, say::item, llevDebug, LOG(), and QUERY_FLAG.

Referenced by do_specials(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clean_object()

void clean_object ( object op)

Remove and free all objects in the inventory of the given object.

Parameters
opobject to clean.
Todo:
move to common/object.c ?

Definition at line 1587 of file map.cpp.

References clean_object(), FLAG_IS_LINKED, FOR_INV_FINISH, FOR_INV_PREPARE, object_free_drop_inventory(), object_remove(), give::op, QUERY_FLAG, remove_button_link(), and Ice::tmp.

Referenced by cfapi_object_clean_object(), clean_object(), delete_unique_items(), and free_all_objects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clean_tmp_map()

void clean_tmp_map ( mapstruct m)

Removse the temporary file used by the map.

Parameters
mmap, which mustn't be NULL but can have no temporary file set.

Definition at line 1953 of file map.cpp.

References m, and nlohmann::detail::void().

Referenced by clean_tmp_files(), flush_old_maps(), and ready_map_name().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clear_friendly_list()

void clear_friendly_list ( void  )

Totally clear the friendly list.

Definition at line 134 of file friend.cpp.

References friends.

Referenced by free_globals(), and teardown().

+ Here is the caller graph for this function:

◆ clear_los()

void clear_los ( player pl)

Clears/initialises the los-array associated to the player controlling the object.

Parameters
plplayer to clear.

Definition at line 270 of file los.cpp.

References LOS_NO_DARKNESS, MAP_CLIENT_X, MAP_CLIENT_Y, altar_valkyrie::pl, and nlohmann::detail::void().

Referenced by do_wizard_dm(), get_player(), and update_los().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clear_player()

void clear_player ( player pl)

Clears data in player structure.

Socket isn't touched. Nor is anything that doesn't need to be freed. So you may need to do a memset() to clear out values.

Parameters
plplayer to clear. Pointer is still valid, and can be reused for "play again".

Definition at line 33 of file player.cpp.

References FREE_AND_CLEAR, FREE_AND_CLEAR_STR, FREE_OBJ_NO_DESTROY_CALLBACK, give::next, client_spell::next, object_free(), and altar_valkyrie::pl.

Referenced by free_player(), and get_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_archetype()

object* create_archetype ( const char *  name)

Finds which archetype matches the given name, and returns a new object containing a copy of the archetype.

Parameters
namearchetype name
Returns
object of specified archetype, or a singularity. Will never be NULL.
Todo:
replace with object_create_arch() which is multi-part aware.

Definition at line 278 of file arch.cpp.

References arch_to_object(), create_singularity(), give::name, and try_find_archetype().

Referenced by add_force(), alchemy_failure_effect(), apply_handle_yield(), become_follower(), blind_living(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_create_missile(), cast_create_town_portal(), cast_curse(), cast_spell(), cast_word_of_recall(), change_book(), charge_mana_effect(), command_use(), confuse_living(), converter_type_move_on(), create_aura(), do_artifact(), do_item_conversion(), do_magic(), do_symptoms(), do_test(), eat_special_food(), examine_monster(), find_or_create_connection_for_map(), find_transmution_ob(), fire_swarm(), fix_generated_item(), get_npc(), god_examines_priest(), god_intervention(), grant_immunity(), keyplace(), kill_player_not_permadeath(), local_check_loaded_object(), locate_recipe_artifact(), lock_and_hide_doors(), make_object_glow(), object_handle_death_animation(), CREMainWindow::onReportSpellDamage(), place_alchemy_objects(), place_chest(), place_exits(), potion_type_apply(), pray_at_altar(), prayer_failure(), put_a_monster(), recharge(), save_throw_object(), scroll_failure(), setup(), spell_failure(), START_TEST(), surround_by_doors(), swap_random_stats(), town_portal_destroy_existing(), transmute_item_to_flower(), trap_show(), and write_rune().

+ Here is the call graph for this function:

◆ create_archetype_by_object_name()

object* create_archetype_by_object_name ( const char *  name)

Creates an object given the name that appears during the game (for example, "writing pen" instead of "stylus").

Parameters
namethe name we're searching for (ex: "writing pen"), must not be null
Returns
a corresponding object if found; a singularity object if not found.
Note
Note by MSW - it appears that it takes the full name and keeps shortening it until it finds a match. I re-wrote this so that it doesn't malloc it each time - not that this function is used much, but it otherwise had a big memory leak.

Definition at line 116 of file arch.cpp.

References arch_to_object(), AssetsManager::archetypes(), create_singularity(), Archetypes::findByObjectName(), getManager(), MAX_BUF, and give::name.

Referenced by check_loaded_object(), god_intervention(), local_check_loaded_object(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_overlay_pathname()

void create_overlay_pathname ( const char *  name,
char *  buf,
size_t  size 
)

Same as create_pathname(), but for the overlay maps. /

Parameters
namepath of the overlay map.
bufbuffer that will contain the full path.
sizebuffer's length.

Definition at line 125 of file map.cpp.

References buf, Settings::localdir, Settings::mapdir, give::name, and settings.

Referenced by cfapi_map_create_path(), command_overlay_reset(), load_overlay_map(), map_path(), and save_map().

+ Here is the caller graph for this function:

◆ create_pathname()

char* create_pathname ( const char *  name,
char *  buf,
size_t  size 
)

Get the full path to a map file. This simply means prepending the correct map directory to the given path.

Parameters
namepath of the map.
bufbuffer that will contain the full path.
sizebuffer's length.
Returns
buf.

Definition at line 104 of file map.cpp.

References buf, Settings::datadir, Settings::mapdir, give::name, and settings.

Referenced by cfapi_map_create_path(), check_path(), CREMapInformationManager::checkItem(), enter_fixed_template_map(), map_path(), CREMapInformationManager::process(), process_map(), CREMapInformationManager::recurseStyleDirectory(), and save_map().

+ Here is the caller graph for this function:

◆ create_singularity()

object* create_singularity ( const char *  name)

Creates a dummy object. This function is called by get_archetype() if it fails to find the appropriate archetype. Thus get_archetype() will be guaranteed to always return an object, and never NULL.

Parameters
namename to give the dummy object.
Returns
object of specified name. It fill have the FLAG_NO_PICK flag set.
Note
object_new() will either allocate memory or call fatal(), so returned value is never NULL.

Definition at line 255 of file arch.cpp.

References add_string(), ARCH_SINGULARITY, buf, empty_archetype, FLAG_NO_PICK, MAX_BUF, give::name, object_new(), give::op, and SET_FLAG.

Referenced by create_archetype(), create_archetype_by_object_name(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_template_pathname()

void create_template_pathname ( const char *  name,
char *  buf,
size_t  size 
)

same as create_pathname(), but for the template maps.

Parameters
namepath of the template map.
bufbuffer that will contain the full path.
sizebuf's length

Definition at line 145 of file map.cpp.

References buf, Settings::localdir, give::name, settings, and Settings::templatedir.

Referenced by enter_fixed_template_map(), and enter_random_template_map().

+ Here is the caller graph for this function:

◆ decay_objects()

void decay_objects ( mapstruct m)

Decay and destroy persihable items in a map

Definition at line 175 of file utils.cpp.

References CLOAK, FLAG_IS_FLOOR, FLAG_OBJ_ORIGINAL, FLAG_OVERLAY_FLOOR, FLAG_UNIQUE, FLAG_UNPAID, FOOD, FOR_MAP_FINISH, FOR_MAP_PREPARE, GIRDLE, GLOVES, IS_ARMOR, IS_LIVE, IS_SHIELD, IS_WEAPON, m, M_ADAMANT, M_BONE, M_CLOTH, M_GLASS, M_ICE, M_IRON, M_LEATHER, M_LIQUID, M_ORGANIC, M_PAPER, M_SOFT_METAL, M_STONE, M_WOOD, MAP_HEIGHT, MAP_WIDTH, object_free_drop_inventory(), object_remove(), give::op, QUERY_FLAG, rndm(), diamondslots::x, and diamondslots::y.

Referenced by ready_map_name().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete_map()

void delete_map ( mapstruct m)

Frees the map, including the mapstruct.

This deletes all the data on the map (freeing pointers) and then removes this map from the global linked list of maps.

Parameters
mpointer to mapstruct, if NULL no action. Will be invalid after this function.

Definition at line 1696 of file map.cpp.

References first_map, FREE_AND_CLEAR_STR_IF, free_map(), llevError, LOG(), m, MAP_IN_MEMORY, MAP_SAVING, mapstruct::next, and Ice::tmp.

Referenced by cfapi_map_delete_map(), CREMapInformationManager::checkItem(), flush_old_maps(), free_all_maps(), free_style_maps(), init_dynamic(), key_confirm_quit(), mapfile_load_lowlevel(), monsterFight(), CREMapInformationManager::process(), process_map(), ready_map_name(), START_TEST(), swap_map(), and test_stand_in_light().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ describe_attacktype()

StringBuffer* describe_attacktype ( const char *  attack,
int  value,
StringBuffer buf 
)

Describe the specified attack type.

Parameters
attackstring describing the attack ("Clawing", and such).
valueattack type to describe.
bufwhere to describe, can be NULL.
Returns
buf, newly allocated StringBuffer the caller should free if buf was NULL.

Definition at line 538 of file utils.cpp.

References attacks, buf, NROFATTACKS, stringbuffer_append_printf(), stringbuffer_append_string(), stringbuffer_new(), and autojail::value.

Referenced by describe_item(), and describe_monster().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ describe_god()

int describe_god ( const object god,
int  what,
StringBuffer buf,
size_t  maxlen 
)

Describe a god. The reason we return a combination is to know what exactly was written for knowledge management.

Parameters
godwhich god to describe.
whatinformation to describe, combination of GOD_xxx flags.
bufwhere to describe, must not be NULL.
maxlenmaximum wanted length of the description, if 0 no maximum length.
Returns
information actually written, combination of GOD_xxx, based on maxlen.

Definition at line 109 of file holy.cpp.

References attacktype_desc, buf, describe_resistance(), describe_spellpath_attenuation(), GOD_BLESSED, GOD_ENEMY, GOD_HOLYWORD, GOD_IMMUNITIES, GOD_PATHS, GOD_RESISTANCES, GOD_SACRED, HUGE_BUF, MAX_BUF, object::msg, give::name, object::name, NROFATTACKS, nstrtok(), object::path_attuned, object::path_denied, object::path_repelled, PATH_SUMMON, PATH_TURNING, object::race, object::resist, object::slaying, stringbuffer_append_printf(), stringbuffer_append_string(), stringbuffer_append_stringbuffer(), stringbuffer_finish(), stringbuffer_length(), stringbuffer_new(), strtoktolin(), guildbuy::temp, and object::title.

Referenced by god_info_msg(), and knowledge_god_detail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ describe_item()

StringBuffer* describe_item ( const object op,
const object owner,
int  use_media_tags,
StringBuffer buf 
)

Describes an item, in all its details.

  • If it is a monster, lots of information about its abilities will be returned.
  • If it is an item, lots of information about which abilities will be gained about its user will be returned.
  • If it is a player, it writes out the current abilities of the player, which is usually gained by the items applied.

It would be really handy to actually pass another object pointer on who is examining this object. Then, you could reveal certain information depending on what the examiner knows, eg, wouldn't need to use the SEE_INVISIBLE flag to know it is a dragon player examining food. Could have things like a dwarven axe, in which the full abilities are only known to dwarves, etc.

Add 'owner' who is the person examining this object. owner can be null if no one is being associated with this item (eg, debug dump or the like)

Parameters
opobject to describe. Must not be NULL.
ownerplayer examining the object.
use_media_tagsif non-zero, then media tags (colors and such) are inserted in the description. This enables the player to more easily see some things.
bufbuffer that will contain the description. Can be NULL.
Returns
buf, or new StringBuffer the caller must free if buf was NULL.
Note
This function is really much more complicated than it should be, because different objects have different meanings for the same field (eg, wands use 'food' for charges). This means these special cases need to be worked out.
Todo:
Check whether owner is really needed.

Definition at line 951 of file item.cpp.

References AMULET, ARMOUR, ARMOUR_SPEED, ARMOUR_SPELLS, ARROW, atnr_is_dragon_enabled(), BOOTS, BOW, BRACERS, buf, change_resist_msg, CLOAK, describe_attacktype(), describe_monster(), describe_resistance(), describe_spellpath_attenuation(), DRINK, FLAG_BEEN_APPLIED, FLAG_CURSED, FLAG_LIFESAVE, FLAG_MONSTER, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_REFLECTING, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_XRAYS, FLESH, FMT64, FOOD, FORCE, get_attr_value(), GIRDLE, GLOVES, HELMET, is_dragon_pl(), is_identified(), LAMP, MOVE_FLY_HIGH, MOVE_FLY_LOW, MOVE_SWIM, NUM_STATS, give::op, PLAYER, QUERY_FLAG, RING, ring_desc(), ROD, SHIELD, short_stat_name, SKILL, SKILL_TOOL, stringbuffer_append_printf(), stringbuffer_append_string(), stringbuffer_new(), WAND, WEAPON, and WEAPON_SPEED.

Referenced by artifact_describe(), ArtifactPanel::artifactChanged(), cfapi_object_describe(), common_ob_describe(), dump_abilities(), knowledge_add_probe_monster(), knowledge_monster_detail(), mon_desc(), perceive_self(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ describe_monster()

StringBuffer* describe_monster ( const object op,
int  use_media_tags,
StringBuffer buf 
)

Describes a monster.

Parameters
opmonster to describe. Must not be NULL, and must have FLAG_MONSTER or be a PLAYER.
use_media_tagsif non-zero, then media tags (colors and such) are inserted in the description. This enables the player to more easily see some things.
bufbuffer that will contain the description. Can be NULL.
Returns
buf, or a new StringBuffer the caller should clear if buf was NULL.
Todo:
Rename to describe_living (or equivalent) since called for player too. Fix weird sustenance logic.

Definition at line 777 of file item.cpp.

References buf, describe_attacktype(), describe_resistance(), describe_spellpath_attenuation(), FABS, FLAG_CAN_USE_SKILL, FLAG_CAST_SPELL, FLAG_FRIENDLY, FLAG_HITBACK, FLAG_MONSTER, FLAG_SEE_INVISIBLE, FLAG_STEALTH, FLAG_UNAGGRESSIVE, FLAG_UNDEAD, FLAG_USE_ARMOUR, FLAG_USE_BOW, FLAG_USE_RANGE, FLAG_USE_RING, FLAG_USE_SCROLL, FLAG_USE_WEAPON, is_dragon_pl(), MIN_ACTIVE_SPEED, object_find_by_type_and_name(), give::op, PLAYER, QUERY_FLAG, SKILL, SPELL, stringbuffer_append_printf(), stringbuffer_append_string(), stringbuffer_new(), Floor::t, and Ice::tmp.

Referenced by describe_item(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ describe_resistance()

StringBuffer* describe_resistance ( const object op,
int  newline,
int  use_media_tags,
StringBuffer buf 
)

Generates the visible naming for resistances.

Parameters
opobject we want information about.
newlineIf TRUE, we don't put parens around the description but do put a newline at the end. Useful when dumping to files
use_media_tagsif non-zero, then media tags (colors and such) are inserted in the description. This enables the player to more easily see some things.
bufbuffer that will receive the description. Can be NULL.
Returns
buf, a new StringBuffer the caller should free if buf was NULL.

Definition at line 372 of file item.cpp.

References atnr_is_dragon_enabled(), buf, FLESH, NROFATTACKS, give::op, resist_color, resist_plus, stringbuffer_append_printf(), stringbuffer_append_string(), and stringbuffer_new().

Referenced by describe_god(), describe_item(), describe_monster(), dump_gods(), and ring_desc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ describe_spellpath_attenuation()

StringBuffer* describe_spellpath_attenuation ( const char *  attenuation,
int  value,
StringBuffer buf 
)

Describe the specified path attenuation.

Parameters
attenuationstring describing if "Attenued", "Denied", "Repelled", may be NULL.
valuepath value to describe.
bufwhere to describe, can be NULL.
Returns
buf, newly allocated StringBuffer the caller should free if buf was NULL.

Definition at line 507 of file utils.cpp.

References buf, NRSPELLPATHS, spellpathnames, stringbuffer_append_printf(), stringbuffer_append_string(), stringbuffer_new(), and autojail::value.

Referenced by describe_god(), describe_item(), describe_monster(), ring_desc(), and stringbuffer_append_spelldesc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ did_make_save()

int did_make_save ( const object op,
int  level,
int  bonus 
)

This function takes an object (monster/player, op), and determines if it makes a basic save throw by looking at the save_throw table.

Parameters
oppotential victim.
levelthe effective level to make the save at
bonusany plus/bonus (typically based on resistance to particular attacktype).
Returns
1 if op makes his save, 0 if he failed

Definition at line 2289 of file living.cpp.

References MAX_SAVE_LEVEL, give::op, PREFER_HIGH, random_roll(), and savethrow.

Referenced by flee_player(), hit_player(), hit_with_one_attacktype(), mood_change(), and polymorph_living().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ die_roll()

int die_roll ( int  num,
int  size,
const object op,
int  goodbad 
)

Roll a number of dice (2d3, 4d6). Uses op to determine luck, If goodbad is non-zero, luck increases the roll, if zero, it decreases. Generally, op should be the player/caster/hitter requesting the roll, not the recipient (ie, the poor slob getting hit). The args are num D size (ie 4d6) [garbled 20010916]

Definition at line 122 of file utils.cpp.

References llevError, LOG(), MAX, MIN, give::op, PLAYER, RANDOM, and mail_login::total.

Referenced by attempt_hide(), attempt_pick_lock(), attempt_steal(), fire_swarm(), identify_object_with_skill(), pets_summon_object(), pick_arrow_target(), player_lvl_adj(), scroll_type_apply(), and spellbook_type_apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dirdiff()

int dirdiff ( int  dir1,
int  dir2 
)

Computes a direction difference.

Parameters
dir1
dir2directions to compare.
Returns
how many 45-degrees differences there is between two directions (which are expected to be absolute (see absdir())

Definition at line 3732 of file object.cpp.

Referenced by monster_cast_spell(), monster_use_range(), monster_use_scroll(), and monster_use_skill().

+ Here is the caller graph for this function:

◆ drain_specific_stat()

void drain_specific_stat ( object op,
int  deplete_stats 
)

Drain a specified stat from op.

Parameters
opvictim to drain.
deplete_statsstatistic to drain.

Definition at line 728 of file living.cpp.

References ARCH_DEPLETION, arch_present_in_ob(), arch_to_object(), change_attr_value(), drain_msg, draw_ext_info(), find_archetype(), fix_object(), FLAG_APPLIED, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_STAT_LOSS, NDI_UNIQUE, object_insert_in_ob(), give::op, SET_FLAG, and Ice::tmp.

Referenced by cfapi_object_drain(), drain_stat(), and write_scroll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drain_stat()

void drain_stat ( object op)

Drains a random stat from op. Stat draining by Vick 930307 (Feeling evil, I made it work as well now. -Frank 8)

Parameters
opobject to drain.

Definition at line 716 of file living.cpp.

References drain_specific_stat(), NUM_STATS, give::op, and RANDOM.

Referenced by hit_with_one_attacktype(), and potion_type_apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_abilities()

void dump_abilities ( void  )

Dump to standard out the abilities of all monsters.

Definition at line 65 of file info.cpp.

References AssetsManager::archetypes(), archetype::clone, describe_item(), AssetsCollection< T, Key >::each(), FLAG_CHANGING, FLAG_MONSTER, FMT64, getManager(), HEAD, if(), give::name, archetype::name, object::other_arch, QUERY_FLAG, and stringbuffer_finish().

Referenced by init_beforeplay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_alchemy()

void dump_alchemy ( void  )

Dumps alchemy recipes to output. Borrowed (again) from the artifacts code for this.

Todo:
use LOG() instead of fprintf?

Definition at line 350 of file recipe.cpp.

References recipe::arch_name, recipe::arch_names, buf, recipe::cauldron, recipe::chance, recipe::diff, recipe::exp, formulalist, recipe::index, recipe::ingred, recipelist::items, llevError, locate_recipe_artifact(), LOG(), logfile, MAX_BUF, recipe::next, recipelist::next, give::next, recipelist::number, recipe::skill, strlcpy(), strtoint(), recipe::title, recipelist::total_chance, and try_find_archetype().

Referenced by init_beforeplay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_alchemy_costs()

void dump_alchemy_costs ( void  )

Dumps to output all costs of recipes.

Code copied from dump_alchemy() and modified by Raphael Quinet

Todo:
should use LOG()

Definition at line 588 of file recipe.cpp.

References recipe::arch_name, recipe::arch_names, buf, recipe::chance, archetype::clone, diamondslots::cost, formulalist, recipe::ingred, artifact::item, recipelist::items, llevError, locate_recipe_artifact(), LOG(), logfile, MAX_BUF, recipe::next, recipelist::next, give::next, recipelist::number, recipe_find_ingredient_cost(), recipe::skill, strlcpy(), recipe::title, recipelist::total_chance, try_find_archetype(), object::value, and recipe::yield.

Referenced by init_beforeplay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_all_archetypes()

void dump_all_archetypes ( void  )

Dumps all archetypes to debug-level output. If you run crossfire with debug, and enter DM-mode, you can trigger this with the "dumpallarchetypes" command.

Definition at line 150 of file arch.cpp.

References archininventory::arch, AssetsManager::archetypes(), dump_arch(), AssetsCollection< T, Key >::each(), getManager(), llevDebug, LOG(), stringbuffer_finish(), and stringbuffer_new().

Referenced by command_dumpallarchetypes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_all_maps()

void dump_all_maps ( void  )

Prints out debug-information about all maps. This basically just goes through all the maps and calls dump_map() on each one. Can be used by a DM with the dumpallmaps command.

Definition at line 268 of file map.cpp.

References dump_map(), first_map, and m.

Referenced by command_dumpallmaps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_animations()

void dump_animations ( void  )

Dump all animations to stderr, for debugging purposes.

Definition at line 180 of file anim.cpp.

References animate::anim, AssetsManager::animations(), AssetsCollection< T, Key >::each(), and getManager().

Referenced by server_dump_animations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_arch()

void dump_arch ( archetype at,
StringBuffer sb 
)

Dumps an archetype to buffer.

Parameters
atarchetype to dump. Must not be NULL.
sbbuffer that will contain dumped information.

Definition at line 141 of file arch.cpp.

References archetype::clone, and object_dump().

Referenced by dump_all_archetypes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_artifacts()

void dump_artifacts ( void  )

For debugging purposes. Dumps all tables.

Todo:
use LOG() instead of fprintf.

Definition at line 614 of file artifact.cpp.

References first_artifactlist, artifactlist::items, logfile, artifactlist::next, artifactlist::total_chance, and artifactlist::type.

Referenced by init_beforeplay().

+ Here is the caller graph for this function:

◆ dump_experience()

void dump_experience ( void  )

Dump the experience table, then calls exit() - useful in terms of debugging to make sure the format of the exp_table is correct.

Definition at line 251 of file exp.cpp.

References FMT64, levels, logfile, Settings::max_level, and settings.

◆ dump_faces()

void dump_faces ( void  )

Dump all faces to stderr, for debugging purposes.

Definition at line 159 of file image.cpp.

References AssetsCollection< T, Key >::each(), AssetsManager::faces(), getManager(), Face::name, Face::number, and Face::smoothface.

Referenced by server_dump_faces().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_friendly_objects()

void dump_friendly_objects ( void  )

Dumps all friendly objects. Invoked in DM-mode with dumpfriendlyobjects command.

Note
logs at the error level.

Definition at line 70 of file friend.cpp.

References friends.

Referenced by command_dumpfriendlyobjects().

+ Here is the caller graph for this function:

◆ dump_gods()

◆ dump_map()

void dump_map ( const mapstruct m)

Prints out debug-information about a map. Dumping these at llevError doesn't seem right, but is necessary to make sure the information is in fact logged. Can be used by a DM with the dumpmap command.

Parameters
mmap to dump.

Definition at line 245 of file map.cpp.

References llevError, LOG(), m, MAP_ENTER_X, MAP_ENTER_Y, MAP_HEIGHT, and MAP_WIDTH.

Referenced by command_dumpmap(), and dump_all_maps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_monster_treasure()

void dump_monster_treasure ( const char *  name)

For debugging purposes. Dumps all treasures for a given monster. Created originally by Raphael Quinet for debugging the alchemy code.

Definition at line 1250 of file treasure.cpp.

References AssetsManager::archetypes(), AssetsCollection< T, Key >::each(), is_valid_types_gen::found, getManager(), logfile, give::name, and strcasecmp().

Referenced by init_beforeplay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exp_level()

int exp_level ( int64_t  exp)

Returns the level for a given exp.

Parameters
expexperince points to look up in the level table

Definition at line 1893 of file living.cpp.

References level, levels, Settings::max_level, and settings.

Referenced by show_skills().

+ Here is the caller graph for this function:

◆ fatal()

void fatal ( enum fatal_error  err)

fatal() is meant to be called whenever a fatal signal is intercepted. It will call the emergency_save and the clean_tmp_files functions.

Note
this function never returns, as it calls exit().

Definition at line 590 of file utils.cpp.

References clean_tmp_files(), emergency_save(), Settings::fatal_hook, logfile, and settings.

Referenced by account_alloc(), add_to_tar(), allocate_map(), assets_pack(), bufferreader_create(), bufferreader_init_for_length(), build_stringlist(), check_generators(), do_each_skill(), do_module(), ensure_available_characters(), expand_objects(), get_archetype_struct(), get_client_spell_state(), get_empty_artifact(), get_empty_artifactlist(), get_empty_book(), get_empty_booklist(), get_empty_formula(), get_empty_mat(), get_empty_treasure(), get_linked_map(), get_new_quest_state(), get_objectlink(), get_objectlinkpt(), get_or_create_quest(), get_or_create_state(), get_player(), get_player_archetype(), get_region_struct(), i18n_init(), init_dynamic(), init_experience(), init_formulae(), init_library(), init_listening_socket(), init_recipelist(), init_regions(), init_server(), knowledge_get_or_create(), knowledge_give(), PngLoader::load(), MessageLoader::load(), TreasureLoader::loadTreasure(), minheap_init(), monster_compute_path(), new_connection(), new_shared_string(), object_new(), parse_dialog_information(), parse_shop_string(), player_get_delayed_buffer(), quest_create_condition(), quest_create_step(), re_init(), set_player_socket(), shop_inventory_type_apply(), SockList_Ensure(), stringbuffer_ensure(), and stringbuffer_new().

+ Here is the call graph for this function:

◆ find_animation()

Animations* find_animation ( const char *  name)

Definition at line 274 of file assets.cpp.

References AssetsManager::animations(), AssetsCollection< T, Key >::get(), manager, and give::name.

Referenced by mimic_type_apply(), transport_type_apply(), and while().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_archetype()

◆ find_archetype_by_object_name()

archetype* find_archetype_by_object_name ( const char *  name)

This function retrieves an archetype given the name that appears during the game (for example, "writing pen" instead of "stylus"). It does not use the hashtable system, but browse the whole archlist each time. I suggest not to use it unless you really need it because of performance issue. It is currently used by scripting extensions (create-object). Params:

Parameters
namethe name we're searching for (ex: "writing pen")
Returns
the archetype found or NULL if nothing was found

Definition at line 53 of file arch.cpp.

References AssetsManager::archetypes(), Archetypes::findByObjectName(), getManager(), and give::name.

Referenced by artifact_describe(), artifact_get_face(), cfapi_object_create(), command_create(), knowledge_god_detail(), knowledge_god_validate(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_archetype_by_object_type_name()

archetype* find_archetype_by_object_type_name ( int  type,
const char *  name 
)

This function retrieves an archetype by type and name that appears during the game. It is basically the same as find_archetype_by_object_name() except that it considers only items of the given type.

Parameters
typeitem type we're searching
namethe name we're searching for (ex: "writing pen")

Definition at line 66 of file arch.cpp.

References AssetsManager::archetypes(), Archetypes::findByObjectTypeName(), getManager(), give::name, and is_valid_types_gen::type.

Referenced by cast_create_food(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_artifact()

const artifact* find_artifact ( const object op,
const char *  name 
)

Searches and returns a specific artifact compatible with an object, NULL if not found.

Parameters
opitem to search the artifact for.
nameartifact name.
Returns
matching artifact, NULL if none matched.

Definition at line 589 of file artifact.cpp.

References find_artifactlist(), find_string(), legal_artifact_combination(), guildoracle::list, give::name, give::op, and sstring.

Referenced by add_one_item(), do_single_item(), save_object_in_sb(), and while().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_artifactlist()

artifactlist* find_artifactlist ( int  type)

Finds the artifact list for a certain item type.

Parameters
typeitem type to get the artifacts of.
Returns
NULL if no suitable list found.

Definition at line 574 of file artifact.cpp.

References first_artifactlist, artifactlist::next, artifactlist::type, and is_valid_types_gen::type.

Referenced by artifact_compute_chance_for_item(), artifact_msg(), cast_create_missile(), command_create(), ArtifactWrapper::displayName(), find_artifact(), generate_artifact(), ArtifactLoader::load(), locate_recipe_artifact(), and AssetWithArtifacts< archetype >::updateArtifacts().

+ Here is the caller graph for this function:

◆ find_color()

uint8_t find_color ( const char *  name)

Finds a color by name.

Parameters
namecolor name, case-sensitive.
Returns
the matching color in the coloralias if found, 0 otherwise.
Note
0 will actually be black, so there is no way the calling function can tell if an error occurred or not

Definition at line 75 of file image.cpp.

References colorname, llevError, LOG(), and give::name.

Referenced by FaceLoader::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_dir_2()

int find_dir_2 ( int  x,
int  y 
)

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

Parameters
x
ydelta.
Returns
direction

Definition at line 3677 of file object.cpp.

References item::q, diamondslots::x, and diamondslots::y.

Referenced by enter_map(), get_rangevector(), and get_rangevector_from_mapcoord().

+ Here is the caller graph for this function:

◆ find_face()

const Face* find_face ( const char *  name)

Definition at line 282 of file assets.cpp.

References AssetsManager::faces(), AssetsCollection< T, Key >::get(), manager, and give::name.

Referenced by MessageLoader::load(), FaceLoader::loadAnimationBlock(), and while().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_god()

const object* find_god ( const char *  name)

Returns a god's object from its name.

Note
returned object shouldn't be modified.
Parameters
namegod's name.
Returns
pointer to god's object, NULL if doesn't match any god.

Definition at line 317 of file holy.cpp.

References is_valid_types_gen::found, and gods.

Referenced by become_follower(), cast_bless(), cast_consecrate(), cast_curse(), cast_detection(), cast_smite_spell(), command_setgod(), determine_god(), hit_player(), hit_with_one_attacktype(), mood_change(), perceive_self(), pets_summon_golem(), pets_summon_object(), pray_at_altar(), START_TEST(), and tailor_god_spell().

+ Here is the caller graph for this function:

◆ find_recipe_for_tool()

recipe* find_recipe_for_tool ( const char *  tool,
recipe from 
)

Find a recipe for a specified tool. This function can be called multiple times to browse the whole list, using the 'from' parameter.

Parameters
tooltool's archetype name.
fromformula to search from, if NULL from the first one.
Returns
matching formula, NULL if none matching.

Definition at line 894 of file recipe.cpp.

References formulalist, get_formulalist(), recipe::ingred_count, guildoracle::list, recipe::next, Floor::t, recipe::tool, and recipe::tool_size.

Referenced by command_use().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_smooth()

int find_smooth ( const Face face,
const Face **  smoothed 
)

Find the smooth face for a given face.

Parameters
facethe face to find the smoothing face for
smoothedreturn value: set to smooth face
Returns
1=smooth face found, 0=no smooth face found

Definition at line 102 of file image.cpp.

References Face::smoothface.

Referenced by send_smooth().

+ Here is the caller graph for this function:

◆ find_treasure_by_name()

archetype* find_treasure_by_name ( const treasure t,
const char *  name,
int  depth 
)

Find a treasure with a matching name. The 'depth' parameter is only there to prevent infinite loops in treasure lists (a list referencing another list pointing back to the first one).

Parameters
titem of treasure list to search from
namename we're trying to find. Doesn't need to be a shared string.
depthcurrent depth. Code will exit if greater than 10.
Returns
archetype with name, or NULL if nothing found.

Definition at line 422 of file recipe.cpp.

References find_treasure_by_name(), find_treasurelist(), treasurelist::items, give::name, strcasecmp(), and Floor::t.

Referenced by find_treasure_by_name().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ first_arch_pass()

void first_arch_pass ( FILE *  fp,
const char *  filename 
)

◆ fix_generated_item()

void fix_generated_item ( object op,
object creator,
int  difficulty,
int  max_magic,
int  flags 
)

fix_generated_item(): This is called after an item is generated, in order to set it up right. This produced magical bonuses, puts spells into scrolls/books/wands, makes it unidentified, hides the value, etc.

4/28/96 added creator object from which op may now inherit properties based on op->type. Right now, which stuff the creator passes on is object type dependant. I know this is a spagetti manuever, but is there a cleaner way to do this? b.t.

Parameters
opobject to fix.
creatorfor who op was created. Can be NULL.
difficultydifficulty level.
max_magicmaximum magic for the item.
flags
  • GT_ENVIRONMENT: if not set, calls fix_flesh_item().
  • GT_STARTEQUIP: Sets FLAG_STARTEQUIP on item if appropriate, or clears the item's value.
  • GT_MINIMAL: Does minimal processing on the object - just enough to make it a working object - don't change magic, value, etc, but set it material type as appropriate, for objects that need spell objects, set those, etc

Definition at line 909 of file treasure.cpp.

References add_string(), AMULET, amulet_arch, ARMOUR, BOOK, BRACERS, calc_item_power(), CHANCE_FOR_ARTIFACT, CLOAK, CONTAINER, create_archetype(), create_treasure(), crown_arch, DICE2, fix_flesh_item(), FLAG_ALIVE, FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IS_THROWN, FLAG_MONSTER, FLAG_NO_PICK, FLAG_STARTEQUIP, flags, FREE_AND_COPY, generate_artifact(), GET_ANIM_ID, get_power_from_ench(), GT_ENVIRONMENT, GT_MINIMAL, GT_ONLY_GOOD, GT_STARTEQUIP, HELMET, object::level, level_for_item(), llevDebug, LOG(), MONEY, NUM_ANIMATIONS, object_free_drop_inventory(), object_insert_in_ob(), object_remove(), give::op, POTION, QUERY_FLAG, RANDOM, RING, ring_arch, rndm(), ROD, rod_adjust(), RUNE, SCROLL, SET_ANIMATION, SET_FLAG, set_magic(), set_materialname(), set_ring_bonus(), SHIELD, object::slaying, living::sp, special_potion(), SPELL, spell_mapping, SPELLBOOK, object::stats, tailor_readable_ob(), Ice::tmp, TRAP, trap_adjust(), object::type, WAND, and WEAPON.

Referenced by do_item_conversion(), do_single_item(), god_gives_present(), move_creator(), and polymorph_item().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fix_object()

void fix_object ( object op)

Updates all abilities given by applied objects in the inventory of the given object.

This functions starts from base values (archetype or player object) and then adjusts them according to what the player/monster has equipped.

Note that a player always has stats reset to their initial value.

July 95 - inserted stuff to handle new skills/exp system - b.t. spell system split, grace points now added to system –peterm

November 2006: max armor speed is always taken into account, no exception.

Parameters
opobject to reset.
Todo:
this function is too long, and should be cleaned / split.

Definition at line 1132 of file living.cpp.

References curse_on_apply::ac, add_refcount(), AMULET, ARCH_DEPLETION, ARMOUR, ARMOUR_SPEED, AT_PHYSICAL, ATNR_PHYSICAL, BOOTS, BOW, BRACERS, change_attr_value(), check_stat_bounds(), CLEAR_FLAG, CLOAK, CLOSE_CON, CONTAINER, DISEASE, fix_player(), FLAG_APPLIED, FLAG_BLIND, FLAG_CONFUSED, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_MONSTER, FLAG_PROBE, FLAG_READY_WEAPON, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_UNDEAD, FLAG_USE_ARMOUR, FLAG_WIZ, FLAG_XRAYS, FOR_INV_FINISH, FOR_INV_PREPARE, FORCE, free_string(), get_attr_value(), GIRDLE, GLOVES, HELMET, if(), make_face_from_files::int, IS_COMBAT_SKILL, IS_GRACE_SKILL, IS_MANA_SKILL, object::level, llevDebug, llevInfo, LOG(), MAX, say::max, Settings::max_level, Settings::max_stat, MIN_ACTIVE_SPEED, MOVE_FLY_HIGH, MOVE_FLY_LOW, MOVE_WALK, NROFATTACKS, NUM_BODY_LOCATIONS, NUM_STATS, object_update_speed(), give::op, PLAYER, POTION, POTION_RESIST_EFFECT, QUERY_FLAG, range_bow, range_misc, range_skill, RING, ROD, set_attr_value(), SET_FLAG, settings, SHIELD, SK_PRAYING, SKILL, SKILL_TOOL, Settings::spell_encumbrance, SYMPTOM, Ice::tmp, TRUE, autojail::value, WAND, WEAPON, and WEAPON_SPEED.

Referenced by animate_weapon(), apply_race_and_class(), apply_special(), blind_living(), blindness_type_process(), cast_curse(), cfapi_object_fix(), cfapi_object_set_property(), change_abil(), check_login(), command_abil(), command_brace(), command_drop(), command_dropall(), command_fix_me(), command_possess(), command_search_items(), command_take(), converter_type_apply(), create_aura(), do_light(), do_skill(), do_symptoms(), do_turn(), dragon_eat_flesh(), drain_specific_stat(), drop_object(), eat_special_food(), examine_monster(), fire_bow(), fix_weight(), hit_with_one_attacktype(), improve_armour(), improve_weapon_stat(), key_change_class(), kill_player_not_permadeath(), monster_check_apply_all(), monsterFight(), object_decrease_nrof(), object_insert_in_ob(), object_remove(), pay_for_amount(), pay_for_item(), pick_up_object(), player_changer_type_process(), player_lvl_adj(), poison_living(), poisoning_type_process(), potion_type_apply(), put_object_in_sack(), remove_depletion(), remove_force(), remove_symptoms(), roll_stats(), save_life(), slow_living_by(), START_TEST(), stop_jump(), swap_random_stats(), swap_stat(), and unapply_special().

+ Here is the call graph for this function:

◆ free_all_artifacts()

void free_all_artifacts ( void  )

Free all artifact-related information.

Definition at line 117 of file artifact.cpp.

References first_artifactlist, and free_artifactlist().

Referenced by cleanup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_all_god()

void free_all_god ( void  )

Frees all god information.

Definition at line 327 of file holy.cpp.

References gods.

Referenced by cleanup().

+ Here is the caller graph for this function:

◆ free_all_maps()

void free_all_maps ( void  )

Frees all allocated maps.

Definition at line 1962 of file map.cpp.

References delete_map(), first_map, mapstruct::in_memory, llevDebug, LOG(), MAP_IN_MEMORY, and MAP_SAVING.

Referenced by cleanup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_all_readable()

void free_all_readable ( void  )

Free all readable-related information.

Definition at line 1974 of file readable.cpp.

References title::archname, title::authour, booklist, titlelist::first_book, free_string(), llevDebug, LOG(), title::name, title::next, and titlelist::next.

Referenced by cleanup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_all_recipes()

void free_all_recipes ( void  )

Frees all memory allocated to recipes and recipes lists.

Definition at line 811 of file recipe.cpp.

References recipe::arch_name, recipe::cauldron, recipe::failure_arch, recipe::failure_message, formulalist, free_string(), recipe::ingred, recipelist::items, llevDebug, LOG(), linked_char::name, recipe::next, recipelist::next, give::next, linked_char::next, recipe::skill, recipe::title, and recipe::tool.

Referenced by cleanup(), and init_formulae().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_arch()

void free_arch ( archetype at)

Frees archetype.

Parameters
atarchetype to free. Pointer becomes invalid after the call.

Definition at line 169 of file arch.cpp.

References archetype::clone, free_string(), object::msg, object::name, archetype::name, object::name_pl, object_free_key_values(), object::race, object::slaying, and object::title.

Referenced by asset_destroy(), object_free(), and Archetypes::replace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_charlinks()

void free_charlinks ( linked_char lc)

Frees a link structure and its next items.

Parameters
lcitem to free. Pointer is free()d too, so becomes invalid.

Definition at line 616 of file utils.cpp.

References free_charlinks(), and linked_char::next.

Referenced by free_charlinks(), and send_account_players().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_dialog_information()

void free_dialog_information ( object op)

Frees obj::dialog_information.

Parameters
opwhat to clean for.

Definition at line 32 of file dialog.cpp.

References CLEAR_FLAG, replace::current, FLAG_DIALOG_PARSED, struct_dialog_reply::message, struct_dialog_reply::next, give::next, give::op, QUERY_FLAG, and struct_dialog_reply::reply.

Referenced by copy_message(), object_clear(), object_copy_no_speed(), and object_free().

+ Here is the caller graph for this function:

◆ free_experience()

void free_experience ( void  )

Frees experience-related memory.

Definition at line 263 of file exp.cpp.

References FREE_AND_CLEAR, and levels.

Referenced by free_globals().

+ Here is the caller graph for this function:

◆ free_globals()

void free_globals ( void  )

Cleans all memory allocated for global variables.

Will clear:

  • attack messages
  • emergency map settings
  • friendly list
  • experience
  • regions

Definition at line 440 of file init.cpp.

References all_regions, assets_free(), attack_mess, blocks_prayer, clear_friendly_list(), Settings::emergency_mapname, FREE_AND_CLEAR, FREE_AND_CLEAR_STR, free_experience(), region::jailmap, region::longname, MAXATTACKMESS, navar-midane_pickup::msg, region::msg, region::name, NROFATTACKMESS, settings, and undead_name.

Referenced by cleanup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_loader()

void free_loader ( void  )

Frees all memory allocated by the loader.

Definition at line 39074 of file loader.cpp.

References YY_CURRENT_BUFFER, and yy_delete_buffer().

Referenced by cleanup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_map()

void free_map ( mapstruct m)

Frees everything allocated by the given mapstructure. Don't free tmpname or the reset group - our caller is left to do that. Mapstructure itself is not freed.

Parameters
mmap to free.

Definition at line 1650 of file map.cpp.

References EVENT_MAPUNLOAD, events_execute_global_event(), free_all_objects(), FREE_AND_CLEAR, free_objectlinkpt(), llevError, LOG(), m, and MAP_SWAPPED.

Referenced by delete_map(), CRECombatSimulator::fight(), main(), mapsave_test(), START_TEST(), swap_map(), and teardown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_objectlink()

void free_objectlink ( objectlink ol)

Recursively frees all objectlinks.

Parameters
olobject link to free.

Definition at line 67 of file links.cpp.

References free_objectlink(), and objectlink::next.

Referenced by add_button_link(), command_kill_pets(), command_showpets(), free_objectlink(), free_objectlinkpt(), get_nearest_player(), pets_attempt_follow(), and pets_terminate_all().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_objectlinkpt()

void free_objectlinkpt ( oblinkpt obp)

Recursively frees all linked list of objectlink pointers

Parameters
obppointer to free.

Definition at line 79 of file links.cpp.

References free_objectlink(), free_objectlinkpt(), oblinkpt::link, and oblinkpt::next.

Referenced by free_map(), and free_objectlinkpt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_player()

void free_player ( player pl)

Frees player structure, including pointed object (through object_free_drop_inventory()).

Parameters
plplayer to clear. Pointer is invalid after this call.

Definition at line 68 of file player.cpp.

References clear_player(), first_player, FLAG_REMOVED, llevError, LOG(), player::next, object_free_drop_inventory(), object_remove(), altar_valkyrie::pl, and QUERY_FLAG.

Referenced by final_free_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generate_artifact()

void generate_artifact ( object op,
int  difficulty 
)

Decides randomly which artifact the object should be turned into. Makes sure that the item can become that artifact (means magic, difficulty, and Allowed fields properly). Then calls give_artifact_abilities in order to actually create the artifact.

Parameters
opobject to attempt to transform.
difficultylimit for artifact difficulty.
Note
if the algorithm is changed, please update artifact_compute_chance_for_item above.

Definition at line 177 of file artifact.cpp.

References ARTIFACT_TRIES, FABS, find_artifactlist(), give_artifact_abilities(), artifact::item, artifactlist::items, legal_artifact_combination(), llevDebug, llevError, LOG(), object::magic, object::name, give::op, ring_occidental_mages::r, RANDOM, and artifactlist::total_chance.

Referenced by alchemy_failure_effect(), fix_generated_item(), generate_monster_arch(), generate_monster_inv(), place_monsters(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_archetype_by_skill_name()

archetype* get_archetype_by_skill_name ( const char *  skill,
int  type 
)

Retrieves an archetype by skill name and type. This is a lot like the other get_archetype_ functions, with different options.

Parameters
skillskill to search for. Must not be NULL.
typeitem type to search for. -1 means that it doesn't matter.
Returns
matching archetype, or NULL if none found.

Definition at line 80 of file arch.cpp.

References AssetsManager::archetypes(), Archetypes::findBySkillNameAndType(), getManager(), and is_valid_types_gen::type.

Referenced by examine_fluff(), give_skill_by_name(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_archetype_by_type_subtype()

archetype* get_archetype_by_type_subtype ( int  type,
int  subtype 
)

Retrieves an archetype by type and subtype. Similiar to other get_archetype_ functions. This returns the first archetype that matches both the type and subtype. type and subtype can be -1 to say ignore, but in this case, the match it does may not be very useful. This function is most useful when subtypes are known to be unique for a particular type (eg, skills)

Parameters
typeobject type to search for. -1 means any
subtypeobject subtype to search for. -1 means any
Returns
matching archetype, or NULL if none found.

Definition at line 99 of file arch.cpp.

References AssetsManager::archetypes(), Archetypes::findByTypeSubtype(), getManager(), and is_valid_types_gen::type.

Referenced by become_follower(), create_player_cmd(), init_dynamic(), START_TEST(), and write_on_item().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_archetype_struct()

archetype* get_archetype_struct ( void  )

Allocates, initialises and returns the pointer to an archetype structure.

Returns
new archetype structure, will never be NULL.
Note
this function will call fatal() if it can't allocate memory.

Definition at line 195 of file arch.cpp.

References archininventory::arch, CALLOC, CLEAR_FLAG, fatal(), FLAG_FREED, FLAG_REMOVED, object_clear(), OUT_OF_MEMORY, and SET_FLAG.

Referenced by ArchetypesWrapper::addArchetype(), asset_create(), check_loaded_object(), ArchetypeLoader::load(), local_check_loaded_object(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_attr_value()

int8_t get_attr_value ( const living stats,
int  attr 
)

◆ get_button_value()

int get_button_value ( const object button)

Returns the first value linked to this button. Made as a separate function to increase efficiency

Parameters
buttonobject to check. Must not be NULL.
Returns
connection value, or 0 if not connected.

Definition at line 749 of file button.cpp.

References mapstruct::buttons, object::count, objectlink::id, oblinkpt::link, object::map, objectlink::next, oblinkpt::next, objectlink::ob, and oblinkpt::value.

Referenced by examine(), and get_ob_diff().

+ Here is the caller graph for this function:

◆ get_cha_bonus()

int get_cha_bonus ( int  stat)

Definition at line 2357 of file living.cpp.

◆ get_cleric_chance()

int get_cleric_chance ( int  stat)

Definition at line 2377 of file living.cpp.

◆ get_client_spell_state()

client_spell* get_client_spell_state ( player pl,
object spell 
)

Gets the (client-side) spell state for specified spell. Will be created to empty state if not found.

Note
will fatal() in case of memory allocation failure.
Parameters
plplayer we're handling.
spellspell for which to search data.
Returns
state information for that spell.

Definition at line 144 of file player.cpp.

References fatal(), client_spell::next, OUT_OF_MEMORY, altar_valkyrie::pl, and client_spell::spell.

Referenced by append_spell(), and esrv_update_spells().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_colorname()

const char* get_colorname ( uint8_t  index)

Definition at line 86 of file image.cpp.

References colorname, and npc_dialog::index.

Referenced by CREFacePanel::CREFacePanel(), and FaceWriter::write().

+ Here is the caller graph for this function:

◆ get_dam_bonus()

int get_dam_bonus ( int  stat)

Definition at line 2385 of file living.cpp.

◆ get_dex_bonus()

int get_dex_bonus ( int  stat)

Definition at line 2361 of file living.cpp.

◆ get_dialog_message()

int get_dialog_message ( object op,
const char *  text,
struct_dialog_message **  message,
struct_dialog_reply **  reply 
)

Tries to find a message matching the said text.

Parameters
opwho is being talked to.
textwhat is being said.
[out]messagewhat op should say. Won't be NULL if return is 1.
[out]replytext the one talking should say based on the text. Can be NULL.
Returns
0 if no match, 1 if a message did match the text.
Todo:
smarter match, try to find exact before joker (*) one.

Definition at line 213 of file dialog.cpp.

References FLAG_DIALOG_PARSED, matches(), diamondslots::message, give::op, parse_dialog_information(), QUERY_FLAG, say::reply, and guild_entry::text.

Referenced by monster_do_talk_npc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_empty_artifact()

artifact* get_empty_artifact ( void  )

Allocate and return the pointer to an empty artifact structure.

Returns
new structure blanked, never NULL.
Note
will fatal() if memory error.

Definition at line 55 of file artifact.cpp.

References fatal(), OUT_OF_MEMORY, and Floor::t.

Referenced by ArtifactLoader::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_empty_artifactlist()

artifactlist* get_empty_artifactlist ( void  )

Allocate and return the pointer to an empty artifactlist structure.

Returns
new structure blanked, never NULL.
Note
will fatal() if memory error.

Definition at line 37 of file artifact.cpp.

References fatal(), artifactlist::next, OUT_OF_MEMORY, and artifactlist::total_chance.

Referenced by ArtifactLoader::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_empty_map()

mapstruct* get_empty_map ( int  sizex,
int  sizey 
)

Creates and returns a map of the specific size. Used in random map code and the editor.

Parameters
sizex
sizeymap size.
Returns
new map.
Note
will never return NULL, as get_linked_map() never fails.

Definition at line 842 of file map.cpp.

References allocate_map(), get_linked_map(), m, and MAP_SWAPPED.

Referenced by cfapi_map_get_map(), do_map(), do_test(), CRECombatSimulator::fight(), make_map_floor(), monsterFight(), setup(), START_TEST(), and test_stand_in_light().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_face_by_id()

const Face* get_face_by_id ( uint16_t  id)

Get a face from its unique identifier.

Parameters
idface identifier.
Returns
matching face, NULL if no face with this identifier.
Todo:
move back to image.c when migrated

Definition at line 315 of file assets.cpp.

References AssetsManager::faces(), Faces::findById(), and manager.

Referenced by ask_smooth_cmd(), cfapi_system_find_face(), send_face_cmd(), send_image_sums(), and test_faceset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_face_fallback()

int get_face_fallback ( int  faceset,
uint16_t  imageno 
)

This returns the set we will actually use when sending a face. This is used because the image files may be sparse. This function is recursive. imageno is the face number we are trying to send

If face is not found in specified faceset, tries with 'fallback' faceset.

Parameters
facesetfaceset to check
imagenoimage number

Definition at line 133 of file image.cpp.

References face_info::data, face_sets::faces, face_sets::fallback, find_faceset(), get_face_fallback(), face_sets::id, llevError, LOG(), and face_sets::prefix.

Referenced by esrv_send_face(), get_face_fallback(), process_map(), send_image_sums(), and test_faceset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_faces_count()

size_t get_faces_count ( void  )

Definition at line 293 of file assets.cpp.

References AssetsCollection< T, Key >::count(), AssetsManager::faces(), and manager.

Referenced by init_connection(), main(), monsterFight(), new_connection(), reset_faces_sent(), send_image_info(), send_image_sums(), START_TEST(), and test_faceset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_fear_bonus()

int get_fear_bonus ( int  stat)

Definition at line 2393 of file living.cpp.

◆ get_formulalist()

recipelist* get_formulalist ( int  i)

Gets a formula list by ingredients count.

Parameters
inumber of ingredients.
Returns
pointer to the formula list, or NULL if it doesn't exist.

Definition at line 98 of file recipe.cpp.

References formulalist, and recipelist::next.

Referenced by alchemy_failure_effect(), alchemyTable(), attempt_do_alchemy(), RecipesWrapper::child(), RecipesWrapper::childIndex(), ArtifactPanel::computeMadeViaAlchemy(), find_recipe_for_tool(), get_random_recipelist(), knowledge_alchemy_get_recipe(), ResourcesManager::load(), make_formula_book(), CREMainWindow::onReportAlchemyGraph(), and pack_formulae().

+ Here is the caller graph for this function:

◆ get_friends_of()

objectlink* get_friends_of ( const object owner)

Get a list of friendly objects for the specified owner.

Parameters
ownerwho to get objects of, may be NULL to get all friendly objects.
Returns
list of objects that must be freed with free_objectlink(), may be NULL.

Definition at line 117 of file friend.cpp.

References friends, and guildoracle::list.

Referenced by command_kill_pets(), command_showpets(), get_nearest_player(), pets_attempt_follow(), pets_terminate_all(), and START_TEST().

+ Here is the caller graph for this function:

◆ get_god_for_race()

const char* get_god_for_race ( const char *  race)

Returns a string that is the name of the god that should be natively worshipped by a creature of who has race *race if we can't find a god that is appropriate, we return NULL

Parameters
racerace we're getting the god of.
Returns
NULL if no matching race, else god's name.

Definition at line 90 of file holy.cpp.

References gods.

Referenced by determine_god(), and START_TEST().

+ Here is the caller graph for this function:

◆ get_jail_exit()

object* get_jail_exit ( object op)

Returns an object which is an exit through which the player represented by op should be sent in order to be imprisoned. If there is no suitable place to which an exit can be constructed, then NULL will be returned. The caller is responsible for freeing the object created by this function.

Parameters
opObject we want to jail. Must be a player.
Returns
exit to jail, or NULL, in which case a message is LOG()ged .

Definition at line 253 of file region.cpp.

References add_string(), EXIT_PATH, EXIT_X, EXIT_Y, FLAG_DAMNED, get_region_by_map(), region::jailmap, region::jailx, region::jaily, llevDebug, llevError, LOG(), region::name, object_new(), give::op, region::parent, PLAYER, and SET_FLAG.

Referenced by player_arrest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_learn_spell()

int get_learn_spell ( int  stat)

Definition at line 2373 of file living.cpp.

◆ get_levelnumber()

void get_levelnumber ( int  i,
char *  buf,
size_t  size 
)

◆ get_linked_map()

mapstruct* get_linked_map ( void  )

Allocates, initialises, and returns a pointer to a mapstruct, linked through first_map.

Returns
new structure.
Note
will never return NULL, but call fatal() if memory error.

Definition at line 776 of file map.cpp.

References fatal(), first_map, disinfect::map, MAP_ENTER_X, MAP_ENTER_Y, MAP_HEIGHT, MAP_RESET_TIMEOUT, MAP_SWAPPED, MAP_WIDTH, and OUT_OF_MEMORY.

Referenced by get_empty_map(), mapfile_load_lowlevel(), mapsave_test(), and read_map_log().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_map_flags()

int get_map_flags ( mapstruct oldmap,
mapstruct **  newmap,
int16_t  x,
int16_t  y,
int16_t *  nx,
int16_t *  ny 
)

This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_.. value (see map.h) it will also do map translation for tiled maps, returning new values into newmap, nx, and ny. Any and all of those values can be null, in which case if a new map is needed (returned by a P_NEW_MAP value, another call to get_map_from_coord is needed. The case of not passing values is if we're just checking for the existence of something on those spaces, but don't expect to insert/remove anything from those spaces.

Parameters
oldmapmap for which we want information.
newmapif not NULL, will contain the actual map checked if not oldmap.
x
ycoordinates to check
nx
nyif not NULL, will contain the actual coordinates checked.
Returns
flags for specified position, with maybe P_OUT_OF_MAP or P_NEW_MAP set.

Definition at line 300 of file map.cpp.

References MapSpace::flags, get_map_from_coord(), P_NEW_MAP, P_OUT_OF_MAP, mapstruct::spaces, mapstruct::width, diamondslots::x, and diamondslots::y.

Referenced by alchemy(), animate_weapon(), armour_improver_type_apply(), attempt_jump(), can_see_monsterP(), cast_cause_disease(), cast_cone(), cast_create_obj(), cast_destruction(), cast_detection(), cast_earth_to_dust(), cast_light(), cast_polymorph(), cast_raise_dead_spell(), cast_spell(), cast_transfer(), cfapi_map_get_map_property(), cfapi_map_get_object_at(), check_bullet(), check_infection(), check_wall(), command_save(), common_process_projectile(), counterspell(), create_bomb(), dimension_door(), dispel_rune(), do_harvest(), do_skill_ident(), do_throw(), draw_client_map(), eventListener(), expand_lighted_sight(), expand_sight(), find_target_for_friendly_spell(), find_traps(), fire_arch_from_position(), fire_bolt(), fire_bow(), forklightning(), get_pointed_target(), hideability(), hit_map(), legacy_monster_stand_in_light(), magic_mapping_mark(), magic_mapping_mark_recursive(), magic_wall(), monster_communicate(), monster_find_nearest_enemy(), monster_npc_call_help(), mood_change(), move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_ob(), move_player_mover(), move_swarm_spell(), move_to(), ob_blocked(), object_find_multi_free_spot_within_radius(), ok_to_put_more(), path_to_player(), pets_get_enemy(), pets_move(), pets_move_golem(), pick_arrow_target(), probe(), process_players1(), remove_adjacent_doors(), remove_trap(), roll_ob(), singing(), skill_attack(), spell_failure(), spell_find_dir(), stand_near_hostile(), steal(), teleport(), try_fit(), use_oratory(), weapon_improver_type_apply(), and write_rune().

+ Here is the call graph for this function:

◆ get_map_from_coord()

mapstruct* get_map_from_coord ( mapstruct m,
int16_t *  x,
int16_t *  y 
)

This is basically the same as out_of_map above(), but instead we return NULL if no map is valid (coordinates out of bounds and no tiled map), otherwise it returns the map as that the coordinates are really on, and updates x and y to be the localized coordinates. Using this is more efficient than calling out_of_map and then figuring out what the real map is

Parameters
mmap we want to look at. Must not be NULL.
x
ycoordinates, which will contain the real position that was checked.
Returns
map that is at specified location. Will be NULL if not on any map.
Note
refactored to remove the recursion. This should help stack space and optimization.

Definition at line 2321 of file map.cpp.

References load_and_link_tiled_map(), m, MAP_HEIGHT, MAP_IN_MEMORY, MAP_SWAPPED, MAP_WIDTH, OUT_OF_REAL_MAP, diamondslots::x, and diamondslots::y.

Referenced by cfapi_map_get_map(), draw_client_map2(), get_map_flags(), look_at(), monster_stand_in_light_internal(), monster_use_bow(), move_player_attack(), object_insert_in_map(), object_remove(), out_of_map(), and pets_move().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_message_body()

sstring get_message_body ( const GeneralMessage message)

Get a message's body.

Parameters
messagemessage, must not be NULL.
Returns
body.

Definition at line 2077 of file readable.cpp.

References diamondslots::message.

Referenced by knowledge_message_detail().

+ Here is the caller graph for this function:

◆ get_message_face()

const Face* get_message_face ( const GeneralMessage message)

Get a message's face.

Parameters
messagemessage, must not be NULL.
Returns
face, NULL if not defined.

Definition at line 2086 of file readable.cpp.

References diamondslots::message.

Referenced by knowledge_message_face().

+ Here is the caller graph for this function:

◆ get_message_from_identifier()

const GeneralMessage* get_message_from_identifier ( const char *  identifier)

Find the message from its identifier.

Parameters
identifiermessage's identifier.
Returns
corresponding message, NULL if no such message.

Definition at line 324 of file assets.cpp.

References AssetsCollection< T, Key >::find(), manager, and AssetsManager::messages().

Referenced by knowledge_message_detail(), knowledge_message_face(), knowledge_message_summary(), and knowledge_message_validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_message_title()

sstring get_message_title ( const GeneralMessage message)

Get a message's title.

Parameters
messagemessage, must not be NULL.
Returns
title.

Definition at line 2068 of file readable.cpp.

References diamondslots::message.

Referenced by knowledge_message_summary().

+ Here is the caller graph for this function:

◆ get_month_name()

const char* get_month_name ( const int  index)

give access to month names

Definition at line 113 of file time.cpp.

References npc_dialog::index, month_name, and MONTHS_PER_YEAR.

Referenced by cfapi_get_month_name(), and START_TEST().

+ Here is the caller graph for this function:

◆ get_name_of_region_for_map()

const char* get_name_of_region_for_map ( const mapstruct m)

Gets the name of a region for a map.

Since we won't assume all maps have a region set properly, we need an explicit check that it is, this is much nicer here than scattered throughout the map code.

Parameters
mmap
Returns
  • region's name if map has a region
  • if no region is set for the map, returns the first region with the 'fallback' property
  • if no fallback region, LOG()s an info message and returns "unknown".

Definition at line 90 of file region.cpp.

References all_regions, llevInfo, LOG(), and m.

Referenced by current_region_info(), get_region_by_map(), get_who_escape_code_value(), and pick_bg_music().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_next_archetype()

archetype* get_next_archetype ( archetype current)

Definition at line 262 of file assets.cpp.

References AssetsManager::archetypes(), replace::current, manager, and AssetsCollection< T, Key >::next().

Referenced by artifact_get_face(), cfapi_archetype_get_property(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_next_friend()

object* get_next_friend ( object current)

Get the next object on the friendly list.

Parameters
currentcurrent object, NULL to get the first item on the list.
Returns
next item, NULL if no more items or current isn't on the list.

Definition at line 143 of file friend.cpp.

References replace::current, and friends.

Referenced by cfapi_friendlylist_get_next(), cfapi_system_get_object_vector(), and START_TEST().

+ Here is the caller graph for this function:

◆ 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

Parameters
sbbuffer that will contain the difference.
opwhat object the different values will be taken from.
op2object'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::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, object::name, object::name_pl, key_value::next, object::nrof, NROFATTACKS, NUM_BODY_LOCATIONS, object_get_key_value(), give::op, 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, Ice::tmp, 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(), START_TEST(), ArtifactPanel::updateItem(), and ArtifactWriter::write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_objectlink()

objectlink* get_objectlink ( void  )

Allocates a new objectlink structure, initialises it, and returns a pointer to it.

Note
will call fatal() if memory allocation failure, thus never return NULL.
Returns
new link object, cleared.

Definition at line 33 of file links.cpp.

References fatal(), and OUT_OF_MEMORY.

Referenced by add_button_link().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_objectlinkpt()

oblinkpt* get_objectlinkpt ( void  )

Allocates a new oblinkpt structure, initialises it, and returns a pointer to it.

Note
will call fatal() if memory allocation failure, thus never return NULL.
Returns
new link pointer.

Definition at line 51 of file links.cpp.

References fatal(), and OUT_OF_MEMORY.

Referenced by add_button_link().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_periodofday()

const char* get_periodofday ( const int  index)

give access to weekday names

Definition at line 106 of file time.cpp.

References npc_dialog::index, PERIODS_PER_DAY, and periodsofday.

Referenced by cfapi_get_periodofday_name().

+ Here is the caller graph for this function:

◆ get_power_from_ench()

int get_power_from_ench ( int  ench)

Definition at line 212 of file item.cpp.

References enc_to_item_power.

Referenced by calc_item_power(), and fix_generated_item().

+ Here is the caller graph for this function:

◆ get_rand_god()

const object* get_rand_god ( void  )

Returns a random god.

Returns
a random god, or NULL if no god was found.

Definition at line 73 of file holy.cpp.

References gods, and RANDOM.

Referenced by determine_god(), god_info_msg(), and START_TEST().

+ Here is the caller graph for this function:

◆ get_random_dir()

int get_random_dir ( void  )

Returns a random direction (1..8).

Returns
the random direction.

Definition at line 400 of file utils.cpp.

References rndm().

Referenced by move_firewall(), move_player_mover(), move_swarm_spell(), and pets_move().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_random_mon()

object* get_random_mon ( int  level)

Returns a random monster selected from linked list of all monsters in the current game. Changed 971225 to be greater than equal to level passed. Also made choosing by level more random.

Parameters
levelif non-zero, then only monsters greater than that level will be returned.
Returns
random monster, or NULL if failure.

Definition at line 1269 of file readable.cpp.

References llevError, LOG(), monsters, guildjoin::ob, and RANDOM.

Referenced by alchemy_failure_effect(), and mon_info_msg().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_random_recipe()

recipe* get_random_recipe ( recipelist rpl)

Gets a random recipe from a list, based on chance.

Parameters
rplrecipelist we want a recipe from. Can be NULL in which case a random one is selected.
Returns
random recipe. Can be NULL if recipelist has a total_chance of 0.

Definition at line 787 of file recipe.cpp.

References recipe::chance, get_random_recipelist(), recipelist::items, recipe::next, ring_occidental_mages::r, RANDOM, and recipelist::total_chance.

Referenced by alchemy_failure_effect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_randomized_dir()

int get_randomized_dir ( int  dir)

Returns a random direction (1..8) similar to a given direction.

Parameters
dirthe exact direction
Returns
the randomized direction

Definition at line 412 of file utils.cpp.

References absdir(), and RANDOM.

Referenced by face_player(), monster_cast_spell(), monster_move(), monster_use_bow(), monster_use_range(), monster_use_scroll(), monster_use_skill(), and move_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_rangevector()

int get_rangevector ( object op1,
const object op2,
rv_vector retval,
int  flags 
)

From map.c This is used by get_player to determine where the other creature is. get_rangevector takes into account map tiling, so you just can not look the the map coordinates and get the right value. distance_x/y are distance away, which can be negative. direction is the crossfire direction scheme that the creature should head. part is the part of the monster that is closest.

get_rangevector looks at op1 and op2, and fills in the structure for op1 to get to op2. We already trust that the caller has verified that the two objects are at least on adjacent maps. If not, results are not likely to be what is desired.

Parameters
op1object which wants to go to op2's location.
op2target of op1.
retvalvector for op1 to go to op2.
flagsif 1, don't translate for closest body part of 'op1'
Returns
1=ok; 0=the objects are not on the same map

Definition at line 2492 of file map.cpp.

References adjacent_map(), rv_vector::direction, rv_vector::distance, rv_vector::distance_x, rv_vector::distance_y, find_dir_2(), flags, ihypot(), object::map, object::more, rv_vector::part, Ice::tmp, object::x, and object::y.

Referenced by command_follow(), do_follow(), flee_player(), monster_can_detect_enemy(), monster_can_hit(), monster_cast_spell(), monster_find_enemy(), monster_move(), monster_use_bow(), monster_use_range(), monster_use_scroll(), monster_use_skill(), move_towards(), path_to_player(), pets_get_enemy(), pets_move(), player_can_view(), and spring_trap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_rangevector_from_mapcoord()

int get_rangevector_from_mapcoord ( const mapstruct m,
int  x,
int  y,
const object op2,
rv_vector retval 
)

This is basically the same as get_rangevector() above, but instead of the first parameter being an object, it instead is the map and x,y coordinates - this is used for path to player - since the object is not infact moving but we are trying to traverse the path, we need this. Since no object is pasted, the best field of the rv_vector is set to NULL.

Parameters
mmap to consider.
x
yorigin coordinates.
op2target object.
retvalvector to get to op2.
Returns
1=ok; 0=the objects are not on the same map

Definition at line 2560 of file map.cpp.

References adjacent_map(), rv_vector::direction, rv_vector::distance, rv_vector::distance_x, rv_vector::distance_y, find_dir_2(), isqrt(), m, object::map, rv_vector::part, diamondslots::x, object::x, diamondslots::y, and object::y.

Referenced by path_to_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_readable_message_type()

const readable_message_type* get_readable_message_type ( object readable)

Get the readable type for an object (hopefully book).

Parameters
readableobject for which we want the readable type.
Returns
type of the book. Will never be NULL.

Definition at line 2055 of file readable.cpp.

References last_readable_subtype, readable_message_types, and object::subtype.

Referenced by apply_sign(), book_type_apply(), and spellbook_type_apply().

+ Here is the caller graph for this function:

◆ get_region_by_map()

region* get_region_by_map ( mapstruct m)

Gets a region from a map.

Parameters
mmap we want the region of.
Returns
region.
Todo:
This might need optimising at some point.

Definition at line 72 of file region.cpp.

References get_name_of_region_for_map(), get_region_by_name(), and m.

Referenced by add_region_link(), cfapi_map_get_map_property(), command_whereabouts(), current_map_info(), enter_random_map(), enter_random_template_map(), get_jail_exit(), get_who_escape_code_value(), list_players(), process_map(), and ring_bell().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_region_by_name()

region* get_region_by_name ( const char *  region_name)

Gets a region by name.

Used by the map parsing code.

Parameters
region_namename of region.
Returns
  • matching region
  • if no match, returns the first region with the 'fallback' property set and LOG()s to debug.
  • if it can't find a matching name and a fallback region it LOG()s an info message and returns NULL.

Definition at line 46 of file region.cpp.

References all_regions, llevDebug, llevInfo, and LOG().

Referenced by current_region_info(), get_region_by_map(), init_regions(), load_map_header(), CREMainWindow::mapAdded(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_region_from_string()

region* get_region_from_string ( const char *  name)

Tries to find a region that 'name' corresponds to. It looks, in order, for:

  • an exact match to region name (case insensitive)
  • an exact match to longname (case insensitive)
  • a substring that matches to the longname (eg Kingdom)
  • a substring that matches to the region name (eg nav)
  • if it can find none of these it returns the first parentless region (there should be only one of these - the top level one) An empty region name returns the top level region
Parameters
nameregion we're searching.
Returns
matching region.

Definition at line 117 of file region.cpp.

References all_regions, region::longname, give::name, region::name, region::parent, and strcasecmp().

Referenced by command_who(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_region_longname()

const char* get_region_longname ( const region r)

Gets the longname of a region.

The longname of a region is not a required field, any given region may want to not set it and use the parent's one instead.

Parameters
rregion we're searching the longname.
Returns
  • if a longname is set return it.
  • if there is a parent, call the function against that
  • if all fails, return a obviously wrong string if we can't get a longname, this should never happen. We also LOG() a debug message.

Definition at line 210 of file region.cpp.

References get_region_longname(), llevDebug, LOG(), and ring_occidental_mages::r.

Referenced by command_whereabouts(), current_map_info(), current_region_info(), get_region_longname(), get_who_escape_code_value(), and RegionWrapper::longName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_region_msg()

const char* get_region_msg ( const region r)

Gets a message for a region.

Parameters
rregion. Can't be NULL.
Returns
  • region's message if set
  • message of parent else
  • obviously wrong message if no parent, and we LOG() a debug message.

Definition at line 231 of file region.cpp.

References get_region_msg(), llevDebug, LOG(), and ring_occidental_mages::r.

Referenced by current_region_info(), get_region_msg(), and RegionWrapper::message().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_region_struct()

region* get_region_struct ( void  )

Allocates and zeros a region struct, this isn't free()'d anywhere, so might be a memory leak, but it shouldn't matter too much since it isn't called that often....

Returns
initialised region structure.
Note
will never fail, as a memory allocation error calls fatal().
Todo:
free those pointers someday? :)

Definition at line 294 of file region.cpp.

References fatal(), and OUT_OF_MEMORY.

Referenced by init_regions(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_search_arr()

void get_search_arr ( int *  search_arr)

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

Parameters
search_arrarray 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_season_name()

const char* get_season_name ( const int  index)

give access to season names

Definition at line 127 of file time.cpp.

References npc_dialog::index, season_name, and SEASONS_PER_YEAR.

Referenced by cfapi_get_season_name(), and START_TEST().

+ Here is the caller graph for this function:

◆ get_sleep_remaining()

long get_sleep_remaining ( void  )

Definition at line 189 of file time.cpp.

References game_time, log_time(), tick_duration, and timespec_diff().

Referenced by do_server().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_speed_bonus()

float get_speed_bonus ( int  stat)

Definition at line 2389 of file living.cpp.

◆ get_thaco_bonus()

int get_thaco_bonus ( int  stat)

Definition at line 2365 of file living.cpp.

◆ get_tod()

void get_tod ( timeofday_t tod)

Computes the ingame time of the day.

Parameters
[out]todwhere to store information. Must not be NULL.

Definition at line 219 of file time.cpp.

◆ get_turn_bonus()

int get_turn_bonus ( int  stat)

Definition at line 2381 of file living.cpp.

◆ get_typedata()

const typedata* get_typedata ( int  itemtype)
Parameters
itemtypeitem type for which to return typedata.
Returns
typedata that has a number equal to itemtype, if there isn't one, returns NULL

Definition at line 323 of file item.cpp.

References item_types, and item_types_size.

Referenced by cost_approx_str(), ArtifactListWrapper::displayName(), examine_autoidentify(), is_identifiable_type(), CREMainWindow::onReportArchetypes(), parse_shop_string(), price_approx(), and skill_ident().

+ Here is the caller graph for this function:

◆ get_typedata_by_name()

const typedata* get_typedata_by_name ( const char *  name)
Parameters
nameitem name for which to return typedata. Singular form is preferred.
Returns
typedata that has a name equal to itemtype, if there isn't one, return the plural name that matches, if there still isn't one return NULL
Note
will emit an Info if found by plural form.

Definition at line 343 of file item.cpp.

References item_types, item_types_size, llevInfo, LOG(), and give::name.

Referenced by parse_shop_string().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_weekday()

const char* get_weekday ( const int  index)

give access to weekday names

Definition at line 120 of file time.cpp.

References DAYS_PER_WEEK, npc_dialog::index, and weekdays.

Referenced by cfapi_get_weekday_name(), and START_TEST().

+ Here is the caller graph for this function:

◆ get_weight_limit()

uint32_t get_weight_limit ( int  stat)

Definition at line 2369 of file living.cpp.

◆ give_artifact_abilities()

void give_artifact_abilities ( object op,
const object artifact 
)

Fixes the given object, giving it the abilities and titles it should have due to the second artifact-template.

Parameters
opobject to give properties to.
artifactwhat properties to apply.

Definition at line 230 of file artifact.cpp.

References add_abilities(), add_refcount(), add_string(), free_string(), MAX_BUF, and give::op.

Referenced by add_one_item(), ArtifactPanel::artifactChanged(), cast_create_missile(), command_create(), do_single_item(), generate_artifact(), make_item_from_recipe(), recipe_get_face(), save_object_in_sb(), and while().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ give_skill_by_name()

object* give_skill_by_name ( object op,
const char *  skill_name 
)

Given the skill name skill_name, we find the skill archetype/object, set appropriate values, and insert it into the object (op) that is passed.

We return the skill - this makes it easier for calling functions that want to do something with it immediately.

Parameters
opobject to which to give the skill. Must not be NULL.
skill_nameskill to give. Must not be NULL.
Returns
newly created skill, or NULL if failure (logger with error level).
Note
this doesn't check whether the object already has the skill or not.

Definition at line 1784 of file living.cpp.

References arch_to_object(), CLEAR_FLAG, living::exp, FLAG_CAN_USE_SKILL, get_archetype_by_skill_name(), object::level, link_player_skills(), llevError, LOG(), object_insert_in_ob(), give::op, SKILL, and object::stats.

Referenced by add_player_exp(), adjust_skill_tool(), become_follower(), cfapi_object_give_skill(), do_skill(), food_type_apply(), and learn_skill().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ has_ability()

int has_ability ( const object ob)

Checks whether object has innate abilities (spell/spellbook in inventory).

Returns
1 if monster has any innate abilities, 0 else

Definition at line 153 of file exp.cpp.

References guildjoin::ob, object_find_by_type(), SPELL, and SPELLBOOK.

Referenced by new_exp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ has_been_loaded()

mapstruct* has_been_loaded ( const char *  name)

Checks whether map has been loaded.

Parameters
namepath of the map to search. Can be NULL.
Returns
the mapstruct which has a name matching the given argument. return NULL if no match is found.

Definition at line 79 of file map.cpp.

References first_map, disinfect::map, and give::name.

Referenced by add_npc_to_random_map(), cfapi_map_has_been_loaded(), check_login(), command_reset(), command_swap(), is_legal_2ways_exit(), monsterFight(), and ready_map_name().

+ Here is the caller graph for this function:

◆ has_carried_lights()

int has_carried_lights ( const object op)

Checks if op has a light source.

Parameters
opobject being checked.
Returns
true if op carries one or more lights
Note
This is a trivial function now days, but it used to be a bit longer. Probably better for callers to just check the op->glow_radius instead of calling this.

Definition at line 346 of file los.cpp.

References give::op.

Referenced by hideability(), and monster_can_see_enemy().

+ Here is the caller graph for this function:

◆ i18n()

const char* i18n ( const object who,
const char *  code 
)

Translate a message in the appropriate language.

Parameters
whowho to translate for.
codestring to translate, usually the English version.
Returns
translated message, or code if not found or who's language is invalid.

Definition at line 42 of file languages.cpp.

References add_string(), mad_mage_user::file, is_valid_types_gen::found, free_string(), sstring, and autojail::who.

Referenced by command_body(), command_delete(), command_passwd(), command_quest(), command_statistics(), confirm_password(), do_harvest(), draw_ext_info(), draw_ext_info_format(), get_name(), get_party_password(), get_password(), key_change_class(), key_roll_stat(), play_again(), quest_display(), quest_info(), receive_player_password(), and roll_again().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ i18n_find_language_by_code()

language_t i18n_find_language_by_code ( const char *  code)

Attempt to find the identifier of a language from its code.

Parameters
codelanguage code.
Returns
index, -1 if not found.

Definition at line 59 of file languages.cpp.

References i18n_files.

Referenced by command_language(), and i18n_get_language_by_code().

+ Here is the caller graph for this function:

◆ i18n_free()

void i18n_free ( void  )

Clears all i18n-related data.

Definition at line 209 of file languages.cpp.

References free_string(), i18n_files, and diamondslots::message.

Referenced by cleanup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ i18n_get_language_by_code()

language_t i18n_get_language_by_code ( const char *  code)

Find the identifier of a language from its code.

Parameters
codelanguage's code.
Returns
language's code, or the default language if code is invalid.

Definition at line 73 of file languages.cpp.

References is_valid_types_gen::found, i18n_default, and i18n_find_language_by_code().

Referenced by check_login(), and get_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ i18n_get_language_code()

sstring i18n_get_language_code ( language_t  language)

Return the code of a specified language.

Parameters
languageidentifier of the language.
Returns
language's code, or default language's code if identifier is invalid.

Definition at line 85 of file languages.cpp.

References i18n_file::code, and i18n_default.

Referenced by command_help(), help_topics(), and save_player().

+ Here is the caller graph for this function:

◆ i18n_init()

void i18n_init ( void  )

◆ i18n_list_languages()

void i18n_list_languages ( object who)

List all languages for who.

Parameters
whowho to display languages for.

Definition at line 95 of file languages.cpp.

References draw_ext_info_format(), i18n_files, MSG_SUBTYPE_NONE, MSG_TYPE_COMMAND, NDI_UNIQUE, and autojail::who.

Referenced by command_language().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ identify()

object* identify ( object op)

Identifies an item. Supposed to fix face-values as well here, but later. Note - this may merge op with other object, so this function returns either the merged object or the original if no merge happened.

Parameters
opitem to identify. Can be already identified without ill effects.
Return values
objectThe identify object - this may vary from op if the object was merged.

Definition at line 1421 of file item.cpp.

References add_refcount(), CLEAR_FLAG, esrv_update_item(), FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_KNOWN_BLESSED, FLAG_KNOWN_CURSED, FLAG_NO_SKILL_IDENT, free_string(), GET_MAP_TOP, map_find_by_type(), object_get_player_container(), object_give_identified_properties(), object_merge(), object_update(), give::op, altar_valkyrie::pl, PLAYER, POTION, QUERY_FLAG, SET_FLAG, UP_OBJ_FACE, UPD_ALL, UPD_FACE, UPD_FLAGS, and UPD_NAME.

Referenced by apply_auto(), cast_create_food(), cast_identify(), cfapi_object_identify(), identify_altar_type_move_on(), identify_object_with_skill(), monster_do_talk_npc(), CRETreasurePanel::onGenerate(), potion_type_apply(), scroll_type_apply(), sell_item(), and spellbook_type_apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ihypot()

int ihypot ( int  a,
int  b 
)

Rough estimate of hypot(a, b). Based on stack overflow: https://stackoverflow.com/questions/3506404/fast-hypotenuse-algorithm-for-embedded-processor

Definition at line 570 of file utils.cpp.

References disinfect::a, Ice::b, and Ice::tmp.

Referenced by expand_lighted_sight(), get_rangevector(), legacy_monster_stand_in_light(), monster_stand_in_light_internal(), and play_sound_map().

+ Here is the caller graph for this function:

◆ init_archetype_pointers()

void init_archetype_pointers ( void  )

Initialize global archtype pointers:

Definition at line 62 of file treasure.cpp.

References amulet_arch, crown_arch, find_archetype(), and ring_arch.

Referenced by init_beforeplay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_attackmess()

void init_attackmess ( BufferReader reader,
const char *  filename 
)

Initializes the attack messages. Called by init_library().

Memory will be cleared by free_globals().

Definition at line 572 of file init.cpp.

References attack_mess, buf, attackmess_t::buf1, attackmess_t::buf2, attackmess_t::buf3, bufferreader_next_line(), npc_dialog::filename, attackmess_t::level, level, llevDebug, LOG(), strdup_local, and mail_login::total.

Referenced by assets_collect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_block()

void void init_block ( void  )

initialises the array used by the LOS routines.

Since we are only doing the upper left quadrant, only these spaces could possibly get blocked, since these are the only ones further out that are still possibly in the sightline.

Definition at line 106 of file los.cpp.

References block, FABS, blocks::index, banquet::l, MAP_CLIENT_X, MAP_CLIENT_Y, set_block(), SPACE_BLOCK, diamondslots::x, and diamondslots::y.

Referenced by cctk_init_std_archetypes(), and init_library().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_experience()

void init_experience ( void  )

This loads the experience table from the exp_table file. This tends to exit on any errors, since it populates the table as it goes along, so if there are errors, the table is likely in an inconsistent state.

Note
will call exit() if file is invalid or not found.

Definition at line 167 of file exp.cpp.

References buf, Settings::confdir, fatal(), FMT64, levels, llevDebug, llevError, LOG(), MAX_BUF, Settings::max_level, SEE_LAST_ERROR, and settings.

Referenced by init_library(), and setup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_formulae()

◆ init_globals()

void init_globals ( void  )

Initialises all global variables. Might use environment-variables as default for some of them.

Setups logfile, and such variables.

Definition at line 396 of file init.cpp.

References add_string(), blocks_prayer, exiting, first_artifactlist, first_map, first_map_ext_path, first_player, init_defaults(), llevError, LOG(), logfile, Settings::logfilename, nrofallowedstr, nrofartifacts, settings, statistics, trying_emergency_save, and undead_name.

Referenced by cctk_init_std_archetypes(), generate_map(), init_library(), ResourcesManager::load(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_gods()

void init_gods ( void  )

This takes a look at all of the archetypes to find the objects which correspond to the GODS (type GOD)

Definition at line 59 of file holy.cpp.

References add_god_to_list(), archetypes_for_each(), llevDebug, and LOG().

Referenced by generate_map(), init_beforeplay(), ResourcesManager::load(), main(), and setup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_library()

void init_library ( void  )

It is vital that init_library() is called by any functions using this library. If you want to lessen the size of the program using the library, you can replace the call to init_library() with init_globals(). Good idea to also call init_hash_table if you are doing any object loading.

Definition at line 324 of file init.cpp.

References assets_init(), attack_mess, attackmess_t::buf1, attackmess_t::buf2, attackmess_t::buf3, fatal(), getManager(), i18n_init(), Settings::ignore_assets_errors, init_block(), init_clocks(), init_dynamic(), init_emergency_mappath(), init_environ(), init_experience(), init_globals(), init_hash_table(), init_objects(), init_stats(), attackmess_t::level, level, llevError, load_assets(), LOG(), MAXATTACKMESS, SEE_LAST_ERROR, and settings.

Referenced by generate_map(), init(), ResourcesManager::load(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_msgfile()

void init_msgfile ( FILE *  file,
const char *  filename 
)

◆ init_ob_method_struct()

void init_ob_method_struct ( ob_methods methods,
ob_methods fallback 
)

Initializes a ob_methods struct. Make sure this always matches ob_methods.h

Parameters
methodsob_method structure to initialize
fallbackDefault fallback for the ob_method

Definition at line 32 of file ob_types.cpp.

References ob_methods::apply, ob_methods::describe, ob_methods::fallback, ob_methods::move_on, ob_methods::process, and ob_methods::trigger.

Referenced by init_ob_methods(), and init_ob_types().

+ Here is the caller graph for this function:

◆ init_ob_types()

void init_ob_types ( ob_methods base_type)

Initializes the object system.

Parameters
base_typebase type to use as a base for all types.
Todo:
when migration is complete, the parameter should go, and this function should be called from init_library() instead of init_ob_methods() in server/ob_methods.c.

Definition at line 49 of file ob_types.cpp.

References base_type, init_ob_method_struct(), OBJECT_TYPE_MAX, Ice::tmp, and type_methods.

Referenced by init_ob_methods().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_objects()

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 cctk_init_std_archetypes(), and init_library().

+ Here is the caller graph for this function:

◆ init_readable()

void init_readable ( void  )

Initialize linked lists utilized by message functions in tailor_readable_ob()

This is the function called by the main routine to initialize all the readable information.

Definition at line 904 of file readable.cpp.

References init_book_archive(), init_mon_info(), llevDebug, and LOG().

Referenced by generate_map(), init_beforeplay(), ResourcesManager::load(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_regions()

void init_regions ( BufferReader reader,
const char *  filename 
)

Reads/parses the region file, and copies into a linked list of region structs.

Parameters
readerbuffer to read from.
filenamefile being read.
Todo:
support multiple region files

Definition at line 311 of file region.cpp.

References all_regions, buf, bufferreader_next_line(), region::fallback, fatal(), npc_dialog::filename, get_region_by_name(), get_region_struct(), HUGE_BUF, region::jailmap, region::jailx, region::jaily, llevError, LOG(), region::longname, MAX_BUF, region::msg, msgbuf, region::name, python_init::path, SEE_LAST_ERROR, strdup_local, autojail::value, diamondslots::x, and diamondslots::y.

Referenced by assets_collect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_stats()

void init_stats ( )

This loads statistic bonus/penalties from the stat_bonus file. Any error is fatal, as system needs working bonuses.

Note
will call exit() if file is invalid or not found.

Definition at line 2591 of file living.cpp.

References buf, Settings::confdir, report::error(), float_bonus_names, float_bonuses, int_bonus_names, int_bonuses, llevError, load_table_float(), load_table_int(), LOG(), MAX_BUF, Settings::max_stat, MIN_STAT, NUM_FLOAT_BONUSES, NUM_INT_BONUSES, and settings.

Referenced by cctk_init_std_archetypes(), and init_library().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_dragon_pl()

int is_dragon_pl ( const object op)

Checks if player is a dragon.

Parameters
opplayer to check. Can be NULL.
Returns
TRUE if the adressed object 'ob' is a player of the dragon race.

Definition at line 122 of file player.cpp.

References give::op, and PLAYER.

Referenced by check_login(), command_resistances(), command_title(), describe_item(), describe_monster(), dragon_eat_flesh(), dragon_focus_type_apply(), find_best_player_hth_skill(), food_type_apply(), old_describe_monster(), perceive_self(), and player_lvl_adj().

+ Here is the caller graph for this function:

◆ is_friendly()

int is_friendly ( const object op)

Checks if the given object is already in the friendly list or not

Parameters
opitem to check
Returns
1 if on friendly list, 0 else

Definition at line 108 of file friend.cpp.

References friends.

Referenced by add_friendly_object(), cfapi_object_get_property(), cfapi_object_set_property(), and START_TEST().

+ Here is the caller graph for this function:

◆ is_identifiable_type()

int is_identifiable_type ( const object op)

Return true if this item's type is one that cares about whether or not it's been identified – e.g. money and walls don't care (they are considered to be "always identified" no matter what FLAG_IDENTIFIED says) but weapons and scrolls do. In practice, this means anything with at least one identifyskill in the typedata, or skill tools (which have no identifyskill, but can still be IDed using magic).

Parameters
opObject to check.
Returns
True if the object can be identified.
Todo:
Ideally, this distinction would be meaningless and we'd just always check FLAG_IDENTIFIED, and assume that items that shouldn't ever need to be identified will always have the flag set. In practice we can't reliably make that assumption.

Definition at line 1324 of file item.cpp.

References get_typedata(), typedata::identifyskill, give::op, and SKILL_TOOL.

Referenced by command_create(), examine_fluff(), give_initial_items(), and is_identified().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_identified()

int is_identified ( const object op)

Return true if the item is identified, either because it is of a type that doesn't ever need identification (e.g. money), or because it has FLAG_IDENTIFIED set. Uses is_identifiable_type() to distinguish between the two cases.

Parameters
opObject to check.
Returns
true if the item has been identified, or doesn't need identification.

Definition at line 1348 of file item.cpp.

References FLAG_IDENTIFIED, is_identifiable_type(), give::op, and QUERY_FLAG.

Referenced by add_abilities(), cast_create_food(), cast_identify(), describe_item(), examine(), examine_fluff(), examine_rod_charge_level(), examine_wand_charge_level(), identify_altar_type_move_on(), identify_object_with_skill(), make_item_from_recipe(), price_base(), query_base_name(), query_flags(), query_short_name(), and spellbook_type_describe().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_magical()

int is_magical ( const object op)

Checks whether object is magical.

A magical item is one that increases/decreases any abilities, provides a resistance, has a generic magical bonus, or is an artifact.

Parameters
opitem to check.
Returns
true if the item is magical.

Definition at line 1227 of file item.cpp.

References AMULET, ARMOUR, ATNR_PHYSICAL, BOOTS, FLAG_ALIVE, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_STEALTH, FLAG_XRAYS, get_attr_value(), GIRDLE, GLOVES, HELMET, NROFATTACKS, NUM_STATS, give::op, POTION, POWER_CRYSTAL, QUERY_FLAG, RING, ROD, SCROLL, SHIELD, SPELLBOOK, and WAND.

Referenced by apply_auto(), cast_detection(), cfapi_object_get_property(), detect_magic_on_item(), query_base_name(), and query_short_name().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_old_wraith_pl()

int is_old_wraith_pl ( object op)

Checks if player is a wraith without the 'wraith feed' skill.

Parameters
opplayer to check.
Returns
true if the adressed object 'ob' is an old wraith player, false else.

Definition at line 185 of file player.cpp.

References is_wraith_pl(), object_find_by_name(), give::op, and PLAYER.

Referenced by food_type_apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_type_valid()

int is_type_valid ( uint8_t  type)

Checks if the specified type is a valid one for a Crossfire object.

Parameters
typevalue to check.
Returns
1 if the type is valid, 0 else.

Definition at line 17 of file arch_types_valid.cpp.

References OBJECT_TYPE_MAX, and is_valid_types_gen::type.

Referenced by check_loaded_object().

+ Here is the caller graph for this function:

◆ is_valid_faceset()

int is_valid_faceset ( int  fsn)

Checks specified faceset is valid

Parameters
fsnfaceset number

Definition at line 117 of file image.cpp.

◆ is_wraith_pl()

int is_wraith_pl ( object op)

Tests if a player is a wraith.

Parameters
opplayer to check.
Returns
true if the adressed object 'ob' is a wraith player, false else.

Definition at line 173 of file player.cpp.

References object_find_by_name(), give::op, and PLAYER.

Referenced by check_heal_and_mana(), food_type_apply(), hit_with_one_attacktype(), and is_old_wraith_pl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isqrt()

int isqrt ( int  n)

Compute the square root. This is now a wrapper around sqrt().

Definition at line 562 of file utils.cpp.

Referenced by fix_flesh_item(), get_rangevector_from_mapcoord(), pick_lock(), spell_failure(), and value_limit().

+ Here is the caller graph for this function:

◆ jump_time()

void jump_time ( void  )

Definition at line 198 of file time.cpp.

References game_time, and process_utime_long_count.

Referenced by do_server().

+ Here is the caller graph for this function:

◆ legal_artifact_combination()

int legal_artifact_combination ( const object op,
const artifact art 
)

Checks if op can be combined with art.

Parameters
opobject to test.
artartifact to test.
Returns
1 if 'op' can be 'art', 0 else.

Definition at line 252 of file artifact.cpp.

References artifact::allowed, llevDebug, LOG(), give::name, give::op, and Ice::tmp.

Referenced by artifact_compute_chance_for_item(), ArtifactPanel::computeMadeViaAlchemy(), do_single_item(), find_artifact(), generate_artifact(), locate_recipe_artifact(), and AssetWithArtifacts< archetype >::updateArtifacts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ level_exp()

int64_t level_exp ( int  level,
double  expmul 
)

Returns how much experience is needed for a player to become the given level. level should really never exceed max_level

Parameters
levellevel player wants to reach
expmulpenality/bonus for experience.

Definition at line 1881 of file living.cpp.

References level, levels, Settings::max_level, and settings.

Referenced by calculate_difficulty(), change_exp(), command_statistics(), place_monsters(), player_lvl_adj(), and show_skills().

+ Here is the caller graph for this function:

◆ link_player_skills()

void link_player_skills ( object op)

This function goes through the player inventory and sets up the last_skills[] array in the player object. The last_skills[] is used to more quickly lookup skills - mostly used for sending exp. This function should be called anytime the player gains a skill.

Parameters
opplayer to link skills for. Must be a player.

Definition at line 287 of file player.cpp.

References FOR_INV_FINISH, FOR_INV_PREPARE, MAX_SKILLS, give::op, SKILL, and Ice::tmp.

Referenced by adjust_skill_tool(), apply_race_and_class(), become_follower(), check_login(), food_type_apply(), give_initial_items(), give_skill_by_name(), key_change_class(), and learn_skill().

+ Here is the caller graph for this function:

◆ load_face_file()

int load_face_file ( FILE *  file,
const char *  full_path 
)

◆ load_image_info()

void load_image_info ( FILE *  file,
const char *  filename 
)

◆ load_object()

int load_object ( FILE *  fp,
object op,
int  bufstate,
int  map_flags,
bool  artifact_init 
)

Loads an object from the given file-pointer. Variables will be read and parsed and patched into the object until the string "end" is reached, or the end of the file.

Parameters
fpfile pointer from which to read.
opwhere to read the data.
bufstateused to determine various file attributes:
  • LO_REPATE (0): We are reading from the same buffer as the last call.
  • LO_LINEMODE (1): file that is being read from is multi purpose (ie, other functions will also be reading from this (treasure file, artifacts.)
  • LO_NEWFILE (2): This is the first read from a particular file, so the buffers should be reset.
  • LO_NOREAD (3): Reset the buffers, but don't read from it. (op can be null)
map_flagscombination of Map loading flags flags, though only MAP_STYLE is used.
artifact_initwhether the object is being loaded as part of artifact loading or not.
Returns
  • LL_NORMAL if object was read.
  • LL_EOF if an error occured.
  • LL_MORE if this is a multipart object.

Definition at line 38944 of file loader.cpp.

References LL_EOF, LL_NORMAL, llevDebug, LO_LINEMODE, LO_NEWFILE, LO_NOREAD, LOG(), lorebuf, MAXDEPTH, msgbuf, msglen, give::op, total_msglen, VERY_BIG_BUF, YY_BUF_SIZE, yy_create_buffer(), YY_CURRENT_BUFFER, yy_delete_buffer(), yy_scan_string(), and yy_switch_to_buffer().

Referenced by check_login(), load_objects(), and load_unique_objects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_object_from_reader()

int load_object_from_reader ( BufferReader reader,
object op,
int  map_flags,
bool  arch_init,
bool  artifact_init 
)

Load an object from the specified reader, stopping when the object is complete.

Parameters
readerwhere to read from.
opobject to read.
map_flagsone or more map loading flags.
arch_initwhether we are loading archetypes or not.
artifact_initwhether the object is being loaded as part of artifact loading or not.
Returns
LL_NORMAL or LL_MORE if no error, LL_EOF if end of file, will LOG an error if unexpected.
Todo:
loading is inefficient because of bufferreader_get_line(), check use of yy_scan_buffer().

Definition at line 38996 of file loader.cpp.

References buf, bufferreader_get_line(), HUGE_BUF, INITIAL, LL_EOF, LL_MORE, LL_NORMAL, llevError, LOG(), lorebuf, MAXDEPTH, msgbuf, msglen, give::op, total_msglen, YY_CURRENT_BUFFER, yy_delete_buffer(), yy_pop_state(), yy_push_state(), and yy_scan_string().

Referenced by ArtifactLoader::load(), and ArchetypeLoader::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_png_file()

int load_png_file ( FILE *  file,
const char *  full_path 
)

◆ load_treasures()

void load_treasures ( void  )

◆ locate_recipe_artifact()

const artifact* locate_recipe_artifact ( const recipe rp,
size_t  idx 
)

Finds an artifact for a recipe.

Parameters
rprecipe
idxindex of ingredient in recipe.
Returns
artifact, or NULL if not found.

Definition at line 730 of file recipe.cpp.

References recipe::arch_name, create_archetype(), find_artifactlist(), say::item, legal_artifact_combination(), diamondslots::object, object_free_drop_inventory(), recipe::title, and nlohmann::detail::void().

Referenced by check_recipe(), dump_alchemy(), dump_alchemy_costs(), make_item_from_recipe(), and recipe_get_face().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LOG()

void LOG ( LogLevel  logLevel,
const char *  format,
  ... 
)

◆ make_list_like()

void make_list_like ( char *  input)

Taking a string as an argument, mutate it into a string that looks like a list.

A 'list' for the purposes here is a string of items, separated by commas, except for the last entry, which has an 'and' before it, and a full stop (period) after it.

This function will also strip all trailing non alphanumeric characters.

It does not insert an oxford comma.

Parameters
inputstring to transform. Will be overwritten. Must be long enough to contain the modified string.
Todo:
use safe string functions.

Definition at line 368 of file utils.cpp.

References MAX_BUF, and Ice::tmp.

Referenced by can_pay(), and shop_describe().

+ Here is the caller graph for this function:

◆ make_path_to_file()

void make_path_to_file ( const char *  filename)

Checks if any directories in the given path doesn't exist, and creates if necessary.

Parameters
filenamefile path we'll want to access. Can be NULL.
Note
will LOG() to debug and error.

Definition at line 164 of file porting.cpp.

References buf, npc_dialog::filename, llevDebug, llevError, LOG(), MAX_BUF, safe_strncpy, and SAVE_DIR_MODE.

Referenced by apply_race_and_class(), create_destination(), key_change_class(), save_map(), save_player(), and write_pictures_from_real_size().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_sure_not_seen()

void make_sure_not_seen ( const object op)

The object which is supposed to be visible through walls has just been removed from the map, so update the los of any players within its range

Parameters
opobject that disappears.
Todo:
what about tiled maps?

Definition at line 718 of file los.cpp.

References first_player, give::op, and altar_valkyrie::pl.

Referenced by process_object().

+ Here is the caller graph for this function:

◆ make_sure_seen()

void make_sure_seen ( const object op)

The object is supposed to be visible through walls, thus check if any players are nearby, and edit their LOS array.

Parameters
opobject that should be visible.
Todo:
what about tiled maps?

Definition at line 695 of file los.cpp.

References first_player, LOS_NO_DARKNESS, give::op, and altar_valkyrie::pl.

Referenced by process_object().

+ Here is the caller graph for this function:

◆ map_find_by_archetype()

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.

Parameters
m
x
ywhere to search. Must be valid position.
atarchetype to search for.
Returns
first matching object, or NULL if none matches.

Definition at line 3118 of file object.cpp.

References FOR_MAP_FINISH, FOR_MAP_PREPARE, llevError, LOG(), m, OUT_OF_REAL_MAP, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by cfapi_map_find_by_archetype_name(), put_in_icecube(), and town_portal_destroy_existing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_find_by_flag()

object* map_find_by_flag ( mapstruct map,
int  x,
int  y,
int  flag 
)

Finds an object in a map tile by flag number. Checks the objects' heads.

Parameters
mapthe map to search.
xthe x-coordiate to search.
ythe y-coordiate to search.
flagthe flag to seacrh for
Returns
first object's head in the tile that has the flag set. NULL if no match.
Note
will not search in inventory of objects.

Definition at line 2621 of file map.cpp.

References GET_MAP_OB, HEAD, disinfect::map, QUERY_FLAG, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by cast_light(), common_process_projectile(), do_monster_change(), do_mood_floor(), get_pointed_target(), and mood_change().

+ Here is the caller graph for this function:

◆ map_find_by_type()

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.

Parameters
m
x
ywhere to search. Must be valid position.
typetype to get.
Returns
first matching object, or NULL if none matches.

Definition at line 3145 of file object.cpp.

References FOR_MAP_FINISH, FOR_MAP_PREPARE, m, OUT_OF_REAL_MAP, Ice::tmp, is_valid_types_gen::type, diamondslots::x, and diamondslots::y.

Referenced by identify(), remove_door(), and remove_locked_door().

+ Here is the caller graph for this function:

◆ map_get_path()

const char* map_get_path ( const object item)

Return the map path on which the specified item is.

Parameters
itemwhat to return the map path for.
Returns
path, map's name, or error string, never NULL.

Definition at line 2663 of file map.cpp.

References map_get_path().

Referenced by gate_type_process(), and map_get_path().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_remove_unique_files()

void map_remove_unique_files ( const mapstruct map)

Remove files containing the map's unique items.

Parameters
map

Definition at line 2638 of file map.cpp.

References disinfect::count, create_items_path(), HUGE_BUF, llevError, Settings::localdir, LOG(), disinfect::map, python_init::path, Settings::playerdir, and settings.

Referenced by command_reset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mapfile_load()

mapstruct* mapfile_load ( const char *  map,
int  flags 
)

Opens the file "filename" and reads information about the map from the given file, and stores it in a newly allocated mapstruct. A pointer to this structure is returned, or NULL on failure. flags correspond to those in map.h. Main ones used are MAP_PLAYER_UNIQUE, in which case we don't do any name changes, and

Parameters
mapMap path
flagsAdditional options for loading the map:
Returns
loaded map, or NULL if failure.

Definition at line 1216 of file map.cpp.

References apply_auto_fix(), calculate_difficulty(), EVENT_MAPLOAD, events_execute_global_event(), flags, llevDebug, LOG(), m, disinfect::map, MAP_DIFFICULTY, MAP_NO_DIFFICULTY, map_path(), MAP_STYLE, mapfile_load_lowlevel(), maps_loaded_total, MAX_BUF, PROFILE_BEGIN, PROFILE_END, set_map_reset_time(), and update_buttons().

Referenced by enter_fixed_template_map(), enter_unique_map(), load_style_map(), main(), mapsave_test(), CREMapInformationManager::process(), and ready_map_name().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ name_to_material()

materialtype_t* name_to_material ( const char *  name)

Convert materialname to materialtype_t

Parameters
namematerial name to get.
Returns
matching material, nullptr if none matched.

Definition at line 248 of file utils.cpp.

References materials, and give::name.

Referenced by animate_weapon(), object_get_materialtype(), and transmute_materialname().

+ Here is the caller graph for this function:

◆ new_exp()

int64_t new_exp ( const object ob)

Alternative way to calculate experience based on the ability of a monster.

It's far from perfect, and doesn't consider everything which can be considered, thus it's only used in debugging. this is only used with one of the dumpflags, and not anyplace in the code.

Parameters
obobject for which to return experience
Returns
experience computed from object's properties.

Definition at line 100 of file exp.cpp.

References exp_att_mult, exp_prot_mult, FABS, FALSE, FLAG_CAST_SPELL, FLAG_HITBACK, FLAG_NO_MAGIC, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_INVISIBLE, FLAG_SPLITTING, FLAG_STAND_STILL, FLAG_USE_BOW, FLAG_USE_RANGE, FLAG_USE_SCROLL, has_ability(), MAX, MIN, NROFATTACKS, guildjoin::ob, and QUERY_FLAG.

Referenced by print_monsters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nstrtok()

int nstrtok ( const char *  buf1,
const char *  buf2 
)

Simple routine to return the number of list items in buf1 as separated by the value of buf2

Parameters
buf1items we want to split.
buf2what to split by.
Returns
number of elements.

Definition at line 642 of file readable.cpp.

References buf, MAX_BUF, and strlcpy().

Referenced by describe_god(), and strtoktolin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ob_apply()

method_ret ob_apply ( object op,
object applier,
int  aflags 
)

Apply an object by running an event hook or an object method. Consider using apply_manual() instead of this function if the applier should check for apply restrictions.

Parameters
opThe object to apply
applierThe object that executes the apply action
aflagsSpecial (always apply/unapply) flags
Return values
0A player or monster can't apply objects of that type
1has been applied, or there was an error applying the object
2objects of that type can't be applied if not in inventory

Definition at line 44 of file ob_methods.cpp.

References ob_methods::apply, EVENT_APPLY, events_execute_object_event(), ob_methods::fallback, METHOD_OK, METHOD_UNHANDLED, give::op, SCRIPT_FIX_ALL, and type_methods.

Referenced by apply_by_living_below(), apply_manual(), create_player_cmd(), dimension_door(), enter_exit(), and thrown_item_effect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ob_blocked()

int ob_blocked ( const object ob,
mapstruct m,
int16_t  x,
int16_t  y 
)

Returns true if the given object can't fit in the given spot. This is meant for multi space objects - for single space objecs, just calling get_map_blocked and checking that against movement type of object. This function goes through all the parts of the multipart object and makes sure they can be inserted.

While this doesn't call out of map, the get_map_flags does.

This function has been used to deprecate arch_out_of_map - this function also does that check, and since in most cases, a call to one would follow the other, doesn't make a lot of sense to have two separate functions for this.

This returns nonzero if this arch can not go on the space provided, 0 otherwise. the return value will contain the P_.. value so the caller can know why this object can't go on the map. Note that callers should not expect P_NEW_MAP to be set in return codes - since the object is multispace - if we did return values, what do you return if half the object is one map, half on another.

Parameters
obobject to test.
m
x
ymap and coordinates to check.
Returns
0 if the object can fit on specified space, non-zero else.

Definition at line 479 of file map.cpp.

References AB_NO_PASS, get_map_flags(), GET_MAP_MOVE_BLOCK, m, object::more, MOVE_ALL, object::move_type, guildjoin::ob, OB_TYPE_MOVE_BLOCK, P_IS_ALIVE, P_OUT_OF_MAP, Ice::tmp, TRANSPORT, diamondslots::x, and diamondslots::y.

Referenced by enter_map(), monster_compute_path(), move_creator(), object_find_first_free_spot(), object_find_free_spot(), object_find_multi_free_spot_around(), object_find_multi_free_spot_within_radius(), pets_summon_golem(), pets_summon_object(), and turn_one_transport().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ob_describe()

char* ob_describe ( const object op,
const object observer,
int  use_media_tags,
char *  buf,
size_t  size 
)

Returns the description of an object, as seen by the given observer.

Parameters
opThe object to describe
observerThe object to which the description is made
use_media_tagswhether to add media tags or not on the description
bufBuffer that will contain the description
sizeSize of buf
Returns
buf.

Definition at line 91 of file ob_methods.cpp.

References buf, ob_methods::describe, ob_methods::fallback, give::op, and type_methods.

Referenced by book_type_apply(), cast_identify(), enter_exit(), examine(), identify_altar_type_move_on(), and identify_object_with_skill().

+ Here is the caller graph for this function:

◆ ob_move_on()

method_ret ob_move_on ( object op,
object victim,
object originator 
)

Makes an object move on top of another one.

Parameters
opThe object over which to move
victimThe object moving over op
originatorThe object that is the cause of the move
Return values
METHOD_UNHANDLEDif the process method does not exist for that object

Definition at line 111 of file ob_methods.cpp.

References ob_methods::fallback, METHOD_UNHANDLED, ob_methods::move_on, give::op, type_methods, and sword_of_souls::victim.

Referenced by move_hole(), object_check_move_on(), and object_remove().

+ Here is the caller graph for this function:

◆ ob_process()

method_ret ob_process ( object op)

Processes an object, giving it the opportunity to move or react. Note: The return value of ob_process doesn't seem to be used anymore.

Parameters
opThe object to process
Return values
METHOD_UNHANDLEDif the process method does not exist for that objec,

Definition at line 67 of file ob_methods.cpp.

References ob_methods::fallback, METHOD_UNHANDLED, give::op, ob_methods::process, and type_methods.

Referenced by animate_bomb(), do_throw(), fire_arch_from_position(), fire_bolt(), fire_bow(), and process_object().

+ Here is the caller graph for this function:

◆ ob_trigger()

method_ret ob_trigger ( object op,
object cause,
int  state 
)

An object is triggered by another one.

Parameters
opThe object being triggered
causeThe object that is the cause of the trigger
statetrigger state, 0 for released, other for pushed
Return values
METHOD_UNHANDLEDif the process method does not exist for that object
Todo:
check the exact state values/meaning

Definition at line 133 of file ob_methods.cpp.

References ob_methods::fallback, METHOD_UNHANDLED, give::op, dragon::state, ob_methods::trigger, and type_methods.

Referenced by trigger_connected().

+ Here is the caller graph for this function:

◆ object_add_weight()

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.

Parameters
opobject to which we add weight.
weightweight to add.
Todo:
check if mergeable with object_sub_weight().

Definition at line 2833 of file object.cpp.

References CONTAINER, and give::op.

Referenced by make_item_from_recipe(), object_decrease_nrof(), object_increase_nrof(), and object_insert_in_ob().

+ Here is the caller graph for this function:

◆ object_can_merge()

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.

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

Parameters
ob1
ob2objects to try to merge.
Returns
TRUE if they can be merged, FALSE else.
Todo:
check the function at places marked.

Definition at line 433 of file object.cpp.

References compare_ob_value_lists(), FABS, FLAG_ANIMATE, FLAG_APPLIED, FLAG_BEEN_APPLIED, FLAG_IDENTIFIED, MIN_ACTIVE_SPEED, guildbuy::ob1, guildbuy::ob2, object_can_merge(), QUERY_FLAG, SCROLL, and SET_FLAG.

Referenced by cfapi_object_get_property(), check_loaded_object(), give_initial_items(), local_check_loaded_object(), object_can_merge(), object_insert_in_map(), object_insert_in_ob(), object_merge(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_can_pick()

int object_can_pick ( const object who,
const object item 
)

Finds out if an object can be picked up.

Add a check so we can't pick up invisible objects (0.93.8)

Parameters
whowho is trying to pick up. Can be a monster or a player.
itemitem we're trying to pick up.
Returns
1 if it can be picked up, otherwise 0.
Note
this introduces a weight limitation for monsters.

Definition at line 3867 of file object.cpp.

References FLAG_ALIVE, FLAG_NO_PICK, get_weight_limit(), PLAYER, QUERY_FLAG, TRANSPORT, and autojail::who.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_check_move_on()

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. 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.

Parameters
opobject that may trigger something.
originatorplayer, monster or other object that caused 'op' to be inserted into 'map'. May be NULL.
Returns
1 if 'op' was destroyed, 0 otherwise.

Definition at line 3012 of file object.cpp.

References 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, MOVE_FLY_LOW, MOVE_WALK, ob_move_on(), object_was_destroyed, give::op, PLAYER, QUERY_FLAG, SK_CLIMBING, SK_WOODSMAN, CFweardisguise::tag, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by change_abil(), and object_insert_in_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_clear()

void object_clear ( object op)

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

Parameters
opobject to clear

Definition at line 983 of file object.cpp.

References blank_face, Settings::casting_time, FLAG_FRIENDLY, FLAG_REMOVED, FREE_AND_CLEAR_STR, free_dialog_information(), give::name, object_free_key_values(), offsetof, give::op, QUERY_FLAG, remove_friendly_object(), SET_FLAG, and settings.

Referenced by cfapi_object_clear(), get_archetype_struct(), object_new(), object_reset(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_clear_owner()

void object_clear_owner ( object op)

Clears the owner of specified object.

Parameters
opobject we want to clear the owner of. Can be NULL.

Definition at line 823 of file object.cpp.

References give::op.

Referenced by do_mood_floor(), fix_stopped_arrow(), object_get_owner(), object_set_owner(), START_TEST(), and stop_projectile().

+ Here is the caller graph for this function:

◆ object_copy()

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. 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.

Parameters
src_obobject that we copy.from
dest_obobject 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(), local_check_loaded_object(), 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(), setup(), START_TEST(), while(), write_note(), write_rune(), and write_scroll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_copy_no_speed()

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. 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.

Parameters
src_obobject that we copy.from
dest_obobject 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, give::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, key_value::value, and nlohmann::detail::void().

Referenced by object_copy(), object_copy_with_inv(), and while().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_copy_owner()

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).

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

Parameters
opobject to update.
cloneobject from which to get the owner.

Definition at line 893 of file object.cpp.

References object_get_owner(), object_set_owner(), give::op, PLAYER, and object::type.

Referenced by animate_bomb(), explode_bullet(), fire_arch_from_position(), poison_living(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_copy_with_inv()

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.

Parameters
src_obobject to copy.
dest_obwhere to copy.
update_speedif true then call update_speed() on the duplicated objects, else don't.
Todo:
replace with a function in common library (there is certainly one).

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(), object_new(), and Ice::tmp.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_count_active()

int object_count_active ( void  )

Objects statistics.

Returns
number of objects on the list of active objects.

Definition at line 1783 of file object.cpp.

References active_objects, and Ice::tmp.

Referenced by malloc_info(), and START_TEST().

+ Here is the caller graph for this function:

◆ object_count_free()

int object_count_free ( void  )

Objects statistics.

Returns
number of objects on the list of free objects.

Definition at line 1751 of file object.cpp.

References free_objects, and Ice::tmp.

Referenced by malloc_info(), and START_TEST().

+ Here is the caller graph for this function:

◆ object_count_used()

int object_count_used ( void  )

Object statistics.

Returns
number of objects on the list of used objects.

Definition at line 1767 of file object.cpp.

References objects, and Ice::tmp.

Referenced by malloc_info(), and START_TEST().

+ Here is the caller graph for this function:

◆ object_create_arch()

object* object_create_arch ( archetype at)

Create a full object using the given archetype. This instanciate not only the archetype but also all linked archetypes in case of multisquare archetype.

Parameters
atarchetype to instanciate. Must not be NULL.
Returns
pointer to head of instance.
Note
will never return NULL.

Definition at line 298 of file arch.cpp.

References arch_to_object(), archetype::clone, object::more, archetype::more, give::op, object::x, and object::y.

Referenced by apply_map_builder(), cast_detection(), cctk_create_game_object(), cfapi_object_create(), command_create(), do_harvest(), do_item_conversion(), CRECombatSimulator::fight(), include_map_in_map(), monsterFight(), move_creator(), msgfile_msg(), place_monsters(), polymorph_living(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_create_clone()

object* object_create_clone ( object asrc)

Create clone from object to another.

Parameters
asrcobject to clone.
Returns
clone of asrc, including inventory and 'more' body parts.
Note
this function will return NULL only if asrc is NULL. If there is a memory allocation error, object_new() calls fatal().

Definition at line 3909 of file object.cpp.

References FOR_INV_FINISH, FOR_INV_PREPARE, HEAD, object_copy(), object_create_clone(), object_insert_in_ob(), object_new(), Ice::tmp, and nlohmann::detail::void().

Referenced by cfapi_object_clone(), do_item_conversion(), generate_monster_arch(), generate_monster_inv(), move_creator(), object_create_clone(), and object_split().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_decrease_nrof()

object* object_decrease_nrof ( object op,
uint32_t  i 
)

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

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

Parameters
opobject to decrease.
inumber to remove.
Returns
'op' if something is left, NULL if the amount reached 0.

Definition at line 2676 of file object.cpp.

References esrv_update_item(), first_player, fix_object(), FLAG_REMOVED, FOR_MAP_FINISH, FOR_MAP_PREPARE, object_add_weight(), object_free_drop_inventory(), object_get_player_container(), object_remove(), object_sub_weight(), give::op, altar_valkyrie::pl, QUERY_FLAG, Ice::tmp, UPD_NROF, and UPD_WEIGHT.

Referenced by cfapi_object_set_property(), check_altar_sacrifice(), do_item_conversion(), eat_item(), object_split(), operate_altar(), save_throw_object(), spell_consume_items(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_distance()

int object_distance ( const object ob1,
const object ob2 
)

Return the square of the distance between the two given objects.

Parameters
ob1
ob2objects we want to compute the distance of.

Definition at line 3661 of file object.cpp.

References guildbuy::ob1, and guildbuy::ob2.

Referenced by cfapi_object_distance().

+ Here is the caller graph for this function:

◆ object_dump()

void object_dump ( const object op,
StringBuffer sb 
)

Dumps an object.

Parameters
opobject to dump. Can be NULL.
sbbuffer that will contain object information. Must not be NULL.

Definition at line 645 of file object.cpp.

References archetype::clone, object::count, empty_archetype, get_ob_diff(), object_get_owner_const(), give::op, stringbuffer_append_printf(), and stringbuffer_append_string().

Referenced by animate_object(), ArchetypeWrapper::ArchetypeWrapper(), command_dump(), do_dump(), dump_arch(), gate_type_process(), object_dump_all(), object_free(), object_insert_in_map(), object_insert_in_ob(), object_remove(), process_events(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_dump_all()

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 llevDebug, LOG(), object_dump(), objects, give::op, stringbuffer_finish(), and stringbuffer_new().

Referenced by command_dumpallobjects(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_find_by_arch_name()

object* object_find_by_arch_name ( const object who,
const char *  name 
)

Find object in inventory by archetype name.

Parameters
whowhere to search.
namewhat to search.
Returns
first object in who's inventory that has the archetype name match. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4252 of file object.cpp.

References give::name, Ice::tmp, and autojail::who.

Referenced by annotate_ob(), cfapi_object_find_by_arch_name(), converter_type_apply(), and dragon_ability_gain().

+ Here is the caller graph for this function:

◆ object_find_by_flag()

object* object_find_by_flag ( const object who,
int  flag 
)

Find object in inventory by flag.

Parameters
whowhere to search.
flagwhat to search.
Returns
first object in who's inventory that has the flag set. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4206 of file object.cpp.

References QUERY_FLAG, Ice::tmp, and autojail::who.

Referenced by use_alchemy().

+ Here is the caller graph for this function:

◆ object_find_by_flag_applied()

object* object_find_by_flag_applied ( const object who,
int  flag 
)

Find applied object in inventory by flag.

Parameters
whowhere to search.
flagwhat to search.
Returns
first object in who's inventory that has the flag set and is applied. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4229 of file object.cpp.

References FLAG_APPLIED, QUERY_FLAG, Ice::tmp, and autojail::who.

Referenced by save_life().

+ Here is the caller graph for this function:

◆ object_find_by_name()

object* object_find_by_name ( const object who,
const char *  name 
)

Finds an object in inventory name.

Parameters
whothe object to search
namename to search for
Returns
the first object which has a name equal to the argument, NULL if none found.

Definition at line 3956 of file object.cpp.

References add_string(), free_string(), give::name, Ice::tmp, and autojail::who.

Referenced by apply_changes_to_player(), cfapi_object_find_by_name(), is_old_wraith_pl(), is_wraith_pl(), and move_detector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_find_by_name_global()

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"

Parameters
strname to search for. Must not be allocated by add_string().
Returns
the first object which has a name equal to the argument.

Definition at line 747 of file object.cpp.

References add_string(), free_string(), give::name, objects, give::op, and make_face_from_files::str.

Referenced by command_possess(), find_object_both(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_find_by_tag()

object* object_find_by_tag ( const object who,
tag_t  tag 
)

Find object in inventory.

Parameters
whowhere to search.
tagwhat to search.
Returns
first object in who's inventory that has the given tag. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4060 of file object.cpp.

References CFweardisguise::tag, Ice::tmp, and autojail::who.

Referenced by command_cast_spell().

+ Here is the caller graph for this function:

◆ object_find_by_tag_global()

object* object_find_by_tag_global ( tag_t  i)

Returns the object which has the count-variable equal to the argument.

Parameters
itag.
Returns
matching object, NULL if not found.

Definition at line 727 of file object.cpp.

References objects, and give::op.

Referenced by cftimer_process_event(), command_diff(), command_insert_into(), command_inventory(), command_possess(), command_stack_list(), dm_stack_peek(), find_object_both(), get_dm_object(), and START_TEST().

+ Here is the caller graph for this function:

◆ object_find_by_type()

object* object_find_by_type ( const object who,
int  type 
)

Find object in inventory.

Parameters
whowhere to search.
typewhat to search.
Returns
first object in who's inventory that has the same type match. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 3980 of file object.cpp.

References Ice::tmp, is_valid_types_gen::type, and autojail::who.

Referenced by fire_bow(), has_ability(), and transport_type_apply().

+ Here is the caller graph for this function:

◆ object_find_by_type2()

object* object_find_by_type2 ( const object who,
int  type1,
int  type2 
)

Find object in inventory.

Parameters
whowhere to search.
type1what to search.
type2what to search.
Returns
first object in who's inventory that has either type match. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4037 of file object.cpp.

References Ice::tmp, and autojail::who.

Referenced by dispel_rune(), and hit_player().

+ Here is the caller graph for this function:

◆ object_find_by_type_and_arch_name()

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.

Parameters
whowhere to search.
typewhat to search.
namewhat to search.
Returns
first object in who's inventory that has the type and archetype name match. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4277 of file object.cpp.

References give::name, Ice::tmp, is_valid_types_gen::type, and autojail::who.

Referenced by check_login(), command_resistances(), dragon_eat_flesh(), dragon_focus_type_apply(), dragon_level_gain(), and perceive_self().

+ Here is the caller graph for this function:

◆ object_find_by_type_and_name()

object* object_find_by_type_and_name ( const object who,
int  type,
const char *  name 
)

Find object in inventory by type and name.

Parameters
whowhere to search.
typewhat to search.
namewhat to search
Returns
first object in who's inventory that has the same type and name match. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4108 of file object.cpp.

References give::name, Ice::tmp, is_valid_types_gen::type, and autojail::who.

Referenced by check_probe(), check_spell_known(), describe_monster(), do_symptoms(), examine_monster(), find_symptom(), grant_immunity(), infect_object(), and old_describe_monster().

+ Here is the caller graph for this function:

◆ object_find_by_type_and_race()

object* object_find_by_type_and_race ( const object who,
int  type,
const char *  race 
)

Find object in inventory by type and race.

Parameters
whowhere to search.
typewhat to search.
racewhat to search
Returns
first object in who's inventory that has the same type and race match. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4133 of file object.cpp.

References Ice::tmp, is_valid_types_gen::type, and autojail::who.

Referenced by monster_check_apply().

+ Here is the caller graph for this function:

◆ object_find_by_type_and_skill()

object* object_find_by_type_and_skill ( const object who,
int  type,
const char *  skill 
)

Find object in inventory by type and skill.

Parameters
whowhere to search.
typewhat to search.
skillwhat to search
Returns
first object in who's inventory that has the same type and skill match. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4183 of file object.cpp.

References Ice::tmp, is_valid_types_gen::type, and autojail::who.

Referenced by do_skill().

+ Here is the caller graph for this function:

◆ object_find_by_type_and_slaying()

object* object_find_by_type_and_slaying ( const object who,
int  type,
const char *  slaying 
)

Find object in inventory by type and slaying.

Parameters
whowhere to search.
typewhat to search.
slayingwhat to search
Returns
first object in who's inventory that has the same type and slaying match. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4158 of file object.cpp.

References Ice::tmp, is_valid_types_gen::type, and autojail::who.

Referenced by attempt_recipe(), enter_exit(), find_force(), find_key(), move_detector(), and op_on_battleground().

+ Here is the caller graph for this function:

◆ object_find_by_type_applied()

object* object_find_by_type_applied ( const object who,
int  type 
)

Find applied object in inventory.

Parameters
whowhere to search.
typewhat to search.
Returns
first object in who's inventory that has the same type match. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4083 of file object.cpp.

References FLAG_APPLIED, QUERY_FLAG, Ice::tmp, is_valid_types_gen::type, and autojail::who.

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().

+ Here is the caller graph for this function:

◆ object_find_by_type_subtype()

object* object_find_by_type_subtype ( const object who,
int  type,
int  subtype 
)

Find object in inventory.

Parameters
whowhere to search.
type
subtypewhat to search.
Returns
first object in who's inventory that has the same type and subtype match. NULL if no match.
Note
will not search in inventory of items in inventory.

Definition at line 4301 of file object.cpp.

References Ice::tmp, is_valid_types_gen::type, and autojail::who.

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().

+ Here is the caller graph for this function:

◆ object_find_by_type_without_flags()

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.

Parameters
whowhere to search.
typewhat to search.
flagsArray of integers corresponding to the set of flags that cannot have any set on the found item.
num_flagsThe size of the array flags above
Returns
first object in inventory that matches type and lacks any of the specified flags

Definition at line 4004 of file object.cpp.

References flags, QUERY_FLAG, Ice::tmp, is_valid_types_gen::type, and autojail::who.

Referenced by find_key().

+ Here is the caller graph for this function:

◆ object_find_first_free_spot()

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. 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.

Parameters
obobject to insert.
m
x
ywhere to insert the object.
Returns
index into freearr_x and freearr_y, -1 if no spot available (dir 0 = x,y)

Definition at line 3599 of file object.cpp.

References freearr_x, freearr_y, m, guildjoin::ob, ob_blocked(), SIZEOFFREE, diamondslots::x, and diamondslots::y.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_find_free_spot()

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.

It returns a random choice among the alternatives found.

Parameters
obobject to insert.
m
x
ywhere to insert the object.
start
stopfirst (inclusive) and last (exclusive) positions, in the freearr_ arrays, to search.
Returns
index into freearr_x and freearr_y, -1 if no spot available (dir 0 = x,y)
Note
this only checks to see if there is space for the head of the object - if it is a multispace object, this should be called for all pieces.
This function does correctly handle tiled maps, but does not inform the caller. However, object_insert_in_map will update as necessary, so the caller shouldn't need to do any special work.
Updated to take an object instead of archetype - this is necessary because arch_blocked (now ob_blocked) needs to know the movement type to know if the space in question will block the object. We can't use the archetype because that isn't correct if the monster has been customized, changed states, etc.

Definition at line 3559 of file object.cpp.

References AB_NO_PASS, freearr_x, freearr_y, npc_dialog::index, m, maxfree, guildjoin::ob, ob_blocked(), RANDOM, SIZEOFFREE, roll-o-matic::stop(), diamondslots::x, and diamondslots::y.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_find_multi_free_spot_around()

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.

Parameters
obobject to insert. Must not be NULL.
genwhere to insert. Must not be NULL.
[out]hx
[out]hycoordinates at which insertion is possible.
Returns
0 for success and -1 for failure.
Note
This function assumes that multi-tile objects are rectangular.

Definition at line 3296 of file object.cpp.

References HEAD, object::map, MAP_HEIGHT, MAP_WIDTH, guildjoin::ob, ob_blocked(), object_get_multi_size(), RANDOM, object::x, and object::y.

Referenced by change_object().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_find_multi_free_spot_within_radius()

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.

Parameters
obobject to insert. Must not be NULL.
genwhere to insert. Must not be NULL.
[out]hx
[out]hycoordinates at which insertion is possible.
Returns
0 for success and -1 for failure.
Note
This function assumes that multi-tile objects are rectangular.

Definition at line 3412 of file object.cpp.

References get_map_flags(), HEAD, object::map, guildjoin::ob, ob_blocked(), object_get_multi_size(), object_get_value(), P_OUT_OF_MAP, RANDOM, autojail::value, diamondslots::x, object::x, diamondslots::y, and object::y.

Referenced by generate_monster_arch(), and generate_monster_inv().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_fix_multipart()

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

Parameters
tmpobject we want to fix. Must be on a map.

Definition at line 4685 of file object.cpp.

References add_string(), arch_to_object(), free_string(), INS_ABOVE_FLOOR_ONLY, INS_NO_MERGE, INS_NO_WALK_ON, llevError, LOG(), object::more, archetype::more, object_insert_in_map(), give::op, and Ice::tmp.

Referenced by change_object(), generate_monster_inv(), link_multipart_objects(), and object_handle_death_animation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_free()

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.

Parameters
obobject to free. Will become invalid when function returns.
flagsthe flags; see FREE_OBJ_xxx constants.
Warning
the object's archetype should be a valid pointer, or NULL.

Definition at line 1592 of file object.cpp.

References 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, INS_ABOVE_FLOOR_ONLY, llevError, llevMonster, LOG(), object::map, MAP_IN_MEMORY, object::more, MOVE_ALL, nroffreeobjects, guildjoin::ob, 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, give::op, object::prev, QUERY_FLAG, RANDOM, remove_friendly_object(), RUNE, SCRIPT_FIX_NOTHING, SET_FLAG, SIZEOFFREE, stringbuffer_finish(), stringbuffer_new(), TRAP, object::x, and object::y.

Referenced by add_one_item(), alchemy_object(), apply_auto(), apply_by_living(), apply_race_and_class(), ArtifactPanel::artifactChanged(), 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(), CRECombatSimulator::fight(), free_all_objects(), free_no_drop(), god_gives_present(), monsterFight(), move_aura(), object_free(), object_free_drop_inventory(), object_free_inventory(), object_insert_in_map(), object_insert_in_ob(), object_merge(), object_split(), CRETreasurePanel::onGenerate(), 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(), START_TEST(), stop_projectile(), town_portal_destroy_existing(), town_portal_find_force(), and write_scroll().

+ Here is the call graph for this function:

◆ object_free_all_data()

void object_free_all_data ( void  )

Destroys all allocated objects.

Note
free() is called instead of object_free_drop_inventory() as the object's memory has already by cleaned.
Warning
this should be the last method called.

Definition at line 767 of file object.cpp.

References FLAG_FREED, free_objects, llevDebug, LOG(), give::next, nrofallocobjects, nroffreeobjects, objects, give::op, QUERY_FLAG, and STARTMAX.

Referenced by cleanup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_free_drop_inventory()

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.

Parameters
obobject to free. Will become invalid when function returns.

Definition at line 1560 of file object.cpp.

References guildjoin::ob, and 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(), START_TEST(), stop_item(), stop_projectile(), tailor_god_spell(), tear_down_wall(), and thrown_object_type_process().

+ Here is the call graph for this function:

◆ object_free_inventory()

void object_free_inventory ( object ob)

Frees the inventory of an object, without any callback.

Parameters
obobject to free the inventory of.

Definition at line 1568 of file object.cpp.

References FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, commongive::inv, guildjoin::ob, object_free(), and object_remove().

Referenced by asset_destroy(), Archetypes::recursive_update(), and Archetypes::replace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_free_key_values()

void object_free_key_values ( object op)

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

Parameters
opobject to clear.

Definition at line 954 of file object.cpp.

References FREE_AND_CLEAR_STR, key_value::key, give::next, key_value::next, give::op, and key_value::value.

Referenced by free_arch(), free_artifact(), object_clear(), object_copy_no_speed(), and object_free().

+ Here is the caller graph for this function:

◆ object_get_env_recursive()

object* object_get_env_recursive ( object op)

Utility function.

Parameters
opobject we want the environment of. Can't be NULL.
Returns
the outermost environment object for a given object. Will not be NULL.

Definition at line 590 of file object.cpp.

References give::op.

Referenced by animate_bomb(), cfapi_object_set_property(), do_execute_event(), explode_bullet(), spring_trap(), and START_TEST().

+ Here is the caller graph for this function:

◆ object_get_key_value()

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

Search for a field by key.

Parameters
obobject where search
keykey to search. Must be a passed in shared string - otherwise, this won't do the desired thing.
Returns
the link from the list if ob has a field named key, otherwise NULL.

Definition at line 4321 of file object.cpp.

References key_value::key, castle_read::key, key_value::next, and guildjoin::ob.

Referenced by compare_ob_value_lists_one(), get_ob_diff(), object_set_value_s(), and process_object().

+ Here is the caller graph for this function:

◆ object_get_multi_size()

void object_get_multi_size ( const object ob,
int *  sx,
int *  sy,
int *  hx,
int *  hy 
)

Computes the size of a multitile object.

Parameters
obobject we compute the size of.
[out]sx
[out]sywill contain the coords of the bottom right tail relative to the head. Must not be NULL.
[out]hx
[out]hywill contain the coords of the head tile relative to the top left tile. Can be NULL.
Todo:
either check for sx/sy everywhere or remove the check :)

Definition at line 4744 of file object.cpp.

References archetype::clone, HEAD, archetype::more, guildjoin::ob, 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().

+ Here is the caller graph for this function:

◆ object_get_owner()

object* object_get_owner ( object op)

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.

Parameters
opitem to search owner of.
Returns
owner, or NULL if not found.

Definition at line 804 of file object.cpp.

References FLAG_FREED, FLAG_REMOVED, object_clear_owner(), give::op, 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(), START_TEST(), steal(), tailor_god_spell(), trap_disarm(), and use_oratory().

+ Here is the call graph for this function:

◆ object_get_player_container()

object* object_get_player_container ( object op)

Finds the player carrying an object.

Parameters
opitem for which we want the carrier (player).
Returns
the player, or NULL if not in an inventory.
Todo:
this function is badly named. Fix patching on the fly.

Definition at line 607 of file object.cpp.

References give::op, and PLAYER.

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(), send_changed_object(), and START_TEST().

+ Here is the caller graph for this function:

◆ object_get_value()

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

Get an extra value by key.

Parameters
opobject we're considering
keykey of which to retrieve the value. Doesn't need to be a shared string.
Returns
the value of op has in an extra_field for key, or NULL if it doesn't have the key.
Note
The returned string is shared.

Definition at line 4346 of file object.cpp.

References find_string(), key_value::key, castle_read::key, key_value::next, give::op, 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(), ResourcesManager::archetypeUse(), 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(), CREMainWindow::onReportDuplicate(), price_base(), reportSummon(), send_arch_info(), set_object_face_main(), set_object_face_other(), shop_price_buy(), shop_price_sell(), SP_level_wc_adjust(), spell_consume_items(), START_TEST(), transport_type_apply(), and ArchetypeWrapper::uses().

+ Here is the call graph for this function:

◆ object_give_identified_properties()

void object_give_identified_properties ( object op)

Ensure op has all its "identified" properties set.

Parameters
opobject to process.

Definition at line 1356 of file item.cpp.

References animate::anim, animate_object(), CLEAR_FLAG, FLAG_ANIMATE, FLAG_CLIENT_ANIM_RANDOM, FLAG_CLIENT_ANIM_SYNC, FLAG_IS_TURNABLE, FREE_AND_COPY, castle_read::key, object_get_value(), object_set_value(), give::op, QUERY_FLAG, SET_FLAG, sstring, try_find_animation(), and try_find_face().

Referenced by add_abilities(), add_one_item(), ArtifactPanel::artifactChanged(), check_loaded_object(), command_create(), identify(), make_item_from_recipe(), and recipe_get_face().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_handle_death_animation()

void object_handle_death_animation ( object op)

Definition at line 5410 of file object.cpp.

References object::arch, create_archetype(), archetype::more, object_fix_multipart(), object_get_value(), object_insert_in_map_at(), give::op, and sstring.

Referenced by generate_monster(), and kill_object().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_insert_in_map()

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.

It will update player count if the op is a player.

Player ground window will be updated if needed.

Parameters
opobject to insert. Must be removed. Its coordinates must be valid for the map.
mmap to insert into. Must not be NULL.
originatorplayer, monster or other object that caused 'op' to be inserted into 'm'. May be NULL.
flagbitmask 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.
Returns
  • new object if 'op' was merged with other object.
  • NULL if 'op' was destroyed
  • just 'op' otherwise
Todo:
this function is a mess, and should be cleaned.

Definition at line 2361 of file object.cpp.

References object::below, CLEAR_FLAG, object::contr, find_insert_pos(), FLAG_ALIVE, FLAG_APPLIED, FLAG_FREED, FLAG_INV_LOCKED, FLAG_NO_STEAL, FLAG_REMOVED, 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, INS_BELOW_ORIGINATOR, INS_MAP_LOAD, INS_NO_MERGE, INS_NO_WALK_ON, LAMP, llevError, LOG(), m, object::map, MAP_DARKNESS, object_can_merge(), object_check_move_on(), object_dump(), object_free(), object_insert_in_map(), object_merge_spell(), object_remove(), object_update(), give::op, out_of_map(), OUT_OF_REAL_MAP, object::ox, object::oy, PLAYER, QUERY_FLAG, SET_MAP_OB, SET_MAP_TOP, SPELL_EFFECT, stringbuffer_finish(), stringbuffer_new(), Ice::tmp, give::top, player::transport, UP_OBJ_INSERT, update_all_los(), diamondslots::x, object::x, diamondslots::y, and object::y.

Referenced by change_object(), fix_stopped_item(), object_fix_multipart(), object_insert_in_map(), object_insert_in_map_at(), pick_up(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_insert_in_map_at()

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.

Parameters
opobject to insert.
mmap to insert into.
originatorwhat caused op to be inserted.
flagCombination of INS_xxx values.
x
ycoordinates to insert at.

Definition at line 2100 of file object.cpp.

References HEAD, m, object_insert_in_map(), give::op, Ice::tmp, diamondslots::x, and diamondslots::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_test(), do_throw(), drop_object(), eat_special_food(), enter_map(), explode_bullet(), explosion(), CRECombatSimulator::fight(), 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(), monsterFight(), 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(), setup(), shop_mat_type_move_on(), spell_effect(), spell_failure(), spring_trap(), START_TEST(), 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().

+ Here is the call graph for this function:

◆ object_insert_in_ob()

object* object_insert_in_ob ( object op,
object where 
)

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

It will send to client where is a player.

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

Definition at line 2857 of file object.cpp.

References BITMASK_EVENT, CLEAR_FLAG, CONTAINER, object::contr, esrv_send_item(), EVENT_CONNECTOR, 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, HEAD, llevDebug, llevError, LOG(), MAP_DARKNESS, object_add_weight(), object_can_merge(), object_dump(), object_free(), object_get_player_container(), object_increase_nrof(), give::op, P_NEED_UPDATE, altar_valkyrie::pl, QUERY_FLAG, SET_FLAG, SET_MAP_FLAGS, SKILL, stringbuffer_finish(), stringbuffer_new(), Ice::tmp, update_all_los(), update_position(), and python_pickup::where.

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(), do_harvest(), do_learn_spell(), do_symptoms(), do_test(), 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(), local_check_loaded_object(), magic_wall(), make_object_glow(), make_throw_ob(), mimic_type_apply(), monster_check_pickup(), monsterFight(), 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(), START_TEST(), stick_arrow(), swap_random_stats(), town_portal_find_force(), transmute_item_to_flower(), transport_type_apply(), while(), write_note(), write_rune(), and write_scroll().

+ Here is the call graph for this function:

◆ object_insert_to_free_spot_or_free()

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.

Parameters
opthe object to insert or free
mapthe map to insert into
xthe x-coordinate to insert into
ythe y-coordinate to insert into
startfirst (inclusive) position in the freearr_ arrays to search
stoplast (exclusive) position in the freearr_ arrays to search
originatorwhat caused op to be inserted.

Definition at line 4791 of file object.cpp.

References freearr_x, freearr_y, disinfect::map, object_find_free_spot(), object_free_drop_inventory(), object_insert_in_map_at(), give::op, roll-o-matic::stop(), diamondslots::x, and diamondslots::y.

Referenced by change_object(), and object_free().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_matches_pickup_mode()

int object_matches_pickup_mode ( const object item,
int  mode 
)

Checks if an item matches a specific pickup mode.

Parameters
itemitem to check.
modeone value of Pickup modes, not a combination of modes.
Returns
0 if the item doesn't match, a non-zero value if it matches.

Definition at line 656 of file c_object.cpp.

References AMULET, ARMOUR, ARMOUR_IMPROVER, ARROW, BOOK, BOOTS, BOW, CLOAK, CONTAINER, DRINK, FLAG_IS_THROWN, FLAG_KNOWN_CURSED, FLAG_KNOWN_MAGICAL, FLESH, FOOD, GEM, GLOVES, HELMET, KEY, MONEY, POISON, POTION, PU_ARMOUR, PU_ARROW, PU_BOOTS, PU_BOW, PU_CLOAK, PU_CONTAINER, PU_CURSED, PU_DRINK, PU_FLESH, PU_FOOD, PU_GLOVES, PU_HELMET, PU_JEWELS, PU_KEY, PU_MAGIC_DEVICE, PU_MAGICAL, PU_MELEEWEAPON, PU_MISSILEWEAPON, PU_POTION, PU_READABLES, PU_SHIELD, PU_SKILLSCROLL, PU_SPELLBOOK, PU_VALUABLES, QUERY_FLAG, RING, ROD, SCROLL, SHIELD, SKILL_TOOL, SKILLSCROLL, SPECIAL_KEY, SPELLBOOK, WAND, WEAPON, and WEAPON_IMPROVER.

Referenced by check_pick(), and matcher_pickup_type().

+ Here is the caller graph for this function:

◆ object_matches_string()

int object_matches_string ( object pl,
object op,
const char *  name 
)

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):

match type return value

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)

Parameters
plobject we're searching an item for. Must not be NULL.
opobject we're considering. Must not be NULL.
namestring we're searching.
Returns
matching weight. The higher, the more the object matches.
Todo:
is the player->contr->count hack used?? Try to reduce buffers/calls to query_ functions.

Definition at line 4574 of file object.cpp.

References disinfect::count, CUSTOM_NAME_FIELD, FLAG_CURSED, FLAG_DAMNED, FLAG_INV_LOCKED, FLAG_KNOWN_CURSED, FLAG_UNPAID, HUGE_BUF, MAX_BUF, give::name, object_get_value(), give::op, altar_valkyrie::pl, PLAYER, query_base_name(), QUERY_FLAG, query_name(), query_short_name(), safe_strncpy, sstring, and strcasecmp().

Referenced by check_pick(), find_best_apply_object_match(), matcher_name(), START_TEST(), and write_rune().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_merge()

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.

Will correctly send updated objects to client if needed.

Parameters
opobject to merge.
topfrom which item to merge. If NULL, it is calculated.
Returns
pointer to object if it succeded in the merge, otherwise NULL

Definition at line 2051 of file object.cpp.

References FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, object_can_merge(), object_free(), object_increase_nrof(), object_remove(), give::op, and give::top.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_merge_spell()

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.

Parameters
opobject to try to merge into.
x
ycoordinates to look at for merging.

Definition at line 2129 of file object.cpp.

References FOR_MAP_FINISH, FOR_MAP_PREPARE, FREE_AND_CLEAR, llevError, LOG(), MAX, OB_SPELL_TAG_HASH, OB_SPELL_TAG_MATCH, object_free_drop_inventory(), object_remove(), give::op, Statistics::spell_hash_full, Statistics::spell_merges, SPELL_TAG_SIZE, statistics, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by explosion(), and object_insert_in_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_new()

◆ object_present_in_ob()

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.

Parameters
typetype to search for.
opobject to search into.
Returns
first matching object, or NULL if none matches.

Definition at line 3168 of file object.cpp.

References give::op, Ice::tmp, and is_valid_types_gen::type.

Referenced by blind_living(), cfapi_object_get_property(), check_probe(), and examine_monster().

+ Here is the caller graph for this function:

◆ object_present_in_ob_by_name()

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. 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.

Parameters
typeobject type to search for. -1 means to ignore it.
strobject name to search for.
opwhere to search.
Returns
first matching object, or NULL if none matches.
Todo:
use add_string() hack to avoid the strcmp?

Definition at line 3203 of file object.cpp.

References give::op, make_face_from_files::str, Ice::tmp, and is_valid_types_gen::type.

Referenced by apply_changes_to_player(), become_follower(), cast_heal(), cfapi_object_get_property(), confuse_living(), and create_aura().

+ Here is the caller graph for this function:

◆ object_remove()

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.

Parameters
opobject to remove. Must not be removed yet, else abort() is called.
Todo:
this function is a piece of overbloated crap or at lest look like need cleanup it does to much different things.

Definition at line 1833 of file object.cpp.

References object::above, CLEAR_FLAG, CONTAINER, object::contr, esrv_del_item(), esrv_update_item(), 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, llevError, LOG(), LOOK_OBJ, m, MAP_SAVING, ob_move_on(), object_dump(), object_get_player_container(), object_remove(), object_sub_weight(), object_update(), object_was_destroyed, give::op, P_NEED_UPDATE, altar_valkyrie::pl, PLAYER, QUERY_FLAG, SET_FLAG, SET_MAP_FLAGS, SET_MAP_OB, SET_MAP_TOP, stringbuffer_finish(), stringbuffer_new(), CFweardisguise::tag, Ice::tmp, UP_OBJ_REMOVE, UPD_FLAGS, update_all_los(), update_position(), diamondslots::x, and diamondslots::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(), CRECombatSimulator::fight(), 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(), monsterFight(), 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(), CRETreasurePanel::onGenerate(), 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(), START_TEST(), 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().

+ Here is the call graph for this function:

◆ object_remove_from_active_list()

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.

Parameters
opobject to remove.

Definition at line 1392 of file object.cpp.

References active_objects, and give::op.

Referenced by load_objects(), object_update_speed(), and START_TEST().

+ Here is the caller graph for this function:

◆ object_replace_insert_in_map()

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.

Parameters
arch_stringobject's archetype to insert.
opobject 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_free_drop_inventory(), object_insert_in_map_at(), object_remove(), give::op, and Ice::tmp.

Referenced by save_throw_object(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_reset()

void object_reset ( object op)

Totally resets the specified object, without freeing associated memory.

Parameters
opobject to reset.

Definition at line 934 of file object.cpp.

References object_clear(), and give::op.

Referenced by cfapi_object_reset(), check_login(), ArtifactLoader::load(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_set_cheat()

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.

Parameters
opobject for which to set the flag.

Definition at line 3274 of file object.cpp.

References FLAG_WAS_WIZ, object_set_flag_inv(), give::op, and SET_FLAG.

Referenced by cfapi_object_set_property().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_set_enemy()

void object_set_enemy ( object op,
object enemy 
)

Sets the enemy of an object.

Parameters
opthe object of which to set the enemy
enemythe new enemy for op; can be NULL to clear the enemy

Definition at line 915 of file object.cpp.

References object::count, llevDebug, LOG(), object::name, give::op, and PLAYER.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_set_flag_inv()

void object_set_flag_inv ( object op,
int  flag 
)

Activate recursively a flag on an object's inventory

Parameters
opobject to recurse. Can have an empty inventory.
flagflag to set.

Definition at line 3239 of file object.cpp.

References object_set_flag_inv(), give::op, SET_FLAG, and Ice::tmp.

Referenced by check_loaded_object(), local_check_loaded_object(), object_set_cheat(), and object_set_flag_inv().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_set_msg()

void object_set_msg ( object op,
const char *  msg 
)

◆ object_set_owner()

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.

Parameters
opobject of which to set the owner
ownernew 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(), give::op, and Ice::tmp.

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(), START_TEST(), use_oratory(), and write_rune().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_set_value()

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

Updates the key in op to value.

Parameters
opobject we're considering.
keykey to set or update. Doesn't need to be a shared string.
valuevalue to set. Doesn't need to be a shared string.
add_keyif 0, will not add the key if it doesn't exist in op.
Returns
TRUE if key was updated or added, FALSE else.
Note
This function is merely a wrapper to object_set_value_s() to ensure the key is a shared string.
In general, should be little reason FALSE is ever passed in for add_key

Definition at line 4499 of file object.cpp.

References add_string(), FALSE, find_string(), free_string(), castle_read::key, object_set_value_s(), give::op, TRUE, and autojail::value.

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(), START_TEST(), and store_spell_expiry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_split()

object* object_split ( object orig_ob,
uint32_t  nr,
char *  err,
size_t  size 
)

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.

Parameters
orig_obobject from which to split.
nrnumber of elements to split.
errbuffer that will contain failure reason if NULL is returned. Can be NULL.
sizeerr's size
Returns
split object, or NULL on failure.

Definition at line 2637 of file object.cpp.

References FLAG_REMOVED, FREE_OBJ_FREE_INVENTORY, llevDebug, LOG(), MAX, object::name, commongive::newob, 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(), put_object_in_sack(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_sub_weight()

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.

Parameters
opobject to which weight is substracted.
weightweight to remove.
Todo:
check if not mergeable with object_add_weight().

Definition at line 1807 of file object.cpp.

References CONTAINER, and give::op.

Referenced by make_item_from_recipe(), object_decrease_nrof(), object_increase_nrof(), object_remove(), and START_TEST().

+ Here is the caller graph for this function:

◆ object_sum_weight()

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.

Parameters
opobject we want the weight of.
Returns
weight of this item and all its inventory.
Note
The object's carrying field is updated.

Definition at line 568 of file object.cpp.

References CONTAINER, FOR_INV_FINISH, FOR_INV_PREPARE, commongive::inv, NROF(), object_sum_weight(), and give::op.

Referenced by cfapi_object_set_property(), check_login(), command_fix_me(), fix_weight(), load_objects(), object_sum_weight(), START_TEST(), and transport_type_apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_unset_flag_inv()

void object_unset_flag_inv ( object op,
int  flag 
)

Desactivate recursively a flag on an object inventory

Parameters
opobject to recurse. Can have an empty inventory.
flagflag to unset.

Definition at line 3256 of file object.cpp.

References CLEAR_FLAG, object_unset_flag_inv(), give::op, and Ice::tmp.

Referenced by do_item_conversion(), generate_monster_inv(), move_creator(), and object_unset_flag_inv().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_update()

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)

Parameters
opobject to update
actionHint 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.
Todo:
this function should be renamed to something like object_update_map, object_update is a too general term Also it might be worth moving it to map.c

Definition at line 1434 of file object.cpp.

References convert::action, 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, llevDebug, llevError, LOG(), MAP_HEIGHT, MAP_SAVING, MAP_WIDTH, object_update(), give::op, P_BLOCKSVIEW, P_IS_ALIVE, P_NEED_UPDATE, P_NO_CLERIC, P_NO_ERROR, P_NO_MAGIC, P_PLAYER, altar_valkyrie::pl, PLAYER, QUERY_FLAG, SET_MAP_FLAGS, UP_OBJ_CHANGE, UP_OBJ_FACE, UP_OBJ_INSERT, UP_OBJ_REMOVE, UPD_FACE, and update_position().

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_update_speed()

void object_update_speed ( object op)

◆ object_update_turn_face()

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.

Parameters
opobject to update.

Definition at line 1332 of file object.cpp.

References animate_object(), FLAG_IS_TURNABLE, give::op, 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(), spinner_type_move_on(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_value_set()

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 castle_read::key, object_get_value(), and give::op.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ object_value_set_shared()

bool object_value_set_shared ( const object op,
sstring  key 
)

Determine if an extra value is set to a non empty or 0 value.

Parameters
opobject which may contain the value.
keyvalue to search for, must be a shared string.
Returns
true if the value is set to non 0 or empty, false else.

Definition at line 4390 of file object.cpp.

References castle_read::key, and give::op.

Referenced by update_position().

+ Here is the caller graph for this function:

◆ on_same_map()

int on_same_map ( const object op1,
const object op2 
)

Checks whether 2 objects are on the same map or not.

Note we only look one map out to keep the processing simple and efficient. This could probably be a macro. MSW 2001-08-05

Parameters
op1first object.
op2second object.
Returns
TRUE if op1 and op2 are effectively on the same map (as related to map tiling).
Note
This looks for a path from op1 to op2, so if the tiled maps are assymetric and op2 has a path to op1, this will still return false.

Definition at line 2598 of file map.cpp.

References adjacent_map(), and object::map.

Referenced by abort_attack(), adj_attackroll(), cfapi_object_on_same_map(), get_attack_mode(), monster_check_enemy(), monster_find_enemy(), monster_move(), move_ball_spell(), pets_attempt_follow(), pets_get_enemy(), pets_move(), and share_exp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operate_altar()

int operate_altar ( object altar,
object **  sacrifice 
)

Checks if sacrifice was accepted and removes sacrificed objects. Might be better to call check_altar_sacrifice (above) than depend on the return value, since operate_altar will remove the sacrifice also.

If this function returns 1, '*sacrifice' is modified to point to the remaining sacrifice, or is set to NULL if the sacrifice was used up.

Parameters
altaritem to which there is a sacrifice
sacrificeobject that may be sacrifed
Returns
1 if sacrifice was accepted, else 0

Definition at line 463 of file button.cpp.

References altar_valkyrie::altar, check_altar_sacrifice(), ext_info_map(), llevError, LOG(), MSG_TYPE_DIALOG, MSG_TYPE_DIALOG_ALTAR, NDI_BLACK, and object_decrease_nrof().

Referenced by altar_type_move_on(), check_trigger(), and identify_altar_type_move_on().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ out_of_map()

int out_of_map ( mapstruct m,
int  x,
int  y 
)

Return 1 if coordinates X and Y are out of the map M, taking into account tiling.

Parameters
mmap to consider. Must not be NULL.
x
ycoordinates.
Returns
1 if out of map, 0 else
Deprecated:
Use get_map_from_coord() instead

Definition at line 2293 of file map.cpp.

References get_map_from_coord(), m, diamondslots::x, and diamondslots::y.

Referenced by animate_bomb(), cfapi_map_out_of_map(), command_create(), enter_map(), esrv_draw_look(), explode_bullet(), look_at(), move_player_attack(), move_teleporter(), object_insert_in_map(), and object_teleport().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ path_combine()

char* path_combine ( const char *  src,
const char *  dst,
char *  path,
size_t  size 
)

Combines 2 paths, which can be relative.

Parameters
srcpath we're starting from.
dstpath we're doing to.
pathbuffer containing the combined path.
sizesize of path.
Returns
path.
Note
this doesn't handle the '..', check path_normalize().

Definition at line 51 of file path.cpp.

◆ path_combine_and_normalize()

char* path_combine_and_normalize ( const char *  src,
const char *  dst,
char *  path,
size_t  size 
)

Combines the 2 paths.

Parameters
srcpath we're starting from.
dstpath we're getting to.
pathbuffer that will contain combined paths.
sizelength of path.
Returns
path

Definition at line 172 of file path.cpp.

◆ path_normalize()

void path_normalize ( char *  path)

Cleans specified path. Removes .. and things like that.

Parameters
pathpath to clear. It will be modified in place.
Note
there shouldn't be any buffer overflow, as we just remove stuff.

Definition at line 85 of file path.cpp.

◆ player_get_own_title()

const char* player_get_own_title ( const struct player pl)

Returns the player's own title. The returned value must not be modified and points into the player structure.

Parameters
plthe player
Returns
the own title

Definition at line 260 of file player.cpp.

References altar_valkyrie::pl.

Referenced by save_player().

+ Here is the caller graph for this function:

◆ player_get_title()

void player_get_title ( const struct player pl,
char *  buf,
size_t  bufsize 
)

◆ player_has_own_title()

int player_has_own_title ( const struct player pl)

Returns whether the player has a custom title.

Parameters
plthe player to check
Returns
whether the player has a custom title

Definition at line 247 of file player.cpp.

References altar_valkyrie::pl.

Referenced by command_title(), and save_player().

+ Here is the caller graph for this function:

◆ player_lvl_adj()

void player_lvl_adj ( object who,
object op 
)

For the new exp system. we are concerned with whether the player gets more hp, sp and new levels. Note this this function should only be called for players. Monsters don't really gain levels

Will tell the player about changed levels. A single call will handle mutiple level changes to one object from one effect. The only difference between this and the recursive version is this cannot handle a level that both increases and decreases simultaneously.

Parameters
whoplayer, must not be NULL.
opwhat we are checking to gain the level (eg, skill), can be NULL.

Definition at line 1826 of file living.cpp.

References buf, die_roll(), dragon_level_gain(), draw_ext_info(), fix_object(), is_dragon_pl(), level_exp(), MAX_BUF, Settings::max_level, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_LEVEL_GAIN, MSG_TYPE_ATTRIBUTE_LEVEL_LOSS, NDI_RED, NDI_UNIQUE, give::op, PLAYER, PREFER_HIGH, settings, and autojail::who.

Referenced by add_player_exp(), apply_death_exp_penalty(), command_addexp(), and subtract_player_exp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ player_set_dragon_title()

void player_set_dragon_title ( player pl,
int  level,
const char *  attack,
int  skin_resist 
)

Updates the title of a dragon player to reflect the current level, attack type, and resistances.

Parameters
plthe player to update
levelthe dragon's current level
attackthe dragon's current attack focus
skin_resistthe dragon's skin resistance for attack

Definition at line 202 of file player.cpp.

References altar_valkyrie::pl.

Referenced by set_dragon_name().

+ Here is the caller graph for this function:

◆ player_set_own_title()

void player_set_own_title ( struct player pl,
const char *  title 
)

Sets the custom title.

Parameters
plthe player to modify
titlethe new title to set; empty string to unset

Definition at line 272 of file player.cpp.

References altar_valkyrie::pl, replace_unprintable_chars(), and strlcpy().

Referenced by cfapi_object_set_property(), check_login(), command_title(), key_confirm_quit(), and kill_player_permadeath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_los()

void print_los ( object op)

Debug-routine which dumps the array which specifies the visible area of a player. Triggered by the DM command printlos.

Parameters
opDM asking for information.
Todo:
change the command to view another player's LOS?

Definition at line 665 of file los.cpp.

References buf, draw_ext_info(), LOS_BLOCKED, MAP_CLIENT_X, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DEBUG, NDI_UNIQUE, give::op, diamondslots::x, and diamondslots::y.

Referenced by command_printlos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_monsters()

void print_monsters ( void  )

As dump_abilities(), but with an alternative way of output.

Definition at line 100 of file info.cpp.

References arch_to_object(), AssetsManager::archetypes(), bitstostring(), AssetsCollection< T, Key >::each(), FLAG_MONSTER, FMT64, getManager(), new_exp(), NROFATTACKS, object_free_drop_inventory(), give::op, and QUERY_FLAG.

Referenced by init_beforeplay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_button()

void push_button ( object op)

Push the specified object. This can affect other buttons/gates/handles altars/pedestals/holes in the whole map. Changed the routine to loop through all linked objects. Better hurry with that linked list...

Parameters
opobject to push.

Definition at line 149 of file button.cpp.

References get_button_links(), give::op, and trigger_connected().

Referenced by altar_type_move_on(), cf_handle_type_apply(), move_detector(), update_button(), and use_trigger().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ query_base_name()

void query_base_name ( const object op,
int  plural,
char *  buf,
size_t  size 
)

Query a short name for the item.

This is a lot like query_name(), but we don't include the item count or item status. Used for inventory sorting and sending to client. If plural is set, we generate the plural name of this.

Parameters
opitem we want the name of.
pluralwhether to get the singular or plural name
bufbuffer that will contain the object's name. Must not be NULL.
sizebuffer's length

Definition at line 689 of file item.cpp.

References AMULET, buf, FLAG_BEEN_APPLIED, FLAG_IDENTIFIED, is_identified(), is_magical(), give::op, QUERY_FLAG, RING, ring_desc(), ROD, safe_strcat(), SCROLL, SKILL, SPELLBOOK, stringbuffer_finish(), strlcpy(), and WAND.

Referenced by add_object_to_socklist(), add_shop_item(), cfapi_object_get_property(), change_spell(), command_rename_item(), esrv_update_item(), fire_misc_object(), matches_sacrifice(), object_matches_string(), rangetostring(), and use_alchemy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ query_name()

void query_name ( const object op,
char *  buf,
size_t  size 
)

Describes an item.

Parameters
opitem to describe. Must not be NULL.
bufbuffer that will contain the description.
sizesize of buffer.

Definition at line 588 of file item.cpp.

References AMULET, ARMOUR, BOOK, BOOTS, BOW, BRACERS, buf, CLOAK, CONTAINER, FLAG_APPLIED, FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_INV_LOCKED, FLAG_KNOWN_BLESSED, FLAG_KNOWN_CURSED, FLAG_KNOWN_MAGICAL, FLAG_NO_SKILL_IDENT, FLAG_UNPAID, GIRDLE, GLOVES, HELMET, give::op, QUERY_FLAG, query_short_name(), RING, ROD, safe_strcat(), SHIELD, SKILL, WAND, and WEAPON.

Referenced by animate_weapon(), apply_builder_item(), apply_builder_remove(), apply_by_living(), apply_check_apply_restrictions(), apply_check_race_restrictions(), apply_container(), apply_special(), apply_update_ranged_skill(), attack_hth(), attempt_jump(), attempt_steal(), blind_living(), cast_smite_spell(), cast_spell(), cfapi_object_find_archetype_inside(), cfapi_object_forget_spell(), cfapi_object_get_property(), change_spell(), command_insert_into(), command_mark(), command_remove(), common_ob_describe(), converter_type_move_on(), do_skill(), do_skill_attack(), do_throw(), drop_object(), empty_container(), exit_type_apply(), find_key(), find_player_options(), find_throw_ob(), god_examines_item(), hit_with_one_attacktype(), inventory(), kill_object(), knowledge_alchemy_detail(), lamp_type_describe(), leave(), legacy_ob_describe(), look_at(), make_formula_book(), mark_item_cmd(), mimic_type_apply(), monster_can_detect_enemy(), monster_find_throw_ob(), monster_format_say(), object_matches_string(), CREUtils::objectNode(), pick_up_object(), polymorph_melt(), power_crystal_describe(), power_crystal_type_apply(), put_object_in_sack(), recharge(), recursive_roll(), sack_can_hold(), save_life(), save_throw_object(), sell_item(), shop_pay_unpaid_callback(), singing(), skillscroll_type_apply(), spellbook_type_apply(), spellbook_type_describe(), transport_type_apply(), treasure_type_apply(), unapply_for_ob(), unapply_special(), use_oratory(), and write_scroll().

+ Here is the call graph for this function:

◆ query_short_name()

void query_short_name ( const object op,
char *  buf,
size_t  size 
)

query_short_name(object) is similar to query_name(), but doesn't contain any information about object status (worn/cursed/etc.)

Parameters
opobject to describe.
bufbuffer which will contain the name. Must not be NULL.
sizebuffer length.

Definition at line 513 of file item.cpp.

References AMULET, buf, FLAG_BEEN_APPLIED, FLAG_IDENTIFIED, is_identified(), is_magical(), give::op, QUERY_FLAG, RING, ring_desc(), ROD, safe_strcat(), SCROLL, SKILL, SPELLBOOK, stringbuffer_finish(), strlcpy(), and WAND.

Referenced by cast_item_curse_or_bless(), cfapi_object_get_property(), command_lock_item(), dragon_ability_gain(), follower_remove_given_items(), god_gives_present(), lock_item_cmd(), object_matches_string(), player_attack_door(), query_name(), remove_force(), spellbook_type_apply(), transmute_item_to_flower(), and write_note().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ query_weight()

void query_weight ( const object op,
char *  buf,
size_t  size 
)

Formats the item's weight.

Parameters
opobject we want the weight of.
[out]bufbuffer to write to.
sizebuffer size.

Definition at line 415 of file item.cpp.

References buf, NROF(), and give::op.

Referenced by inventory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ random_roll()

int random_roll ( int  min,
int  max,
const object op,
int  goodbad 
)

Roll a random number between min and max. Uses op to determine luck, and if goodbad is non-zero, luck increases the roll, if zero, it decreases.

Generally, op should be the player/caster/hitter requesting the roll, not the recipient (ie, the poor slob getting hit). [garbled 20010916]

Definition at line 42 of file utils.cpp.

References llevError, LOG(), MAX, say::max, MIN, give::op, PLAYER, and RANDOM.

Referenced by alchemy_failure_effect(), apply_check_personalized_blessings(), attack_ob_simple(), attempt_do_alchemy(), attempt_steal(), become_follower(), cast_detection(), cast_heal(), cast_smite_spell(), cast_spell(), charge_mana_effect(), cure_disease(), deathstrike_living(), did_make_save(), do_harvest(), do_hidden_move(), do_symptoms(), flee_player(), gate_type_process(), god_examines_priest(), god_intervention(), hit_with_drain(), hit_with_one_attacktype(), infect_object(), kill_player_not_permadeath(), learn_skill(), mood_change(), pets_summon_object(), potion_type_apply(), pray_at_altar(), push_ob(), recharge(), roll_ob(), scroll_failure(), singing(), slow_living(), spellbook_type_apply(), trap_disarm(), trap_see(), try_leave_cult(), use_oratory(), and write_scroll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ random_roll64()

int64_t random_roll64 ( int64_t  min,
int64_t  max,
const object op,
int  goodbad 
)

This is a 64 bit version of random_roll() above. This is needed for exp loss calculations for players changing religions.

Definition at line 77 of file utils.cpp.

References FMT64, make_face_from_files::int, llevError, LOG(), MAX, say::max, MIN, give::op, PLAYER, and RANDOM.

Referenced by try_leave_cult().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ re_cmp()

const char* re_cmp ( const char *  ,
const char *   
)

re-cmp - get regular expression match.

Parameters
strstring that will be matched against the regexp.
regexpregular expression.
Returns
  • no match or error in regexp.
  • pointer to beginning of matching string

Definition at line 68 of file re-cmp.cpp.

References Boolean, False, re_cmp(), re_cmp_step(), re_get_token(), re_init(), re_init_done, re_match_token(), re_substr, re_token, re_token_depth, rep_null_or_more, rep_null_or_once, rep_once, rep_once_or_more, make_face_from_files::str, and True.

Referenced by cfapi_system_re_cmp(), matches(), and re_cmp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ready_map_name()

mapstruct* ready_map_name ( const char *  name,
int  flags 
)

Makes sure the given map is loaded and swapped in.

Parameters
namepath name of the map.
flags
  • 0x1 (MAP_FLUSH): flush the map - always load from the map directory, and don't do unique items or the like.
  • 0x2 (MAP_PLAYER_UNIQUE) - this is a unique map for each player. dont do any more name translation on it.
Returns
pointer to the given map, NULL on failure.

Definition at line 1768 of file map.cpp.

References buf, clean_tmp_map(), decay_objects(), delete_map(), EVENT_MAPREADY, events_execute_global_event(), flags, has_been_loaded(), load_overlay_map(), load_temporary_map(), load_unique_objects(), Settings::localdir, m, MAP_FLUSH, MAP_IN_MEMORY, MAP_LOADING, MAP_OVERLAY, MAP_PLAYER_UNIQUE, map_reset_swap(), mapfile_load(), MAX_BUF, give::name, Settings::playerdir, seconds(), set_darkness_map(), and settings.

Referenced by cast_create_town_portal(), cfapi_map_get_map(), CREMapInformationManager::checkItem(), enter_exit(), enter_fixed_template_map(), enter_player_maplevel(), enter_random_template_map(), enter_unique_map(), init_dynamic(), is_legal_2ways_exit(), load_and_link_tiled_map(), place_exits(), process_map(), START_TEST(), and town_portal_destroy_existing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ recipe_get_difficulty_string()

const char* recipe_get_difficulty_string ( int  difficulty)

A method to produce a difficulty adjective to describe alchemy projects.

Parameters
difficultythe base difficulty of the recipe
Returns
A string that approximates the difficulty of the recipe, meant for printing in the recipe books and the recipe knowledge descriptor.

Definition at line 962 of file recipe.cpp.

Referenced by knowledge_alchemy_detail(), and make_formula_book().

+ Here is the caller graph for this function:

◆ recipe_get_face()

const Face* recipe_get_face ( const recipe rp)

Return the best face associated with a recipe.

Parameters
rprecipe to get the face of.
Returns
best face, may be NULL if none applicable.

Definition at line 920 of file recipe.cpp.

References archininventory::arch, recipe::arch_name, recipe::arch_names, arch_to_object(), blank_face, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, give_artifact_abilities(), artifact::item, say::item, locate_recipe_artifact(), object_free(), object_give_identified_properties(), recipe::title, and try_find_archetype().

Referenced by RecipeWrapper::displayIcon(), and knowledge_alchemy_face().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ region_is_child_of_region()

int region_is_child_of_region ( const region child,
const region r 
)

Checks if a region is a child of another.

Parameters
childregion we want to test.
rpotential parent.
Returns
  • 1 if child has r as parent somewhere.
  • -1 if passed a NULL region
  • 0 else

Definition at line 183 of file region.cpp.

References region::name, region::parent, ring_occidental_mages::r, and region_is_child_of_region().

Referenced by list_players(), region_is_child_of_region(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ register_apply()

◆ register_describe()

void register_describe ( int  ob_type,
describe_func  method 
)

Registers the describe method for the given type.

Parameters
ob_typeThe type of object to register this method to
methodThe method to link

Definition at line 80 of file ob_types.cpp.

References ob_methods::describe, and type_methods.

Referenced by init_type_lamp(), init_type_power_crystal(), and init_type_spellbook().

+ Here is the caller graph for this function:

◆ register_move_on()

◆ register_process()

void register_process ( int  ob_type,
process_func  method 
)

Registers the process method for the given type.

Parameters
ob_typeThe type of object to register this method to
methodThe method to link

Definition at line 71 of file ob_types.cpp.

References ob_methods::process, and type_methods.

Referenced by init_type_arrow(), init_type_blindness(), init_type_creator(), init_type_deep_swamp(), init_type_detector(), init_type_director(), init_type_gate(), init_type_marker(), init_type_mood_floor(), init_type_peacemaker(), init_type_player_changer(), init_type_poisoning(), init_type_rune(), init_type_spell_effect(), init_type_teleporter(), init_type_thrown_object(), init_type_transport(), init_type_trap(), and init_type_trigger().

+ Here is the caller graph for this function:

◆ register_trigger()

void register_trigger ( int  ob_type,
trigger_func  method 
)

Registers the trigger method for the given type.

Parameters
ob_typeThe type of object to register this method to
methodThe method to link

Definition at line 98 of file ob_types.cpp.

References ob_methods::trigger, and type_methods.

Referenced by init_type_creator(), init_type_duplicator(), init_type_marker(), init_type_mood_floor(), and init_type_teleporter().

+ Here is the caller graph for this function:

◆ remove_button_link()

void remove_button_link ( object op)

Remove the object from the linked lists of buttons in the map. This is only needed by editors.

Parameters
opobject to remove. Must be on a map, and linked.

Definition at line 693 of file button.cpp.

References CLEAR_FLAG, FLAG_IS_LINKED, oblinkpt::link, llevError, LOG(), objectlink::next, oblinkpt::next, objectlink::ob, give::op, and QUERY_FLAG.

Referenced by apply_builder_remove(), clean_object(), and delete_unique_items().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove_depletion()

int remove_depletion ( object op,
int  level 
)

Remove depletion from op, if present, and warn player of such restorations.

Parameters
opwho to remove depletion from.
levelmaximum depletion level to remove, if -1 no maximum.
Returns
0 if no depletion (or with no drained statistics) was present or level was insufficient, 1 if something was removed.

Definition at line 755 of file living.cpp.

References ARCH_DEPLETION, arch_present_in_ob(), disinfect::count, draw_ext_info(), find_archetype(), fix_object(), get_attr_value(), MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END, NDI_UNIQUE, NUM_STATS, object_free_drop_inventory(), object_remove(), give::op, restore_msg, and object::stats.

Referenced by cfapi_object_remove_depletion(), god_intervention(), and potion_type_apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove_directory()

void remove_directory ( const char *  path)

This function removes everything in the directory, and the directory itself.

Errors are LOG() to error level.

Parameters
pathdirectory to remove.
Note
will fail if any file has a name starting by .

Definition at line 117 of file porting.cpp.

References buf, closedir(), llevError, LOG(), opendir(), python_init::path, readdir(), remove_directory(), and takeitem::status.

Referenced by delete_character(), and remove_directory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove_friendly_object()

void remove_friendly_object ( object op)

Removes the specified object from the linked list of friendly objects.

Parameters
opobject to remove from list.

Definition at line 52 of file friend.cpp.

References CLEAR_FLAG, FLAG_FRIENDLY, friends, llevError, LOG(), and give::op.

Referenced by cfapi_object_set_property(), change_object(), command_cast_spell(), command_kill_pets(), do_mood_floor(), enter_map(), hit_player(), kill_object(), kill_player_permadeath(), monster_move(), mood_change(), object_clear(), object_free(), pets_attempt_follow(), pets_get_enemy(), pets_move(), pets_move_golem(), pets_terminate_all(), polymorph_living(), receive_play_again(), START_TEST(), and use_oratory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove_statbonus()

void remove_statbonus ( object op)

Subtracts stat-bonuses given by the class which the player has chosen.

Parameters
opobject which must be a player with contr not NULL.

Definition at line 845 of file living.cpp.

References give::op.

Referenced by key_change_class().

+ Here is the caller graph for this function:

◆ replace()

void replace ( const char *  src,
const char *  key,
const char *  replacement,
char *  result,
size_t  resultsize 
)

Replace in string src all occurrences of key by replacement. The resulting string is put into result; at most resultsize characters (including the terminating null character) will be written to result.

Definition at line 327 of file utils.cpp.

References castle_read::key, rotate-tower::result, and strlcpy().

Referenced by compilePython(), enter_fixed_template_map(), enter_random_template_map(), nlohmann::basic_json::patch(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ replace_unprintable_chars()

void replace_unprintable_chars ( char *  buf)

Replaces any unprintable character in the given buffer with a space.

Parameters
bufthe buffer to modify

Definition at line 447 of file utils.cpp.

References buf.

Referenced by party_form(), party_set_password(), and player_set_own_title().

+ Here is the caller graph for this function:

◆ reset_sleep()

void reset_sleep ( void  )

Initialise all variables used in the timing routines.

Definition at line 134 of file time.cpp.

References game_time, PBUFLEN, process_max_utime, process_min_utime, process_tot_mtime, process_utime_save, psaveind, and pticks.

Referenced by command_speed(), init(), and setup().

+ Here is the caller graph for this function:

◆ rndm()

int rndm ( int  min,
int  max 
)

Returns a number between min and max.

It is suggested one use these functions rather than RANDOM()%, as it would appear that a number of off-by-one-errors exist due to improper use of %. This should also prevent SIGFPE.

Definition at line 162 of file utils.cpp.

References say::max, and RANDOM.

Referenced by adjust_dir(), adjust_product(), alchemy_failure_effect(), alchemy_object(), apply_changes_to_player(), attack_message(), attack_ob_simple(), cancellation(), cast_change_ability(), cast_spell(), cast_wonder(), cauldron_sound(), check_spell_knockback(), choose_cult_monster(), command_cointoss(), common_process_projectile(), common_trap_type_process(), compute_price_variation_with_bargaining(), counterspell(), decay_objects(), deep_swamp_type_process(), determine_holy_arch(), did_make_save_item(), do_harvest(), do_item_conversion(), find_recipe(), fix_generated_item(), fix_stopped_arrow(), forklightning(), generate_animation(), generate_condition(), generate_face(), generate_monster(), generate_monster_arch(), generate_monster_inv(), generate_name(), generate_quest(), generate_random_list(), generate_random_treasure(), generate_step(), get_random_dir(), hit_player(), hit_with_one_attacktype(), identify_object_with_skill(), level_for_item(), FaceMakerDialog::makeFaces(), move_ball_spell(), move_bolt(), move_creator(), move_swarm_spell(), peacemaker_type_process(), place_monsters(), polymorph(), polymorph_item(), polymorph_living(), races_get_random_monster(), reflwall(), resurrection_fails(), save_throw_object(), scroll_type_apply(), shuffle_attack(), spellbook_type_apply(), swap_map(), swap_random_stats(), transmute_item_to_flower(), and trap_adjust().

◆ save_map()

int save_map ( mapstruct m,
int  flag 
)

Saves a map to file. If flag is SAVE_MODE_INPLACE, it is saved into the same file it was (originally) loaded from. Otherwise a temporary filename will be genarated, and the file will be stored there. The temporary filename will be stored in the mapstructure. If the map is unique, we also save to the filename in the map (this should have been updated when first loaded)

Parameters
mmap to save.
flagOne of SAVE_MODE_xxx values.
Returns
one of SAVE_ERROR_xxx values.

Definition at line 1395 of file map.cpp.

References create_items_path(), create_overlay_pathname(), create_pathname(), npc_dialog::filename, FMT64U, free_all_objects(), llevDebug, llevError, Settings::localdir, LOG(), m, make_path_to_file(), MAP_IN_MEMORY, MAP_SAVING, maps_saved_total, MAX_BUF, give::name, of_cancel(), of_close(), of_open(), Settings::playerdir, print_shop_string(), PROFILE_BEGIN, PROFILE_END, altar_valkyrie::res, SAVE_ERROR_CLOSE, SAVE_ERROR_NO_PATH, SAVE_ERROR_OK, SAVE_ERROR_RCREATION, SAVE_ERROR_UCREATION, SAVE_ERROR_URENAME, SAVE_FLAG_NO_REMOVE, SAVE_MODE, SAVE_MODE_NORMAL, SAVE_MODE_OVERLAY, save_objects(), settings, strlcpy(), and Settings::tmpdir.

Referenced by clean_tmp_files(), command_overlay_save(), generate_map(), main(), START_TEST(), and swap_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save_object()

int save_object ( FILE *  fp,
object op,
int  flag 
)

Dumps all variables in an object to a file.

Parameters
fpfile to write to.
opobject to save.
flagcombination of SAVE_FLAG_xxx flags.
Returns
one of SAVE_ERROR_xxx values.

Definition at line 5397 of file object.cpp.

References give::op, SAVE_ERROR_OK, SAVE_ERROR_WRITE, save_object_in_sb(), stringbuffer_finish(), and stringbuffer_new().

Referenced by save_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save_object_in_sb()

◆ seconds()

long seconds ( void  )

Return wall clock time in seconds.

Definition at line 348 of file time.cpp.

Referenced by cftimer_create(), cftimer_process_timers(), command_statistics(), flush_old_maps(), generate_random_map(), map_info(), metaserver2_thread(), read_map_log(), ready_map_name(), set_map_reset_time(), START_TEST(), swap_map(), and tick_length().

+ Here is the caller graph for this function:

◆ set_abs_magic()

void set_abs_magic ( object op,
int  magic 
)

Sets magical bonus in an object, and recalculates the effect on the armour variable, and the effect on speed of armour. This function doesn't work properly, should add use of archetypes to make it truly absolute.

Patched to utilize settings values for the speed/weight adjustments, rather than hardcoded ones. Neila Hawkins 2021-01-19

Parameters
opobject we're modifying.
magicmagic modifier.

Definition at line 618 of file treasure.cpp.

References Settings::armor_speed_improvement, Settings::armor_speed_linear, Settings::armor_weight_linear, Settings::armor_weight_reduction, ARMOUR, ARMOUR_SPEED, give::op, RANDOM, and settings.

Referenced by add_abilities(), command_create(), improve_armour(), and set_magic().

+ Here is the caller graph for this function:

◆ set_attr_value()

void set_attr_value ( living stats,
int  attr,
int8_t  value 
)

Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW).

Parameters
statsitem to modify. Must not be NULL.
attrattribute to change.
valuenew value.
Todo:
check if attr is valid? Check whether value is valid or not.

Definition at line 218 of file living.cpp.

References living::Cha, CHARISMA, living::Con, CONSTITUTION, living::Dex, DEXTERITY, living::Int, INTELLIGENCE, living::Pow, POWER, living::Str, STRENGTH, autojail::value, living::Wis, and WISDOM.

Referenced by apply_changes_to_player(), apply_race_and_class(), cast_change_ability(), change_abil(), check_race_and_class(), check_stat_bounds(), create_player_cmd(), do_symptoms(), eat_special_food(), fix_object(), set_ring_bonus(), swap_random_stats(), and swap_stat().

+ Here is the caller graph for this function:

◆ set_dragon_name()

void set_dragon_name ( object pl,
const object abil,
const object skin 
)

Set the new dragon name after gaining levels or changing ability focus (later this can be extended to eventually change the player's face and animation)

Note that the title is written to 'own_title' in the player struct. This should be changed to 'ext_title' as soon as clients support this! Please, anyone, write support for 'ext_title'.

Parameters
plplayer's object to change.
abildragon's innate abilities.
skindragon's skin.

Definition at line 1684 of file living.cpp.

References atnr_is_dragon_enabled(), attacks, living::exp, make_face_from_files::int, NROFATTACKS, altar_valkyrie::pl, player_set_dragon_title(), object::resist, and object::stats.

Referenced by check_login(), and dragon_level_gain().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_map_reset_time()

void set_map_reset_time ( mapstruct map)

Updates the map's timeout.

Parameters
mapmap to update.

Definition at line 2232 of file map.cpp.

References disinfect::map, MAP_DEFAULTRESET, MAP_MAXRESET, MAP_RESET_TIMEOUT, MAP_WHEN_RESET, and seconds().

Referenced by map_info(), mapfile_load(), and swap_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_materialname()

void set_materialname ( object op)

Set the material name and type for an item, if not set.

Parameters
opitem to set the material for.

Definition at line 297 of file utils.cpp.

References add_string(), materials, and give::op.

Referenced by check_loaded_object(), fix_generated_item(), local_check_loaded_object(), and object_get_materialtype().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_tick_duration()

void set_tick_duration ( long  t)

Sets the tick duration. Can be called by a DM through the speed command.

Parameters
tnew duration.

Definition at line 209 of file time.cpp.

References Floor::t, and tick_duration.

Referenced by command_speed().

+ Here is the caller graph for this function:

◆ set_variable()

int set_variable ( object op,
const char *  buf 
)

This takes a buffer, scans it for variables, and sets those variables as appropriate in op.

This function appears to be used in only 2 places - in crossedit to override values and in c_wiz to mutate values.

Parameters
opobject to alter.
bufmodifications to apply.
Returns
?
Todo:
document return value.

Definition at line 39047 of file loader.cpp.

References buf, INITIAL, lorebuf, MAXDEPTH, msgbuf, msglen, give::op, total_msglen, YY_CURRENT_BUFFER, yy_delete_buffer(), yy_pop_state(), yy_push_state(), yy_scan_string(), and yy_switch_to_buffer().

Referenced by command_create(), command_patch(), and Archetypes::recursive_update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ share_exp()

void share_exp ( object op,
int64_t  exp,
const char *  skill,
int  flag 
)

Gives experience to a player/monster, sharing it with party if applicable. This does bounds checking to make sure we don't overflow the max exp.

The exp passed is typically not modified much by this function - it is assumed the caller has modified the exp as needed.

This is merely a wrapper for change_exp().

Parameters
opvictim to alter.
expexperience to gain (positive) or lose (negative).
skillskill to change. Can be NULL.
flag
  • if experience gain, what to do if player doesn't have the skill
  • if experience loss, whether to remove from all skills or only specified skill
Note
flag only applies to op, not other players in same party.

Definition at line 2319 of file living.cpp.

References change_exp(), disinfect::count, first_player, on_same_map(), give::op, altar_valkyrie::pl, PLAYER, and SK_EXP_TOTAL.

Referenced by kill_object(), and mood_change().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ split_string()

size_t split_string ( char *  str,
char *  array[],
size_t  array_size,
char  sep 
)

Splits a string delimited by passed in sep value into characters into an array of strings.

Parameters
strthe string to be split; will be modified
arraythe string array; will be filled with pointers into str
array_sizethe number of elements in array; if str contains more fields excess fields are not split but included into the last element
sepseparator to use.
Returns
the number of elements found; always less or equal to array_size

Definition at line 473 of file utils.cpp.

References make_face_from_files::str.

Referenced by account_char_load_from_file(), accounts_load(), assets_pack(), check_split_string(), get_score(), FacesetLoader::load(), PngLoader::load(), load_bells(), load_citylife(), map_info(), read_map_log(), and spell_consume_items().

+ Here is the caller graph for this function:

◆ stringbuffer_append_multiline_block()

void stringbuffer_append_multiline_block ( StringBuffer sb,
const char *  start,
const char *  content,
const char *  end 
)

Definition at line 196 of file stringbuffer.cpp.

◆ stringbuffer_append_printf()

void stringbuffer_append_printf ( StringBuffer sb,
const char *  format,
  ... 
)

Definition at line 138 of file stringbuffer.cpp.

◆ stringbuffer_append_string()

void stringbuffer_append_string ( StringBuffer sb,
const char *  str 
)

Definition at line 95 of file stringbuffer.cpp.

◆ stringbuffer_append_stringbuffer()

void stringbuffer_append_stringbuffer ( StringBuffer sb,
const StringBuffer sb2 
)

Definition at line 165 of file stringbuffer.cpp.

◆ stringbuffer_delete()

void stringbuffer_delete ( StringBuffer sb)

Definition at line 71 of file stringbuffer.cpp.

◆ stringbuffer_finish()

char* stringbuffer_finish ( StringBuffer sb)

Definition at line 76 of file stringbuffer.cpp.

◆ stringbuffer_finish_shared()

sstring stringbuffer_finish_shared ( StringBuffer sb)

Definition at line 85 of file stringbuffer.cpp.

◆ stringbuffer_length()

size_t stringbuffer_length ( StringBuffer sb)

Definition at line 218 of file stringbuffer.cpp.

◆ stringbuffer_new()

StringBuffer* stringbuffer_new ( void  )

Definition at line 57 of file stringbuffer.cpp.

◆ strip_endline()

void strip_endline ( char *  buf)

Removes endline from buffer (modified in place).

Definition at line 314 of file utils.cpp.

References buf, and EOL_SIZE.

Referenced by parse_shop_string(), and send_news().

+ Here is the caller graph for this function:

◆ strtoint()

int strtoint ( const char *  buf)

Convert buf into an integer equal to the coadded sum of the (lowercase) character

ASCII values in buf (times prepended integers).

Parameters
bufbuffer we want to convert. Can contain an initial number.
Returns
sum of lowercase characters of the ingredient's name.

Definition at line 709 of file recipe.cpp.

References buf, ingred_name(), numb_ingred(), and tolower.

Referenced by add_book_to_list(), content_recipe_value(), dump_alchemy(), find_title(), and init_formulae().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ strtoktolin()

char* strtoktolin ( const char *  buf1,
const char *  buf2,
char *  retbuf,
size_t  size 
)

Takes a string in buf1 and separates it into a list of strings delimited by buf2. Then returns a comma separated string w/ decent punctuation.

Parameters
buf1buffer to split.
buf2what to split buf1 by.
retbufwhere to write the resulting string.
sizelength of retbuf.
Returns
retbuf.

Definition at line 684 of file readable.cpp.

References buf, MAX_BUF, nstrtok(), strlcpy(), and trim().

Referenced by describe_god().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tailor_readable_ob()

void tailor_readable_ob ( object book,
int  msg_type 
)

The main routine. This chooses a random message to put in given readable object (type==BOOK) which will be referred hereafter as a 'book'. We use the book level to de- termine the value of the information we will insert. Higher values mean the book will (generally) have better/more info. See individual cases as to how this will be utilized. "Book" name/content length are based on the weight of the document. If the value of msg_type is negative, we will randomly choose the kind of message to generate. -b.t. thoma.nosp@m.s@as.nosp@m.tro.p.nosp@m.su.e.nosp@m.du

Parameters
bookthe object we are creating into. Must be a book, can have a level.
msg_typeif it is a positive value, we use that to determine the message type - otherwise a random value is used.

Definition at line 1892 of file readable.cpp.

References arraysize, artifact_msg(), BOOK, BOOK_BUF, BOOKSIZE, change_book(), god_info_msg(), make_face_from_files::int, object::level, make_formula_book(), max_titles, diamondslots::message, mon_info_msg(), msgfile_msg(), MSGTYPE_ALCHEMY, MSGTYPE_ARTIFACT, MSGTYPE_GODS, MSGTYPE_LIB, MSGTYPE_MONSTER, MSGTYPE_SPELLPATH, object_set_msg(), RANDOM, spellpath_msg(), stringbuffer_append_string(), stringbuffer_finish(), and object::type.

Referenced by fix_generated_item().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tempnam_secure()

FILE* tempnam_secure ( const char *  dir,
const char *  pfx,
char **  filename 
)

A replacement for the tempnam_local() function since that one is not very secure. This one will open the file in an atomic way on platforms where it is possible.

Parameters
dirDirectory where to create the file. Can be NULL, in which case NULL is returned.
pfxPrefix to create unique name. Can be NULL.
filenameThis should be a pointer to a char*, the function will overwrite the char* with the name of the resulting file. Must be freed by caller. Value is unchanged if the function returns NULL.
Returns
A pointer to a FILE opened exclusively, or NULL if failure. It is up to the caller to properly close it.
Note
The file will be opened read-write.
Todo:
Maybe adding some ifdef for non-UNIX? I don't have any such system around to test with.

Definition at line 71 of file porting.cpp.

References mad_mage_user::file, npc_dialog::filename, llevError, LOG(), CFBank::open(), S_IRUSR, and S_IWUSR.

Referenced by save_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tick_game_time()

void tick_game_time ( void  )

Definition at line 184 of file time.cpp.

References game_time, pticks, tick_duration, and timespec_add().

Referenced by server_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tick_length()

unsigned int tick_length ( float  seconds)

Calculate the number of ticks that correspond to real time.

Definition at line 382 of file time.cpp.

References seconds(), and tick_duration.

Referenced by connection_alive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ time_format_time()

const char* time_format_time ( const timeofday_t tod,
char *  buf,
size_t  bufsize 
)

Formats a timestamp in Crossfire time.

Parameters
todthe timestamp to format
bufthe buffer to fill
bufsizethe size of buf in bytes
Returns
buf

Definition at line 369 of file time.cpp.

References buf, timeofday_t::hour, and timeofday_t::minute.

Referenced by clock_type_apply(), and print_tod().

+ Here is the caller graph for this function:

◆ time_info()

void time_info ( object op)

Players wants to know the time. Called through the 'time' command.

Parameters
opplayer who requested time.

Definition at line 298 of file time.cpp.

References draw_ext_info_format(), FLAG_WIZ, MIN, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DEBUG, NDI_UNIQUE, give::op, PBUFLEN, print_tod(), process_max_utime, process_min_utime, process_tot_mtime, process_utime_long_count, process_utime_save, pticks, QUERY_FLAG, and tick_duration.

Referenced by command_time().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ timespec_diff()

long timespec_diff ( struct timespec *  end,
struct timespec *  start 
)

Return the difference between two timespec's in microseconds.

Definition at line 166 of file time.cpp.

Referenced by get_sleep_remaining().

+ Here is the caller graph for this function:

◆ transmute_materialname()

void transmute_materialname ( object op,
const object change 
)

When doing transmutation of objects, we have to recheck the resistances, as some that did not apply previously, may apply now.

Only works on armors.

Definition at line 263 of file utils.cpp.

References CLOAK, GIRDLE, GLOVES, IS_ARMOR, IS_SHIELD, llevError, LOG(), object::materialname, materialtype_t::mod, name_to_material(), NROFATTACKS, give::op, and object::resist.

Referenced by cfapi_object_transmute(), and make_item_from_recipe().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ treasure_free()

void treasure_free ( treasure t)

Frees a treasure, including its yes, no and next items.

Parameters
ttreasure to free. Pointer is free()d too, so becomes invalid.

Definition at line 1407 of file treasure.cpp.

References free_string(), Floor::t, and treasure_free().

Referenced by asset_destroy(), TreasureWrapper::doRemoveChild(), Treasures::replace(), treasure_free(), and treasure_remove_item().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ treasure_insert()

treasure* treasure_insert ( treasurelist list,
int  position 
)

Insert a new treasure in the treasure list, at a specific position in the children list.

Parameters
listlist to insert the new treasure into.
positionif less than the number of items then before this item, else at end of list.
Returns
inserted item, never null.

Definition at line 1428 of file treasure.cpp.

References get_empty_treasure(), guildoracle::list, and treasure::next.

Referenced by TreasureListWrapper::drop(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ treasure_remove_item()

void treasure_remove_item ( treasurelist list,
int  position 
)

Remove the treasure at the specified position from the list.

Parameters
listlist to remove the treasure from.
positionindex of the treasure to remove, 0-based, negative value is ignored.

Definition at line 1451 of file treasure.cpp.

References guildoracle::list, give::next, treasure::next, and treasure_free().

Referenced by TreasureListWrapper::removeChild(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ trigger_connected()

void trigger_connected ( objectlink ol,
object cause,
const int  state 
)

Trigger every object in an objectlink. This was originally part of push_button but has been extracted to make it possible to trigger the connected object on a map from a plugin without requiring a source object. This method will take care of calling EVENT_TRIGGER of all elligible object in list (see state parameter)

Parameters
olthe objectlink to trigger. This can be acquire from map
causethe object that cause this path to trigger, may be NULL
statewhich object to apply. 0=all object with FLAG_ACTIVATE_ON_PUSH other=all object with FLAG_ACTIVATE_ON_RELEASE

Definition at line 41 of file button.cpp.

References ALTAR, animate_turning(), BUTTON, CF_HANDLE, object::count, DIRECTOR, EVENT_TRIGGER, events_execute_object_event(), ext_info_map(), FIREWALL, FLAG_ACTIVATE_ON_PUSH, FLAG_ACTIVATE_ON_RELEASE, FLAG_ANIMATE, FLAG_FREED, GATE, HOLE, living::hp, objectlink::id, llevError, LOG(), move_firewall(), MSG_SUBTYPE_NONE, MSG_TYPE_SIGN, object::name, NDI_NAVY, NDI_UNIQUE, objectlink::next, objectlink::ob, ob_trigger(), object_update(), object_update_speed(), PEDESTAL, QUERY_FLAG, SCRIPT_FIX_ALL, SET_ANIMATION, SIGN, living::sp, object::speed, dragon::state, object::stats, TIMED_GATE, Ice::tmp, UP_OBJ_FACE, and object::value.

Referenced by cfapi_map_trigger_connected(), and push_button().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ try_find_animation()

Animations* try_find_animation ( const char *  name)

◆ try_find_archetype()

◆ try_find_face()

◆ update_all_los()

void update_all_los ( const mapstruct map,
int  x,
int  y 
)

This function makes sure that update_los() will be called for all players on the given map within the next frame. It is triggered by removal or inserting of objects which blocks the sight in the map. Modified by MSW 2001-07-12 to take a coordinate of the changed position, and to also take map tiling into account. This change means that just being on the same map is not sufficient - the space that changes must be withing your viewable area.

Parameters
mapmap that changed.
x
ycoordinates of the change.
Todo:
check if this couldn't be simplified, especially tiling (isn't there a function somewhere that could help?)

Definition at line 595 of file los.cpp.

References first_player, disinfect::map, MAP_HEIGHT, MAP_WIDTH, altar_valkyrie::pl, diamondslots::x, and diamondslots::y.

Referenced by cfapi_object_set_property(), do_turn(), gate_type_process(), kill_object(), magic_wall(), object_insert_in_map(), object_insert_in_ob(), object_remove(), and tear_down_wall().

+ Here is the caller graph for this function:

◆ update_all_map_los()

void update_all_map_los ( mapstruct map)

update all_map_los is like update_all_los() below, but updates everyone on the map, no matter where they are. This generally should not be used, as a per specific map change doesn't make much sense when tiling is considered (lowering darkness would certainly be a strange effect if done on a tile map, as it makes the distinction between maps much more obvious to the players, which is should not be. Currently, this function is called from the change_map_light function

Parameters
mapmap on which affected players are.

Definition at line 567 of file los.cpp.

References first_player, disinfect::map, and altar_valkyrie::pl.

Referenced by change_map_light().

+ Here is the caller graph for this function:

◆ update_button()

void update_button ( object op)

Updates everything connected with the button op. After changing the state of a button, this function must be called to make sure that all gates and other buttons connected to the button reacts to the (eventual) change of state.

Parameters
opobject to update.

Definition at line 162 of file button.cpp.

References BUTTON, object::count, FOR_ABOVE_FINISH, FOR_ABOVE_PREPARE, get_button_links(), object::head, objectlink::id, llevDebug, LOG(), object::move_type, objectlink::next, NROF(), objectlink::ob, object_update(), give::op, PEDESTAL, PLAYER, push_button(), object::race, SET_ANIMATION, object::slaying, SPECIAL_KEY, Ice::tmp, object::type, and UP_OBJ_FACE.

Referenced by button_type_move_on(), pedestal_type_move_on(), and update_buttons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_buttons()

void update_buttons ( mapstruct m)

Updates every button on the map (by calling update_button() for them).

Definition at line 227 of file button.cpp.

References BUTTON, object::count, objectlink::id, oblinkpt::link, llevError, LOG(), m, object::name, objectlink::next, oblinkpt::next, objectlink::ob, PEDESTAL, object::type, update_button(), oblinkpt::value, object::x, and object::y.

Referenced by mapfile_load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_los()

void update_los ( object op)

Recalculates the array which specifies what is visible for the given player-object.

Parameters
opplayer's object for which to compute.

Definition at line 509 of file los.cpp.

References blinded_sight(), check_wall(), clear_los(), expand_sight(), FLAG_BLIND, FLAG_REMOVED, FLAG_WIZ, FLAG_XRAYS, LOS_NO_DARKNESS, MAP_CLIENT_X, MAP_CLIENT_Y, give::op, QUERY_FLAG, diamondslots::x, XRAY_RADIUS, and diamondslots::y.

Referenced by command_nowiz(), draw_client_map(), and set_up_cmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_position()

◆ use_trigger()

void use_trigger ( object op)

Toggles the state of specified button.

Parameters
opobject to toggle.

Definition at line 254 of file button.cpp.

References give::op, and push_button().

Referenced by check_inv(), monster_do_talk_npc(), spring_trap(), and trigger_move().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ usec_elapsed()

long usec_elapsed ( struct timespec  first,
struct timespec  second 
)

Return the number of microseconds between two timespec structures. This function was copied from common/time.c since linking is too hard.

Definition at line 1149 of file cfanim.cpp.

Referenced by animate().

+ Here is the caller graph for this function:

◆ write_book_archive()

void write_book_archive ( void  )

Write out the updated book archive to bookarch file.

Definition at line 2005 of file readable.cpp.

References title::archname, title::authour, titlelist::first_book, get_titlelist(), npc_dialog::index, title::level, llevDebug, llevError, Settings::localdir, LOG(), MAX_BUF, title::msg_index, title::name, need_to_write_bookarchive, title::next, titlelist::next, of_close(), of_open(), SAVE_MODE, settings, and title::size.

Referenced by cleanup(), and do_specials().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_todclock()

void write_todclock ( void  )

Write out the current time to the file so time does not reset every time the server reboots.

Definition at line 519 of file init.cpp.

References npc_dialog::filename, Settings::localdir, MAX_BUF, of_close(), of_open(), settings, and todtick.

Referenced by clean_tmp_files(), init_clocks(), and tick_the_clock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ yyfree()

void yyfree ( void *  ptr)

Definition at line 38872 of file loader.cpp.

Referenced by yy_delete_buffer(), and yylex_destroy().

+ Here is the caller graph for this function:

◆ yyget_debug()

int yyget_debug ( void  )

Definition at line 38761 of file loader.cpp.

References yy_flex_debug.

◆ yyget_in()

FILE* yyget_in ( void  )

Get the input stream.

Definition at line 38705 of file loader.cpp.

References yyin.

◆ yyget_lineno()

int yyget_lineno ( void  )

Get the current line number.

Definition at line 38696 of file loader.cpp.

References yylineno.

◆ yyget_out()

FILE* yyget_out ( void  )

Get the output stream.

Definition at line 38713 of file loader.cpp.

References yyout.

◆ yyget_text()

char* yyget_text ( void  )

Get the current token.

Definition at line 38730 of file loader.cpp.

References yytext.

◆ yylex_destroy()

int yylex_destroy ( void  )

Definition at line 38804 of file loader.cpp.

References yy_buffer_stack, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_delete_buffer(), yy_init_globals(), yy_start_stack, yyfree(), and yypop_buffer_state().

+ Here is the call graph for this function:

◆ yypop_buffer_state()

void yypop_buffer_state ( void  )

Removes and deletes the top of the stack, if present. The next element becomes the new top.

Definition at line 38483 of file loader.cpp.

References yy_buffer_stack_top, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_delete_buffer(), yy_did_buffer_switch_on_eof, and yy_load_buffer_state().

Referenced by yylex_destroy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ yyrestart()

void yyrestart ( FILE *  input_file)

Immediately switch to a different input stream.

Parameters
input_fileA readable stream.
Note
This function does not reset the start condition to INITIAL .

Definition at line 38287 of file loader.cpp.

References YY_BUF_SIZE, yy_create_buffer(), YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_init_buffer(), yy_load_buffer_state(), yyensure_buffer_stack(), and yyin.

Referenced by yy_get_next_buffer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ yyset_debug()

void yyset_debug ( int  bdebug)

Definition at line 38766 of file loader.cpp.

References yy_flex_debug.

◆ yyset_in()

void yyset_in ( FILE *  _in_str)

Set the input stream. This does not discard the current input buffer.

Parameters
_in_strA readable stream.
See also
yy_switch_to_buffer

Definition at line 38751 of file loader.cpp.

References yyin.

◆ yyset_lineno()

void yyset_lineno ( int  _line_number)

Set the current line number.

Parameters
_line_numberline number

Definition at line 38739 of file loader.cpp.

References yylineno.

◆ yyset_out()

void yyset_out ( FILE *  out_str)

Definition at line 38756 of file loader.cpp.

References yyout.