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.


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)
sstring add_refcount (sstring str)
void add_statbonus (object *op)
sstring add_string (const char *str)
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 buf_overflow (const char *buf1, const char *buf2, size_t bufsize)
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)
void 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)
void 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)
sstring find_string (const char *str)
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 free_string (sstring str)
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, int flags)
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)
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_hash_table (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)
int query_refcount (sstring str)
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 Facerecipe_get_face (const recipe *rp)
regionregion_get_next (region *reg)
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 ss_dump_statistics (char *buf, size_t size)
char * ss_dump_table (int what, char *buf, size_t size)
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.

ddirection to convert.
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 3707 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.

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.

Daniel 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.


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

+ 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.

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.

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

◆ add_statbonus()

void add_statbonus ( object op)

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

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:

◆ add_string()

sstring add_string ( const char *  str)

This will add 'str' to the hash table. If there's no entry for this string, a copy will be allocated, and a pointer to that is returned.

strstring to share.
pointer to string identical to str, but shared.

Definition at line 124 of file shstr.cpp.

References shared_string::array, GATHER, hash_table, hashstr(), new_shared_string(), shared_string::next, shared_string::previous, shared_string::refcount, make_face_from_files::str, shared_string::string, TOPBIT, and shared_string::u.

Referenced by account_char_add(), account_char_load(), account_char_load_from_file(), account_play_cmd(), add_author(), add_book_to_list(), add_exit_to_item(), add_force(), QuestsWrapper::addQuest(), adjust_sign_msg(), alchemy_failure_effect(), animate_weapon(), apply_race_and_class(), asset_create(), become_follower(), cast_bless(), cast_create_town_portal(), cast_word_of_recall(), cctk_set_object_strings(), cfapi_system_add_string(), change_abil(), change_book(), change_treasure(), check_loaded_object(), check_login(), command_follow(), command_reset(), command_summon(), command_teleport(), command_unarmed_skill(), confuse_living(), create_singularity(), determine_god(), do_artifact(), do_goto(), do_magic(), do_map(), do_throw(), TreasureWrapper::doAddChild(), TreasureListWrapper::drop(), enter_player_savebed(), enter_random_map(), examine_monster(), find_or_create_connection_for_map(), fire_bow(), fix_container_multipart(), fix_generated_item(), fix_stopped_arrow(), generate_quest(), generate_random_list(), generate_random_map(), generate_random_treasure(), get_jail_exit(), get_npc(), get_player(), give_artifact_abilities(), god_enchants_weapon(), grant_immunity(), i18n(), i18n_init(), init_book_archive(), init_formulae(), init_globals(), key_change_class(), keyplace(), kill_player(), knowledge_add(), knowledge_read_player_data(), ArtifactLoader::load(), MessageLoader::load(), FaceLoader::load(), QuestLoader::load(), TreasureLoader::load(), load_map_header(), load_materials(), FaceLoader::loadAnimationBlock(), TreasureLoader::loadTreasure(), local_check_loaded_object(), lock_and_hide_doors(), monster_do_talk_npc(), move_marker(), new_text_name(), object_find_by_name(), object_find_by_name_global(), object_fix_multipart(), object_set_msg(), object_set_value(), object_set_value_s(), pets_summon_golem(), place_chest(), place_exits(), place_special_exit(), potion_type_apply(), process_map(), process_object(), quest_condition_from_string(), quest_create(), quest_read_player_data(), receive_play_again(), set_materialname(), TreasureWrapper::setArtifact(), QuestWrapper::setComment(), QuestStepWrapper::setDescription(), QuestWrapper::setDescription(), TreasureWrapper::setList(), QuestWrapper::setTitle(), START_TEST(), stringbuffer_finish_shared(), tailor_god_spell(), town_portal_find_force(), while(), and write_mark().

+ Here is the call graph for this function:

◆ adjust_dir()

int adjust_dir ( int  dir,
int  destination_dir 

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

dirthe direction to adjust
destination_dirthe destination direction to adjust towards
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.

opobject to check.
1 if allowed, 0 else.

Definition at line 1650 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.

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.

opobject to animate.
animate_object() should be used instead of this, but it can't handle animations in the 8 directions
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.

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.

opvictim of the penalty. Must not be NULL.

Definition at line 2231 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.

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

Definition at line 3215 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.

atarchetype from which to get an object.
object of specified type.
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.

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.

artwhat to get the face of.
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.

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

Definition at line 103 of file player.cpp.


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.

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

Definition at line 345 of file map.cpp.


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.

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

Definition at line 709 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:

◆ buf_overflow()

int buf_overflow ( const char *  buf1,
const char *  buf2,
size_t  bufsize 

We don't want to exceed the buffer size of buf1 by adding on buf2!

buf2buffers we plan on concatening. Can be NULL.
bufsizesize of buf1. Can be NULL.
true if overflow will occur.

Definition at line 398 of file shstr.cpp.

Referenced by book_overflow(), MessageLoader::load(), and START_TEST().

+ 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.

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

Definition at line 239 of file item.cpp.


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.

opobject to check.

Definition at line 1901 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.

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

Definition at line 1919 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

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

Definition at line 3815 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.

1 if we sucessfully changed a stat, 0 if nothing was changed.
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.
check logic, and things like that. Is the call to fix_object always required?

Definition at line 394 of file living.cpp.


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.

statsitem to modify. Must not be NULL.
attrattribute to change.
valuedelta (can be positive).
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.

opvictim to alter.
expexperience to gain (positive) or lose (negative).
skill_nameskill to change. Can be NULL.
  • 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 2166 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(), god_examines_priest(), hit_with_one_attacktype(), 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.

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.

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

Definition at line 2017 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.

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

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

Definition at line 2089 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.

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

Definition at line 2064 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()

void 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.

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

Definition at line 295 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().

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

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.

opobject of which to search inventory
trigwhat to search
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.

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.
-1 if it fails, otherwise the mode of the file is returned.
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 202 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()

void check_recipes ( )

Ensure that all recipes have a valid artifact, and that archetypes are correct. Will call fatal() if any error is found.

Definition at line 148 of file recipe.cpp.

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

Referenced by assets_end_load().

+ 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)

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


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.

opobject to clean.
move to common/object.c ?

Definition at line 1621 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.

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

Definition at line 1976 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.

plplayer to clear.

Definition at line 252 of file los.cpp.

References 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.

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.

namearchetype name
object of specified archetype, or a singularity. Will never be NULL.
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").

namethe name we're searching for (ex: "writing pen"), must not be null
a corresponding object if found; a singularity object if not found.
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. /

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

Definition at line 124 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.

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

Definition at line 103 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.

namename to give the dummy object.
object of specified name. It fill have the FLAG_NO_PICK flag set.
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.

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

Definition at line 144 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.


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.

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

Definition at line 1730 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(), and swap_map().

+ 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.

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

Definition at line 535 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.

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

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.
buf, or new StringBuffer the caller must free if buf was NULL.
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.
Check whether owner is really needed.

Definition at line 948 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.

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.
buf, or a new StringBuffer the caller should clear if buf was NULL.
Rename to describe_living (or equivalent) since called for player too. Fix weird sustenance logic.

Definition at line 774 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.

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.
buf, a new StringBuffer the caller should free if buf was NULL.

Definition at line 369 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.

attenuationstring describing if "Attenued", "Denied", "Repelled".
valuepath value to describe.
bufwhere to describe, can be NULL.
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.

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

Definition at line 2280 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: