Crossfire Server, Trunk
|
#include "bufferreader.h"
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) |
object * | arch_present_in_ob (const archetype *at, const object *op) |
object * | arch_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) |
object * | check_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) |
object * | create_archetype (const char *name) |
object * | create_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) |
object * | create_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) |
StringBuffer * | describe_attacktype (const char *attack, int value, StringBuffer *buf) |
int | describe_god (const object *god, int what, StringBuffer *buf, size_t maxlen) |
StringBuffer * | describe_item (const object *op, const object *owner, int use_media_tags, StringBuffer *buf) |
StringBuffer * | describe_monster (const object *op, int use_media_tags, StringBuffer *buf) |
StringBuffer * | describe_resistance (const object *op, int newline, int use_media_tags, StringBuffer *buf) |
StringBuffer * | describe_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)) |
Animations * | find_animation (const char *name) |
archetype * | find_archetype (const char *name) |
archetype * | find_archetype_by_object_name (const char *name) |
archetype * | find_archetype_by_object_type_name (int type, const char *name) |
const artifact * | find_artifact (const object *op, const char *name) |
artifactlist * | find_artifactlist (int type) |
uint8_t | find_color (const char *name) |
int | find_dir_2 (int x, int y) |
const Face * | find_face (const char *name) |
const object * | find_god (const char *name) |
recipe * | find_recipe_for_tool (const char *tool, recipe *from) |
int | find_smooth (const Face *face, const Face **smoothed) |
archetype * | find_treasure_by_name (const treasure *t, const char *name, int depth) |
treasurelist * | find_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) |
object * | generate_treasure (treasurelist *t, int difficulty) |
archetype * | get_archetype_by_skill_name (const char *skill, int type) |
archetype * | get_archetype_by_type_subtype (int type, int subtype) |
archetype * | get_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_spell * | get_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) |
artifact * | get_empty_artifact (void) |
artifactlist * | get_empty_artifactlist (void) |
mapstruct * | get_empty_map (int sizex, int sizey) |
treasure * | get_empty_treasure () |
const Face * | get_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) |
recipelist * | get_formulalist (int i) |
objectlink * | get_friends_of (const object *owner) |
const char * | get_god_for_race (const char *race) |
object * | get_jail_exit (object *op) |
int | get_learn_spell (int stat) |
void | get_levelnumber (int i, char *buf, size_t size) |
mapstruct * | get_linked_map (void) |
int | get_map_flags (mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny) |
mapstruct * | get_map_from_coord (mapstruct *m, int16_t *x, int16_t *y) |
sstring | get_message_body (const GeneralMessage *message) |
const Face * | get_message_face (const GeneralMessage *message) |
const GeneralMessage * | get_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) |
archetype * | get_next_archetype (archetype *current) |
object * | get_next_friend (object *current) |
void | get_ob_diff (StringBuffer *sb, const object *op, const object *op2) |
objectlink * | get_objectlink (void) |
oblinkpt * | get_objectlinkpt (void) |
const char * | get_periodofday (const int index) |
int | get_power_from_ench (int ench) |
const object * | get_rand_god (void) |
int | get_random_dir (void) |
object * | get_random_mon (int level) |
recipe * | get_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_type * | get_readable_message_type (object *readable) |
region * | get_region_by_map (mapstruct *m) |
region * | get_region_by_name (const char *region_name) |
region * | get_region_from_string (const char *name) |
const char * | get_region_longname (const region *r) |
const char * | get_region_msg (const region *r) |
region * | get_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 typedata * | get_typedata (int itemtype) |
const typedata * | get_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) |
object * | give_skill_by_name (object *op, const char *skill_name) |
int | has_ability (const object *ob) |
mapstruct * | has_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) |
object * | identify (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 artifact * | locate_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) |
object * | map_find_by_archetype (mapstruct *m, int x, int y, const archetype *at) |
object * | map_find_by_flag (mapstruct *map, int x, int y, int flag) |
object * | map_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) |
mapstruct * | mapfile_load (const char *map, int flags) |
materialtype_t * | name_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) |
object * | object_create_arch (archetype *at) |
object * | object_create_clone (object *asrc) |
object * | object_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) |
object * | object_find_by_arch_name (const object *who, const char *name) |
object * | object_find_by_flag (const object *who, int flag) |
object * | object_find_by_flag_applied (const object *who, int flag) |
object * | object_find_by_name (const object *who, const char *name) |
object * | object_find_by_name_global (const char *str) |
object * | object_find_by_tag (const object *who, tag_t tag) |
object * | object_find_by_tag_global (tag_t i) |
object * | object_find_by_type (const object *who, int type) |
object * | object_find_by_type2 (const object *who, int type1, int type2) |
object * | object_find_by_type_and_arch_name (const object *who, int type, const char *name) |
object * | object_find_by_type_and_name (const object *who, int type, const char *name) |
object * | object_find_by_type_and_race (const object *who, int type, const char *race) |
object * | object_find_by_type_and_skill (const object *who, int type, const char *skill) |
object * | object_find_by_type_and_slaying (const object *who, int type, const char *slaying) |
object * | object_find_by_type_applied (const object *who, int type) |
object * | object_find_by_type_subtype (const object *who, int type, int subtype) |
object * | object_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) |
object * | object_get_env_recursive (object *op) |
key_value * | object_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) |
object * | object_get_owner (object *op) |
object * | object_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) |
object * | object_insert_in_map (object *op, mapstruct *m, object *originator, int flag) |
object * | object_insert_in_map_at (object *op, mapstruct *m, object *originator, int flag, int x, int y) |
object * | object_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) |
object * | object_merge (object *op, object *top) |
void | object_merge_spell (object *op, int16_t x, int16_t y) |
object * | object_new (void) |
object * | object_present_in_ob (uint8_t type, const object *op) |
object * | object_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) |
object * | object_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) |
mapstruct * | ready_map_name (const char *name, int flags) |
const char * | recipe_get_difficulty_string (int difficulty) |
const Face * | recipe_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) |
StringBuffer * | stringbuffer_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) |
treasure * | treasure_insert (treasurelist *list, int position) |
void | treasure_remove_item (treasurelist *list, int position) |
void | trigger_connected (objectlink *ol, object *cause, const int state) |
Animations * | try_find_animation (const char *name) |
archetype * | try_find_archetype (const char *name) |
const Face * | try_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) |
int absdir | ( | int | d | ) |
Computes an absolute direction.
d | direction to convert. |
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().
Apply artifact properties to an object.
op | object to apply changes to. |
change | changes 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().
Links specified object in the map.
button | object to link. Must not be NULL. |
map | map we are on. Should not be NULL. |
connected | connection 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().
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.
op | object 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().
void add_statbonus | ( | object * | op | ) |
Adds stat-bonuses given by the class which the player has chosen.
op | object 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().
int adjust_dir | ( | int | dir, |
int | destination_dir | ||
) |
Adjusts a given direction by +/-1 towards a destination direction.
dir | the direction to adjust |
destination_dir | the destination direction to adjust towards |
Definition at line 426 of file utils.cpp.
References absdir(), destination_dir, and rndm().
Referenced by move_ball_spell(), and move_missile().
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.
op | object to check. |
Definition at line 1657 of file living.cpp.
References give::op.
Referenced by apply_race_and_class(), and key_change_class().
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.
op | is the object to animate. |
dir | is 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().
void animate_turning | ( | object * | op | ) |
Animates one step of object.
op | object to animate. |
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().
void animation_load_block | ( | FILE * | file, |
const char * | full_path, | ||
const char * | animation_name | ||
) |
void apply_anim_suffix | ( | object * | who, |
const char * | suffix | ||
) |
Applies a compound animation to an object.
who | object to apply the animation to. Must not be NULL. |
suffix | animation 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().
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.
op | victim 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().
Searches for any objects with a matching archetype in the inventory of the given object.
at | archetype to search for. |
op | where to search. |
Definition at line 3222 of file object.cpp.
References 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().
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.
at | archetype from which to get an object. |
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().
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.
op | item to consider. |
art | artifact to compute the chance of. |
numerator | chance in denominator for the artifact to be generated. |
denominator | denominator, 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().
uint16_t artifact_get_face | ( | const artifact * | art | ) |
Get a suitable face number for representing an artifact.
art | what to get the face of. |
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().
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.
attacknr | attacktype to check |
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().
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.
ob | object we ignore. Must not be NULL. |
m | map we're considering. |
sx | |
sy | target coordinates |
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().
int book_overflow | ( | const char * | buf1, |
const char * | buf2, | ||
size_t | booksize | ||
) |
Checks if buf1 and buf2 can be combined.
buf1 | |
buf2 | buffer we plan on combining. |
booksize | maximum book size. |
Definition at line 719 of file readable.cpp.
References BOOK_BUF, booksize, and buf_overflow().
Referenced by write_note().
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.
op | object of which to compute the 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().
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.
op | object 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().
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.
m | map for which to compute difficulty. |
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().
int can_see_monsterP | ( | mapstruct * | m, |
int | x, | ||
int | y, | ||
int | dir | ||
) |
Recursive routine to see if we can find a path to a certain point.
Modified to be map tile aware -.MSW
m | map we're on |
x | |
y | origin coordinates |
dir | direction we're going to. Must be less than SIZEOFFREE. |
Definition at line 3822 of file object.cpp.
References can_see_monsterP(), freearr_x, freearr_y, get_map_flags(), m, P_BLOCKSVIEW, P_OUT_OF_MAP, reduction_dir, diamondslots::x, and diamondslots::y.
Referenced by can_see_monsterP(), do_skill_ident(), monster_find_nearest_enemy(), and spell_find_dir().
Permanently alters an object's stats/flags based on another object.
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().
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.
stats | item to modify. Must not be NULL. |
attr | attribute to change. |
value | delta (can be positive). |
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().
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.
op | victim to alter. |
exp | experience to gain (positive) or lose (negative). |
skill_name | skill to change. Can be NULL. |
flag |
|
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().
void change_luck | ( | object * | op, |
int | value | ||
) |
Alter the object's luck.
op | object to altar. |
value | delta 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().
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.
m | map to change. |
change | delta of light. |
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().
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.
altar | item to which there is a sacrifice | |
sacrifice | object that may be sacrifed | |
remove_others | if 1, will remove enough items apart sacrifice to compensate for not having enough in sacrifice itself. | |
[out] | toremove | will contain the nrof of sacrifice to really remove to finish operating. Will be set if not NULL only if the function returns 1. |
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().
int64_t check_exp_adjust | ( | const object * | op, |
int64_t | exp | ||
) |
Returns the maximum experience the object can gain or lose.
op | object which will be the victim. |
exp | experience to gain or lose. |
Definition at line 2098 of file living.cpp.
References check_exp_loss(), MAX_EXPERIENCE, MIN, and give::op.
Referenced by command_addexp().
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.
op | object from which to subtract. |
exp | experience to 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().
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.
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().
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 s@no mad.a stro .psu. edu
op | object to check. Must be a player. |
trig | trigger 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().
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.
op | object of which to search inventory |
trig | what to search |
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().
int check_path | ( | const char * | name, |
int | prepend_dir | ||
) |
This function checks if a file with the given path exists.
name | map path to check. |
prepend_dir | If set, then we call create_pathname (which prepends libdir & mapdir). Otherwise, we assume the name given is fully complete. |
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().
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().
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)
stats | attributes to check. |
min_stat | lowest the stat can be |
max_stat | highest 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().
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().
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().
void clean_object | ( | object * | op | ) |
Remove and free all objects in the inventory of the given object.
op | object to clean. |
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().
void clean_tmp_map | ( | mapstruct * | m | ) |
Removse the temporary file used by the map.
m | map, 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().
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().
void clear_los | ( | player * | pl | ) |
Clears/initialises the los-array associated to the player controlling the object.
pl | player 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().
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.
pl | player 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().
object* create_archetype | ( | const char * | name | ) |
Finds which archetype matches the given name, and returns a new object containing a copy of the archetype.
name | archetype name |
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().
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").
name | the name we're searching for (ex: "writing pen"), must not be null |
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().
void create_overlay_pathname | ( | const char * | name, |
char * | buf, | ||
size_t | size | ||
) |
Same as create_pathname(), but for the overlay maps. /
name | path of the overlay map. |
buf | buffer that will contain the full path. |
size | buffer'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().
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.
name | path of the map. |
buf | buffer that will contain the full path. |
size | buffer's length. |
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().
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.
name | name to give the dummy object. |
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().
void create_template_pathname | ( | const char * | name, |
char * | buf, | ||
size_t | size | ||
) |
same as create_pathname(), but for the template maps.
name | path of the template map. |
buf | buffer that will contain the full path. |
size | buf'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().
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().
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.
m | pointer 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().
StringBuffer* describe_attacktype | ( | const char * | attack, |
int | value, | ||
StringBuffer * | buf | ||
) |
Describe the specified attack type.
attack | string describing the attack ("Clawing", and such). |
value | attack type to describe. |
buf | where to describe, can be 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().
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.
god | which god to describe. |
what | information to describe, combination of GOD_xxx flags. |
buf | where to describe, must not be NULL. |
maxlen | maximum wanted length of the description, if 0 no maximum length. |
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().
StringBuffer* describe_item | ( | const object * | op, |
const object * | owner, | ||
int | use_media_tags, | ||
StringBuffer * | buf | ||
) |
Describes an item, in all its details.
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)
op | object to describe. Must not be NULL. |
owner | player examining the object. |
use_media_tags | if non-zero, then media tags (colors and such) are inserted in the description. This enables the player to more easily see some things. |
buf | buffer that will contain the description. Can be NULL. |
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().
StringBuffer* describe_monster | ( | const object * | op, |
int | use_media_tags, | ||
StringBuffer * | buf | ||
) |
Describes a monster.
op | monster to describe. Must not be NULL, and must have FLAG_MONSTER or be a PLAYER. |
use_media_tags | if non-zero, then media tags (colors and such) are inserted in the description. This enables the player to more easily see some things. |
buf | buffer that will contain the description. Can be NULL. |
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().
StringBuffer* describe_resistance | ( | const object * | op, |
int | newline, | ||
int | use_media_tags, | ||
StringBuffer * | buf | ||
) |
Generates the visible naming for resistances.
op | object we want information about. |
newline | If TRUE, we don't put parens around the description but do put a newline at the end. Useful when dumping to files |
use_media_tags | if non-zero, then media tags (colors and such) are inserted in the description. This enables the player to more easily see some things. |
buf | buffer that will receive the description. Can be 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().
StringBuffer* describe_spellpath_attenuation | ( | const char * | attenuation, |
int | value, | ||
StringBuffer * | buf | ||
) |
Describe the specified path attenuation.
attenuation | string describing if "Attenued", "Denied", "Repelled", may be NULL. |
value | path value to describe. |
buf | where to describe, can be 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().
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.
op | potential victim. |
level | the effective level to make the save at |
bonus | any plus/bonus (typically based on resistance to particular attacktype). |
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().
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().
int dirdiff | ( | int | dir1, |
int | dir2 | ||
) |
Computes a direction difference.
dir1 | |
dir2 | directions to compare. |
Definition at line 3732 of file object.cpp.
Referenced by monster_cast_spell(), monster_use_range(), monster_use_scroll(), and monster_use_skill().
void drain_specific_stat | ( | object * | op, |
int | deplete_stats | ||
) |
Drain a specified stat from op.
op | victim to drain. |
deplete_stats | statistic 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().
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)
op | object 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().
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().
void dump_alchemy | ( | void | ) |
Dumps alchemy recipes to output. Borrowed (again) from the artifacts code for this.
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().
void dump_alchemy_costs | ( | void | ) |
Dumps to output all costs of recipes.
Code copied from dump_alchemy() and modified by Raphael Quinet
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().
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().
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().
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().
void dump_arch | ( | archetype * | at, |
StringBuffer * | sb | ||
) |
Dumps an archetype to buffer.
at | archetype to dump. Must not be NULL. |
sb | buffer that will contain dumped information. |
Definition at line 141 of file arch.cpp.
References archetype::clone, and object_dump().
Referenced by dump_all_archetypes().
void dump_artifacts | ( | void | ) |
For debugging purposes. Dumps all tables.
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().
void dump_experience | ( | void | ) |
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().
void dump_friendly_objects | ( | void | ) |
Dumps all friendly objects. Invoked in DM-mode with dumpfriendlyobjects command.
Definition at line 70 of file friend.cpp.
References friends.
Referenced by command_dumpfriendlyobjects().
void dump_gods | ( | void | ) |
Prints all gods to stderr.
Definition at line 367 of file holy.cpp.
References living::ac, object::attacktype, archetype::clone, living::Con, living::dam, DESCRIBE_ABILITY, DESCRIBE_PATH, describe_resistance(), living::Dex, FLAG_BLIND, FLAG_MAKE_INVIS, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_UNDEAD, FLAG_USE_ARMOUR, FLAG_USE_WEAPON, FLAG_XRAYS, living::hp, HUGE_BUF, living::Int, object::last_eat, object::last_grace, object::last_heal, object::last_sp, object::level, living::luck, object::msg, object::name, archetype::name, object::other_arch, object::path_attuned, object::path_denied, object::path_repelled, living::Pow, QUERY_FLAG, object::race, object::slaying, object::speed, object::stats, living::Str, stringbuffer_finish(), object::title, living::wc, and living::Wis.
Referenced by init_beforeplay().
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.
m | map 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().
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().
int exp_level | ( | int64_t | exp | ) |
Returns the level for a given exp.
exp | experince 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().
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.
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().
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().
archetype* find_archetype | ( | const char * | name | ) |
Definition at line 266 of file assets.cpp.
References AssetsManager::archetypes(), AssetsCollection< T, Key >::get(), manager, and give::name.
Referenced by alchemyTable(), animate_bomb(), apply_builder_window(), apply_map_builder(), can_pay(), cast_raise_dead_spell(), cctk_create_game_object(), change_luck(), CREMapInformationManager::checkItem(), ArtifactPanel::computeMadeViaAlchemy(), RecipeWrapper::displayIcon(), RecipeWrapper::displayName(), drain_specific_stat(), find_enclosed_spot(), find_next_coin(), fix_flesh_item(), init_archetype_pointers(), kill_player_not_permadeath(), kill_player_permadeath(), make_formula_book(), monsterFight(), msgfile_msg(), object_replace_insert_in_map(), op_on_battleground(), pay_from_container(), place_exits(), place_fountain_with_specials(), poison_living(), process_map(), put_in_icecube(), remove_depletion(), restore_player(), save_object_in_sb(), sell_item(), slow_living_by(), START_TEST(), and while().
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:
name | the name we're searching for (ex: "writing pen") |
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().
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.
type | item type we're searching |
name | the 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().
Searches and returns a specific artifact compatible with an object, NULL if not found.
op | item to search the artifact for. |
name | artifact name. |
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().
artifactlist* find_artifactlist | ( | int | type | ) |
Finds the artifact list for a certain item type.
type | item type to get the artifacts of. |
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().
uint8_t find_color | ( | const char * | name | ) |
Finds a color by name.
name | color name, case-sensitive. |
Definition at line 75 of file image.cpp.
References colorname, llevError, LOG(), and give::name.
Referenced by FaceLoader::load().
int find_dir_2 | ( | int | x, |
int | y | ||
) |
Computes a direction which you should travel to move of x and y.
x | |
y | delta. |
Definition at line 3677 of file object.cpp.
References item::q, diamondslots::x, and diamondslots::y.
Referenced by enter_map(), get_rangevector(), and get_rangevector_from_mapcoord().
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().
const object* find_god | ( | const char * | name | ) |
Returns a god's object from its name.
name | god's name. |
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().
Find a recipe for a specified tool. This function can be called multiple times to browse the whole list, using the 'from' parameter.
tool | tool's archetype name. |
from | formula to search from, if NULL from the first one. |
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().
Find the smooth face for a given face.
face | the face to find the smoothing face for |
smoothed | return value: set to smooth face |
Definition at line 102 of file image.cpp.
References Face::smoothface.
Referenced by send_smooth().
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).
t | item of treasure list to search from |
name | name we're trying to find. Doesn't need to be a shared string. |
depth | current depth. Code will exit if greater than 10. |
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().
void first_arch_pass | ( | FILE * | fp, |
const char * | filename | ||
) |
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.
op | object to fix. |
creator | for who op was created. Can be NULL. |
difficulty | difficulty level. |
max_magic | maximum magic for the item. |
flags |
|
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().
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.
op | object to reset. |
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().
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().
void free_all_god | ( | void | ) |
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().
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().
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().
void free_arch | ( | archetype * | at | ) |
Frees archetype.
at | archetype 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().
void free_charlinks | ( | linked_char * | lc | ) |
Frees a link structure and its next items.
lc | item 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().
void free_dialog_information | ( | object * | op | ) |
Frees obj::dialog_information.
op | what 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().
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().
void free_globals | ( | void | ) |
Cleans all memory allocated for global variables.
Will clear:
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().
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().
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.
m | map 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().
void free_objectlink | ( | objectlink * | ol | ) |
Recursively frees all objectlinks.
ol | object 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().
void free_objectlinkpt | ( | oblinkpt * | obp | ) |
Recursively frees all linked list of objectlink pointers
obp | pointer 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().
void free_player | ( | player * | pl | ) |
Frees player structure, including pointed object (through object_free_drop_inventory()).
pl | player 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().
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.
op | object to attempt to transform. |
difficulty | limit for artifact difficulty. |
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().
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.
skill | skill to search for. Must not be NULL. |
type | item type to search for. -1 means that it doesn't matter. |
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().
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)
type | object type to search for. -1 means any |
subtype | object subtype to search for. -1 means any |
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().
archetype* get_archetype_struct | ( | void | ) |
Allocates, initialises and returns the pointer to an archetype structure.
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().
int8_t get_attr_value | ( | const living * | stats, |
int | attr | ||
) |
Gets the value of a stat.
stats | item from which to get stat. |
attr | attribute to get. |
Definition at line 313 of file living.cpp.
References living::Cha, CHARISMA, living::Con, CONSTITUTION, living::Dex, DEXTERITY, living::Int, INTELLIGENCE, living::Pow, POWER, living::Str, STRENGTH, living::Wis, and WISDOM.
Referenced by add_abilities(), apply_changes_to_player(), apply_race_and_class(), calc_item_power(), cast_change_ability(), change_abil(), check_race_and_class(), check_stat_bounds(), create_player_cmd(), describe_item(), do_symptoms(), eat_special_food(), fix_object(), is_magical(), kill_player_not_permadeath(), monster_get_weapon_quality(), perceive_self(), remove_depletion(), ring_desc(), set_ring_bonus(), swap_random_stats(), and swap_stat().
int get_button_value | ( | const object * | button | ) |
Returns the first value linked to this button. Made as a separate function to increase efficiency
button | object to check. Must not be NULL. |
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().
int get_cha_bonus | ( | int | stat | ) |
Definition at line 2357 of file living.cpp.
int get_cleric_chance | ( | int | stat | ) |
Definition at line 2377 of file living.cpp.
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.
pl | player we're handling. |
spell | spell for which to search data. |
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().
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().
int get_dam_bonus | ( | int | stat | ) |
Definition at line 2385 of file living.cpp.
int get_dex_bonus | ( | int | stat | ) |
Definition at line 2361 of file living.cpp.
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.
op | who is being talked to. | |
text | what is being said. | |
[out] | message | what op should say. Won't be NULL if return is 1. |
[out] | reply | text the one talking should say based on the text. Can be NULL. |
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().
artifact* get_empty_artifact | ( | void | ) |
Allocate and return the pointer to an empty artifact structure.
Definition at line 55 of file artifact.cpp.
References fatal(), OUT_OF_MEMORY, and Floor::t.
Referenced by ArtifactLoader::load().
artifactlist* get_empty_artifactlist | ( | void | ) |
Allocate and return the pointer to an empty artifactlist structure.
Definition at line 37 of file artifact.cpp.
References fatal(), artifactlist::next, OUT_OF_MEMORY, and artifactlist::total_chance.
Referenced by ArtifactLoader::load().
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.
sizex | |
sizey | map size. |
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().
const Face* get_face_by_id | ( | uint16_t | id | ) |
Get a face from its unique identifier.
id | face identifier. |
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().
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.
faceset | faceset to check |
imageno | image 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().
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().
int get_fear_bonus | ( | int | stat | ) |
Definition at line 2393 of file living.cpp.
recipelist* get_formulalist | ( | int | i | ) |
Gets a formula list by ingredients count.
i | number of ingredients. |
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().
objectlink* get_friends_of | ( | const object * | owner | ) |
Get a list of friendly objects for the specified owner.
owner | who to get objects of, may be NULL to get all friendly objects. |
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().
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
race | race we're getting the god of. |
Definition at line 90 of file holy.cpp.
References gods.
Referenced by determine_god(), and START_TEST().
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.
op | Object we want to jail. Must be a player. |
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().
int get_learn_spell | ( | int | stat | ) |
Definition at line 2373 of file living.cpp.
void get_levelnumber | ( | int | i, |
char * | buf, | ||
size_t | size | ||
) |
mapstruct* get_linked_map | ( | void | ) |
Allocates, initialises, and returns a pointer to a mapstruct, linked through first_map.
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().
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.
oldmap | map for which we want information. |
newmap | if not NULL, will contain the actual map checked if not oldmap. |
x | |
y | coordinates to check |
nx | |
ny | if not NULL, will contain the actual coordinates checked. |
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().
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
m | map we want to look at. Must not be NULL. |
x | |
y | coordinates, which will contain the real position that was checked. |
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().
sstring get_message_body | ( | const GeneralMessage * | message | ) |
Get a message's body.
message | message, must not be NULL. |
Definition at line 2077 of file readable.cpp.
References diamondslots::message.
Referenced by knowledge_message_detail().
const Face* get_message_face | ( | const GeneralMessage * | message | ) |
Get a message's face.
message | message, must not be NULL. |
Definition at line 2086 of file readable.cpp.
References diamondslots::message.
Referenced by knowledge_message_face().
const GeneralMessage* get_message_from_identifier | ( | const char * | identifier | ) |
Find the message from its identifier.
identifier | message's identifier. |
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().
sstring get_message_title | ( | const GeneralMessage * | message | ) |
Get a message's title.
message | message, must not be NULL. |
Definition at line 2068 of file readable.cpp.
References diamondslots::message.
Referenced by knowledge_message_summary().
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().
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.
m | map |
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().
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().
Get the next object on the friendly list.
current | current object, NULL to get the first item 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().
void get_ob_diff | ( | StringBuffer * | sb, |
const object * | op, | ||
const object * | op2 | ||
) |
Returns a pointer to a static string which contains all variables which are different in the two given objects.
This function is typically used to dump objects (op2=empty object), or to save objects
sb | buffer that will contain the difference. |
op | what object the different values will be taken from. |
op2 | object's original archetype. |
Definition at line 4986 of file object.cpp.
References living::ac, ADD_STRINGLINE_ENTRY(), object::anim_suffix, object::animation, object::attack_movement, object::attacktype, object::body_info, body_locations, object::carrying, living::Cha, object::client_type, compare_flags(), living::Con, living::dam, object::dam_modifier, living::Dex, object::direction, object::duration, object::duration_modifier, object::elevation, living::exp, object::expmul, object::face, FAST_SAVE_DOUBLE(), FAST_SAVE_LONG(), FLAG_ANIMATE, FLAG_IS_LINKED, flag_names, flags_differ(), FMT64, living::food, object::gen_sp_armour, get_button_value(), get_string_move_type(), object::glow_radius, living::grace, living::hp, living::Int, object::invisible, object::item_power, key_value::key, object::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().
objectlink* get_objectlink | ( | void | ) |
Allocates a new objectlink structure, initialises it, and returns a pointer to it.
Definition at line 33 of file links.cpp.
References fatal(), and OUT_OF_MEMORY.
Referenced by add_button_link().
oblinkpt* get_objectlinkpt | ( | void | ) |
Allocates a new oblinkpt structure, initialises it, and returns a pointer to it.
Definition at line 51 of file links.cpp.
References fatal(), and OUT_OF_MEMORY.
Referenced by add_button_link().
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().
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().
const object* get_rand_god | ( | void | ) |
Returns a random god.
Definition at line 73 of file holy.cpp.
Referenced by determine_god(), god_info_msg(), and START_TEST().
int get_random_dir | ( | void | ) |
Returns a random direction (1..8).
Definition at line 400 of file utils.cpp.
References rndm().
Referenced by move_firewall(), move_player_mover(), move_swarm_spell(), and pets_move().
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.
level | if non-zero, then only monsters greater than that level will be returned. |
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().
recipe* get_random_recipe | ( | recipelist * | rpl | ) |
Gets a random recipe from a list, based on chance.
rpl | recipelist we want a recipe from. Can be NULL in which case a random one is selected. |
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().
int get_randomized_dir | ( | int | dir | ) |
Returns a random direction (1..8) similar to a given direction.
dir | the exact 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().
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.
op1 | object which wants to go to op2's location. |
op2 | target of op1. |
retval | vector for op1 to go to op2. |
flags | if 1, don't translate for closest body part of 'op1' |
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().
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.
m | map to consider. |
x | |
y | origin coordinates. |
op2 | target object. |
retval | vector to get to op2. |
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().
const readable_message_type* get_readable_message_type | ( | object * | readable | ) |
Get the readable type for an object (hopefully book).
readable | object for which we want the readable type. |
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().
Gets a region from a map.
m | map we want the region of. |
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().
region* get_region_by_name | ( | const char * | region_name | ) |
Gets a region by name.
Used by the map parsing code.
region_name | name of region. |
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().
region* get_region_from_string | ( | const char * | name | ) |
Tries to find a region that 'name' corresponds to. It looks, in order, for:
name | region we're searching. |
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().
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.
r | region we're searching the longname. |
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().
const char* get_region_msg | ( | const region * | r | ) |
Gets a message for a region.
r | region. Can't be NULL. |
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().
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....
Definition at line 294 of file region.cpp.
References fatal(), and OUT_OF_MEMORY.
Referenced by init_regions(), and main().
void get_search_arr | ( | int * | search_arr | ) |
New function to make monster searching more efficient, and effective! This basically returns a randomized array (in the passed pointer) of the spaces to find monsters. In this way, it won't always look for monsters to the north first. However, the size of the array passed covers all the spaces, so within that size, all the spaces within the 3x3 area will be searched, just not in a predictable order.
search_arr | array that will be initialized. Must contain at least SIZEOFFREE elements. |
Definition at line 3642 of file object.cpp.
References permute(), SIZEOFFREE, SIZEOFFREE1, and SIZEOFFREE2.
Referenced by monster_find_nearest_enemy(), pets_get_enemy(), and spell_find_dir().
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().
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().
float get_speed_bonus | ( | int | stat | ) |
Definition at line 2389 of file living.cpp.
int get_thaco_bonus | ( | int | stat | ) |
Definition at line 2365 of file living.cpp.
void get_tod | ( | timeofday_t * | tod | ) |
int get_turn_bonus | ( | int | stat | ) |
Definition at line 2381 of file living.cpp.
const typedata* get_typedata | ( | int | itemtype | ) |
itemtype | item type for which to return typedata. |
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().
const typedata* get_typedata_by_name | ( | const char * | name | ) |
name | item name for which to return typedata. Singular form is preferred. |
Definition at line 343 of file item.cpp.
References item_types, item_types_size, llevInfo, LOG(), and give::name.
Referenced by parse_shop_string().
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().
uint32_t get_weight_limit | ( | int | stat | ) |
Definition at line 2369 of file living.cpp.
Fixes the given object, giving it the abilities and titles it should have due to the second artifact-template.
op | object to give properties to. |
artifact | what 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().
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.
op | object to which to give the skill. Must not be NULL. |
skill_name | skill to give. Must not be NULL. |
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().
int has_ability | ( | const object * | ob | ) |
Checks whether object has innate abilities (spell/spellbook in inventory).
Definition at line 153 of file exp.cpp.
References guildjoin::ob, object_find_by_type(), SPELL, and SPELLBOOK.
Referenced by new_exp().
mapstruct* has_been_loaded | ( | const char * | name | ) |
Checks whether map has been loaded.
name | path of the map to search. Can be NULL. |
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().
int has_carried_lights | ( | const object * | op | ) |
Checks if op has a light source.
op | object being checked. |
Definition at line 346 of file los.cpp.
References give::op.
Referenced by hideability(), and monster_can_see_enemy().
const char* i18n | ( | const object * | who, |
const char * | code | ||
) |
Translate a message in the appropriate language.
who | who to translate for. |
code | string to translate, usually the English version. |
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().
language_t i18n_find_language_by_code | ( | const char * | code | ) |
Attempt to find the identifier of a language from its code.
code | language code. |
Definition at line 59 of file languages.cpp.
References i18n_files.
Referenced by command_language(), and i18n_get_language_by_code().
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().
language_t i18n_get_language_by_code | ( | const char * | code | ) |
Find the identifier of a language from its code.
code | language's code. |
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().
sstring i18n_get_language_code | ( | language_t | language | ) |
Return the code of a specified language.
language | identifier of the language. |
Definition at line 85 of file languages.cpp.
References i18n_file::code, and i18n_default.
Referenced by command_help(), help_topics(), and save_player().
void i18n_init | ( | void | ) |
Initializes the i18n subsystem. Will load all found strings. If there is an error, calls fatal().
Definition at line 130 of file languages.cpp.
References add_refcount(), add_string(), bufferreader_destroy(), bufferreader_init_from_file(), bufferreader_next_line(), closedir(), i18n_file::code, convert_newline(), Settings::datadir, fatal(), mad_mage_user::file, npc_dialog::filename, is_valid_types_gen::found, free_string(), i18n_default, i18n_files, is_valid_types_gen::line, llevDebug, llevError, LOG(), MAX_BUF, i18n_file::messages, i18n_file::name, opendir(), OUT_OF_MEMORY, readdir(), SEE_LAST_ERROR, settings, and sstring.
Referenced by init_library().
void i18n_list_languages | ( | object * | who | ) |
List all languages for who.
who | who 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().
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.
op | item to identify. Can be already identified without ill effects. |
object | The 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().
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().
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().
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().
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().
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.
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().
void init_formulae | ( | BufferReader * | reader, |
const char * | filename | ||
) |
Builds up the lists of formula from the file in the libdir. -b.t.
Definition at line 166 of file recipe.cpp.
References add_string(), recipe::arch_name, recipe::arch_names, buf, bufferreader_current_line(), bufferreader_next_line(), build_stringlist(), recipe::cauldron, recipe::chance, recipe::diff, recipe::exp, recipe::failure_arch, recipe::failure_message, fatal(), npc_dialog::filename, formulalist, free_all_recipes(), get_empty_formula(), recipe::index, recipe::ingred, recipe::ingred_count, init_recipelist(), recipe::is_combination, recipelist::items, recipe::keycode, llevDebug, llevError, LOG(), recipe::min_level, recipe::next, recipelist::next, give::next, numb_ingred(), recipelist::number, SEE_LAST_ERROR, recipe::skill, strtoint(), recipe::title, Ice::tmp, recipe::tool, recipe::tool_size, recipelist::total_chance, recipe::transmute, autojail::value, and recipe::yield.
Referenced by assets_collect().
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().
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().
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().
void init_msgfile | ( | FILE * | file, |
const char * | filename | ||
) |
void init_ob_method_struct | ( | ob_methods * | methods, |
ob_methods * | fallback | ||
) |
Initializes a ob_methods struct. Make sure this always matches ob_methods.h
methods | ob_method structure to initialize |
fallback | Default 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().
void init_ob_types | ( | ob_methods * | base_type | ) |
Initializes the object system.
base_type | base type to use as a base for all types. |
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().
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().
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().
void init_regions | ( | BufferReader * | reader, |
const char * | filename | ||
) |
Reads/parses the region file, and copies into a linked list of region structs.
reader | buffer to read from. |
filename | file being read. |
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().
void init_stats | ( | ) |
This loads statistic bonus/penalties from the stat_bonus file. Any error is fatal, as system needs working bonuses.
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().
int is_dragon_pl | ( | const object * | op | ) |
Checks if player is a dragon.
op | player to check. Can be NULL. |
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().
int is_friendly | ( | const object * | op | ) |
Checks if the given object is already in the friendly list or not
op | item to check |
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().
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).
op | Object to check. |
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().
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.
op | Object to check. |
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().
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.
op | item to check. |
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().
int is_old_wraith_pl | ( | object * | op | ) |
Checks if player is a wraith without the 'wraith feed' skill.
op | player to check. |
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().
int is_type_valid | ( | uint8_t | type | ) |
Checks if the specified type is a valid one for a Crossfire object.
type | value to check. |
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().
int is_valid_faceset | ( | int | fsn | ) |
int is_wraith_pl | ( | object * | op | ) |
Tests if a player is a wraith.
op | player to check. |
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().
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().
void jump_time | ( | void | ) |
Definition at line 198 of file time.cpp.
References game_time, and process_utime_long_count.
Referenced by do_server().
Checks if op can be combined with art.
op | object to test. |
art | artifact to test. |
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().
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
level | level player wants to reach |
expmul | penality/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().
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.
op | player 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().
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 | ||
) |
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.
fp | file pointer from which to read. |
op | where to read the data. |
bufstate | used to determine various file attributes:
|
map_flags | combination of Map loading flags flags, though only MAP_STYLE is used. |
artifact_init | whether the object is being loaded as part of artifact loading or not. |
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().
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.
reader | where to read from. |
op | object to read. |
map_flags | one or more map loading flags. |
arch_init | whether we are loading archetypes or not. |
artifact_init | whether the object is being loaded as part of artifact loading or not. |
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().
int load_png_file | ( | FILE * | file, |
const char * | full_path | ||
) |
void load_treasures | ( | void | ) |
Finds an artifact for a recipe.
rp | recipe |
idx | index of ingredient in recipe. |
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().
void LOG | ( | LogLevel | logLevel, |
const char * | format, | ||
... | |||
) |
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.
input | string to transform. Will be overwritten. Must be long enough to contain the modified string. |
Definition at line 368 of file utils.cpp.
References MAX_BUF, and Ice::tmp.
Referenced by can_pay(), and shop_describe().
void make_path_to_file | ( | const char * | filename | ) |
Checks if any directories in the given path doesn't exist, and creates if necessary.
filename | file path we'll want to access. Can be NULL. |
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().
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
op | object that disappears. |
Definition at line 718 of file los.cpp.
References first_player, give::op, and altar_valkyrie::pl.
Referenced by process_object().
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.
op | object that should be visible. |
Definition at line 695 of file los.cpp.
References first_player, LOS_NO_DARKNESS, give::op, and altar_valkyrie::pl.
Referenced by process_object().
Searches for any objects with a matching archetype at the given map and coordinates.
m | |
x | |
y | where to search. Must be valid position. |
at | archetype to search for. |
Definition at line 3118 of file object.cpp.
References FOR_MAP_FINISH, FOR_MAP_PREPARE, llevError, LOG(), m, 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().
Finds an object in a map tile by flag number. Checks the objects' heads.
map | the map to search. |
x | the x-coordiate to search. |
y | the y-coordiate to search. |
flag | the flag to seacrh for |
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().
Searches for any objects with a matching type variable at the given map and coordinates.
m | |
x | |
y | where to search. Must be valid position. |
type | type to get. |
Definition at line 3145 of file object.cpp.
References FOR_MAP_FINISH, FOR_MAP_PREPARE, m, OUT_OF_REAL_MAP, Ice::tmp, is_valid_types_gen::type, diamondslots::x, and diamondslots::y.
Referenced by identify(), remove_door(), and remove_locked_door().
const char* map_get_path | ( | const object * | item | ) |
Return the map path on which the specified item is.
item | what to return the map path for. |
Definition at line 2663 of file map.cpp.
References map_get_path().
Referenced by gate_type_process(), and map_get_path().
void map_remove_unique_files | ( | const mapstruct * | map | ) |
Remove files containing the map's unique items.
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().
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
map | Map path |
flags | Additional options for loading the map:
|
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().
materialtype_t* name_to_material | ( | const char * | name | ) |
Convert materialname to materialtype_t
name | material name to get. |
Definition at line 248 of file utils.cpp.
References materials, and give::name.
Referenced by animate_weapon(), object_get_materialtype(), and transmute_materialname().
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.
ob | object for which to return experience |
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().
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
buf1 | items we want to split. |
buf2 | what to split by. |
Definition at line 642 of file readable.cpp.
References buf, MAX_BUF, and strlcpy().
Referenced by describe_god(), and strtoktolin().
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.
op | The object to apply |
applier | The object that executes the apply action |
aflags | Special (always apply/unapply) flags |
0 | A player or monster can't apply objects of that type |
1 | has been applied, or there was an error applying the object |
2 | objects 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().
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.
ob | object to test. |
m | |
x | |
y | map and coordinates to check. |
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().
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.
op | The object to describe |
observer | The object to which the description is made |
use_media_tags | whether to add media tags or not on the description |
buf | Buffer that will contain the description |
size | Size of 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().
method_ret ob_move_on | ( | object * | op, |
object * | victim, | ||
object * | originator | ||
) |
Makes an object move on top of another one.
op | The object over which to move |
victim | The object moving over op |
originator | The object that is the cause of the move |
METHOD_UNHANDLED | if 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().
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.
op | The object to process |
METHOD_UNHANDLED | if 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().
method_ret ob_trigger | ( | object * | op, |
object * | cause, | ||
int | state | ||
) |
An object is triggered by another one.
op | The object being triggered |
cause | The object that is the cause of the trigger |
state | trigger state, 0 for released, other for pushed |
METHOD_UNHANDLED | if the process method does not exist for that object |
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().
void object_add_weight | ( | object * | op, |
signed long | weight | ||
) |
object_add_weight(object, weight) adds the specified weight to an object, and also updates how much the environment(s) is/are carrying.
Takes container weight reduction into account.
op | object to which we add weight. |
weight | weight to add. |
Definition at line 2833 of file object.cpp.
References CONTAINER, and give::op.
Referenced by make_item_from_recipe(), object_decrease_nrof(), object_increase_nrof(), and object_insert_in_ob().
Examines the 2 objects given to it, and returns true if they can be merged together, including inventory.
Note that this function appears a lot longer than the macro it replaces - this is mostly for clarity - a decent compiler should hopefully reduce this to the same efficiency.
Check nrof variable before calling object_can_merge()
Improvements made with merge: Better checking on potion, and also check weight
ob1 | |
ob2 | objects to try to merge. |
Definition at line 433 of file object.cpp.
References 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().
Finds out if an object can be picked up.
Add a check so we can't pick up invisible objects (0.93.8)
who | who is trying to pick up. Can be a monster or a player. |
item | item we're trying to pick up. |
Definition at line 3867 of file object.cpp.
References 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().
Checks if any objects has a move_type that matches objects that effect this object on this space. Call apply() to process these events.
Any speed-modification due to SLOW_MOVE() of other present objects will affect the speed_left of the object. 4-21-95 added code to check if appropriate skill was readied - this will permit faster movement by the player through this terrain. -b.t.
MSW 2001-07-08: Check all objects on space, not just those below object being inserted. object_insert_in_map may not put new objects on top.
op | object that may trigger something. |
originator | player, monster or other object that caused 'op' to be inserted into 'map'. May be NULL. |
Definition at line 3012 of file object.cpp.
References 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().
void object_clear | ( | object * | op | ) |
Frees everything allocated by an object, and also clears all variables and flags to default settings.
op | object to clear |
Definition at line 983 of file object.cpp.
References 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().
void object_clear_owner | ( | object * | op | ) |
Clears the owner of specified object.
op | object we want to clear the owner of. Can be NULL. |
Definition at line 823 of file object.cpp.
References give::op.
Referenced by do_mood_floor(), fix_stopped_arrow(), object_get_owner(), object_set_owner(), START_TEST(), and stop_projectile().
Copy object first frees everything allocated by the second object, and then copies the contents of the first object into the second object, allocating what needs to be allocated. Basically, any data that is malloc'd needs to be re-malloc/copied. Otherwise, if the first object is freed, the pointers in the new object will point at garbage. Will call object_update_speed() on the copied object.
src_ob | object that we copy.from |
dest_ob | object that we copy to. |
Definition at line 1192 of file object.cpp.
References object_copy_no_speed(), and object_update_speed().
Referenced by add_abilities(), apply_race_and_class(), cast_create_food(), cfapi_object_clone(), change_book(), check_loaded_object(), command_create(), do_learn_spell(), enter_exit(), explosion(), forklightning(), infect_object(), key_change_class(), 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().
Copy object first frees everything allocated by the second object, and then copies the contents of the first object into the second object, allocating what needs to be allocated. Basically, any data that is malloc'd needs to be re-malloc/copied. Otherwise, if the first object is freed, the pointers in the new object will point at garbage. Will not call object_update_speed() on the copied object.
src_ob | object that we copy.from |
dest_ob | object that we copy to. |
Definition at line 1061 of file object.cpp.
References add_refcount(), object::anim_suffix, object::arch, object::artifact, BITMASK_VALID, CLEAR_FLAG, object::event_bitmask, FLAG_DIALOG_PARSED, FLAG_FREED, FLAG_REMOVED, FREE_AND_CLEAR, free_dialog_information(), free_string(), key_value::key, object::key_values, object::lore, object::materialname, object::msg, 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().
Set the owner to clone's current owner and set the skill and experience objects to clone's objects (typically those objects that where the owner's current skill and experience objects at the time when clone's owner was set - not the owner's current skill and experience objects).
Use this function if player created an object (e.g. fire bullet, swarm spell), and this object creates further objects whose kills should be accounted for the player's original skill, even if player has changed skills meanwhile.
op | object to update. |
clone | object from which to get the owner. |
Definition at line 893 of file object.cpp.
References object_get_owner(), object_set_owner(), give::op, PLAYER, and object::type.
Referenced by animate_bomb(), explode_bullet(), fire_arch_from_position(), poison_living(), and START_TEST().
Copy an object with an inventory, duplicate the inv too.
src_ob | object to copy. |
dest_ob | where to copy. |
update_speed | if true then call update_speed() on the duplicated objects, else don't. |
Definition at line 1208 of file object.cpp.
References FOR_INV_FINISH, FOR_INV_PREPARE, object_copy(), object_copy_no_speed(), object_copy_with_inv(), object_insert_in_ob(), 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().
int object_count_active | ( | void | ) |
Objects statistics.
Definition at line 1783 of file object.cpp.
References active_objects, and Ice::tmp.
Referenced by malloc_info(), and START_TEST().
int object_count_free | ( | void | ) |
Objects statistics.
Definition at line 1751 of file object.cpp.
References free_objects, and Ice::tmp.
Referenced by malloc_info(), and START_TEST().
int object_count_used | ( | void | ) |
Object statistics.
Definition at line 1767 of file object.cpp.
References objects, and Ice::tmp.
Referenced by malloc_info(), and START_TEST().
Create a full object using the given archetype. This instanciate not only the archetype but also all linked archetypes in case of multisquare archetype.
at | archetype to instanciate. Must not be 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().
Create clone from object to another.
asrc | object to clone. |
Definition at line 3909 of file object.cpp.
References FOR_INV_FINISH, FOR_INV_PREPARE, 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().
Decreases a specified number from the amount of an object. If the amount reaches 0, the object is subsequently removed and freed.
This function will send an update to client if op is in a player inventory.
op | object to decrease. |
i | number to remove. |
Definition at line 2676 of file object.cpp.
References 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().
Return the square of the distance between the two given objects.
ob1 | |
ob2 | objects we want to compute the distance of. |
Definition at line 3661 of file object.cpp.
References guildbuy::ob1, and guildbuy::ob2.
Referenced by cfapi_object_distance().
void object_dump | ( | const object * | op, |
StringBuffer * | sb | ||
) |
Dumps an object.
op | object to dump. Can be NULL. |
sb | buffer that will contain object information. Must not be NULL. |
Definition at line 645 of file object.cpp.
References 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().
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().
Find object in inventory by archetype name.
who | where to search. |
name | what to search. |
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().
Find object in inventory by flag.
who | where to search. |
flag | what to search. |
Definition at line 4206 of file object.cpp.
References QUERY_FLAG, Ice::tmp, and autojail::who.
Referenced by use_alchemy().
Find applied object in inventory by flag.
who | where to search. |
flag | what to search. |
Definition at line 4229 of file object.cpp.
References FLAG_APPLIED, QUERY_FLAG, Ice::tmp, and autojail::who.
Referenced by save_life().
Finds an object in inventory name.
who | the object to search |
name | name to search for |
Definition at line 3956 of file object.cpp.
References add_string(), 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().
object* object_find_by_name_global | ( | const char * | str | ) |
Finds an object by name.
Used only by the patch command, but not all that useful. Enables features like "patch name-of-other-player food 999"
str | name to search for. Must not be allocated by add_string(). |
Definition at line 747 of file object.cpp.
References add_string(), free_string(), give::name, objects, give::op, and make_face_from_files::str.
Referenced by command_possess(), find_object_both(), and START_TEST().
Find object in inventory.
who | where to search. |
tag | what to search. |
Definition at line 4060 of file object.cpp.
References CFweardisguise::tag, Ice::tmp, and autojail::who.
Referenced by command_cast_spell().
Returns the object which has the count-variable equal to the argument.
i | tag. |
Definition at line 727 of file object.cpp.
References 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().
Find object in inventory.
who | where to search. |
type | what to search. |
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().
Find object in inventory.
who | where to search. |
type1 | what to search. |
type2 | what to search. |
Definition at line 4037 of file object.cpp.
References Ice::tmp, and autojail::who.
Referenced by dispel_rune(), and hit_player().
Find object in inventory by type and archetype name.
who | where to search. |
type | what to search. |
name | what to search. |
Definition at line 4277 of file object.cpp.
References 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().
Find object in inventory by type and name.
who | where to search. |
type | what to search. |
name | what to search |
Definition at line 4108 of file object.cpp.
References 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().
Find object in inventory by type and race.
who | where to search. |
type | what to search. |
race | what to search |
Definition at line 4133 of file object.cpp.
References Ice::tmp, is_valid_types_gen::type, and autojail::who.
Referenced by monster_check_apply().
Find object in inventory by type and skill.
who | where to search. |
type | what to search. |
skill | what to search |
Definition at line 4183 of file object.cpp.
References Ice::tmp, is_valid_types_gen::type, and autojail::who.
Referenced by do_skill().
Find object in inventory by type and slaying.
who | where to search. |
type | what to search. |
slaying | what to search |
Definition at line 4158 of file object.cpp.
References 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().
Find applied object in inventory.
who | where to search. |
type | what to search. |
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().
Find object in inventory.
who | where to search. |
type | |
subtype | what to search. |
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().
object* object_find_by_type_without_flags | ( | const object * | who, |
int | type, | ||
int * | flags, | ||
int | num_flags | ||
) |
Find an object in inventory that does not have any of the provided flags set.
who | where to search. |
type | what to search. |
flags | Array of integers corresponding to the set of flags that cannot have any set on the found item. |
num_flags | The size of the array flags above |
Definition at line 4004 of file object.cpp.
References flags, QUERY_FLAG, Ice::tmp, is_valid_types_gen::type, and autojail::who.
Referenced by find_key().
object_find_first_free_spot(archetype, mapstruct, x, y) works like object_find_free_spot(), but it will search max number of squares. It will return the first available spot, not a random choice. Changed 0.93.2: Have it return -1 if there is no free spot available.
ob | object to insert. |
m | |
x | |
y | where to insert the object. |
Definition at line 3599 of file object.cpp.
References freearr_x, freearr_y, m, 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().
object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coordinates which will be able to contain the given object.
It returns a random choice among the alternatives found.
ob | object to insert. |
m | |
x | |
y | where to insert the object. |
start | |
stop | first (inclusive) and last (exclusive) positions, in the freearr_ arrays, to search. |
Definition at line 3559 of file object.cpp.
References AB_NO_PASS, freearr_x, freearr_y, 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().
int object_find_multi_free_spot_around | ( | const object * | ob, |
const object * | gen, | ||
int16_t * | hx, | ||
int16_t * | hy | ||
) |
Sets hx and hy to the coords to insert a possibly multi-tile ob at, around gen.
ob | object to insert. Must not be NULL. | |
gen | where to insert. Must not be NULL. | |
[out] | hx | |
[out] | hy | coordinates at which insertion is possible. |
Definition at line 3296 of file object.cpp.
References HEAD, object::map, MAP_HEIGHT, MAP_WIDTH, guildjoin::ob, ob_blocked(), object_get_multi_size(), RANDOM, object::x, and object::y.
Referenced by change_object().
int object_find_multi_free_spot_within_radius | ( | const object * | ob, |
const object * | gen, | ||
int * | hx, | ||
int * | hy | ||
) |
Sets hx and hy to the coords to insert a possibly multi-tile ob at, within radius of generator, which is stored in key_value "generator_radius". Radius defaults to 1.
ob | object to insert. Must not be NULL. | |
gen | where to insert. Must not be NULL. | |
[out] | hx | |
[out] | hy | coordinates at which insertion is possible. |
Definition at line 3412 of file object.cpp.
References get_map_flags(), HEAD, object::map, 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().
void object_fix_multipart | ( | object * | tmp | ) |
Ensures specified object has its more parts correctly inserted in map.
Extracted from common/map.c:link_multipart_objects
tmp | object we want to fix. Must be on a map. |
Definition at line 4685 of file object.cpp.
References add_string(), 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().
void object_free | ( | object * | ob, |
int | flags | ||
) |
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects. The IS_FREED() flag is set in the object.
The object must have been removed by object_remove() first for this function to succeed.
ob | object to free. Will become invalid when function returns. |
flags | the flags; see FREE_OBJ_xxx constants. |
Definition at line 1592 of file object.cpp.
References 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().
void object_free_all_data | ( | void | ) |
Destroys all allocated objects.
Definition at line 767 of file object.cpp.
References FLAG_FREED, free_objects, llevDebug, LOG(), give::next, nrofallocobjects, nroffreeobjects, objects, give::op, QUERY_FLAG, and STARTMAX.
Referenced by cleanup().
void object_free_drop_inventory | ( | object * | ob | ) |
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects. The IS_FREED() flag is set in the object. The object must have been removed by object_remove() first for this function to succeed.
Inventory will be dropped on the ground if in a map, else freed too.
ob | object to free. Will become invalid when function returns. |
Definition at line 1560 of file object.cpp.
References 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().
void object_free_inventory | ( | object * | ob | ) |
Frees the inventory of an object, without any callback.
ob | object to free the inventory of. |
Definition at line 1568 of file object.cpp.
References FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, commongive::inv, guildjoin::ob, object_free(), and object_remove().
Referenced by asset_destroy(), Archetypes::recursive_update(), and Archetypes::replace().
void object_free_key_values | ( | object * | op | ) |
Zero the key_values on op, decrementing the shared-string refcounts and freeing the links.
op | object to clear. |
Definition at line 954 of file object.cpp.
References FREE_AND_CLEAR_STR, key_value::key, 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().
Utility function.
op | object we want the environment of. Can't 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().
Search for a field by key.
ob | object where search |
key | key to search. Must be a passed in shared string - otherwise, this won't do the desired thing. |
Definition at line 4321 of file object.cpp.
References key_value::key, 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().
void object_get_multi_size | ( | const object * | ob, |
int * | sx, | ||
int * | sy, | ||
int * | hx, | ||
int * | hy | ||
) |
Computes the size of a multitile object.
ob | object we compute the size of. | |
[out] | sx | |
[out] | sy | will contain the coords of the bottom right tail relative to the head. Must not be NULL. |
[out] | hx | |
[out] | hy | will contain the coords of the head tile relative to the top left tile. Can be NULL. |
Definition at line 4744 of file object.cpp.
References 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().
Returns the object which this object marks as being the owner.
A id-scheme is used to avoid pointing to objects which have been freed and are now reused. If this is detected, the owner is set to NULL, and NULL is returned.
op | item to search owner of. |
Definition at line 804 of file object.cpp.
References 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().
Finds the player carrying an object.
op | item for which we want the carrier (player). |
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().
const char* object_get_value | ( | const object * | op, |
const char *const | key | ||
) |
Get an extra value by key.
op | object we're considering |
key | key of which to retrieve the value. Doesn't need to be a shared string. |
Definition at line 4346 of file object.cpp.
References find_string(), key_value::key, 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().
void object_give_identified_properties | ( | object * | op | ) |
Ensure op has all its "identified" properties set.
op | object 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().
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().
This function inserts the object in the two-way linked list which represents what is on a map.
It will update player count if the op is a player.
Player ground window will be updated if needed.
op | object to insert. Must be removed. Its coordinates must be valid for the map. |
m | map to insert into. Must not be NULL. |
originator | player, monster or other object that caused 'op' to be inserted into 'm'. May be NULL. |
flag | bitmask about special things to do (or not do) when this function is called. See the object.h file for the INS_xxx values. Passing 0 for flag gives proper default values, so flag really only needs to be set if special handling is needed. |
Definition at line 2361 of file object.cpp.
References object::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().
object* object_insert_in_map_at | ( | object * | op, |
mapstruct * | m, | ||
object * | originator, | ||
int | flag, | ||
int | x, | ||
int | y | ||
) |
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing multi-part monsters.
op | object to insert. |
m | map to insert into. |
originator | what caused op to be inserted. |
flag | Combination of INS_xxx values. |
x | |
y | coordinates to insert at. |
Definition at line 2100 of file object.cpp.
References 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().
This function inserts the object op in the linked list inside the object environment.
It will send to client where is a player.
op | object to insert. Must be removed and not NULL. Must not be multipart. May become invalid after return, so use return value of the function. |
where | object to insert into. Must not be NULL. Should be the head part. |
Definition at line 2857 of file object.cpp.
References 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().
void object_insert_to_free_spot_or_free | ( | object * | op, |
mapstruct * | map, | ||
int | x, | ||
int | y, | ||
int | start, | ||
int | stop, | ||
object * | originator | ||
) |
Inserts an object into its map. The object is inserted into a free spot (as returned by object_find_free_spot()). If no free spot can be found, the object is freed.
op | the object to insert or free |
map | the map to insert into |
x | the x-coordinate to insert into |
y | the y-coordinate to insert into |
start | first (inclusive) position in the freearr_ arrays to search |
stop | last (exclusive) position in the freearr_ arrays to search |
originator | what caused op to be inserted. |
Definition at line 4791 of file object.cpp.
References freearr_x, freearr_y, 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().
int object_matches_pickup_mode | ( | const object * | item, |
int | mode | ||
) |
Checks if an item matches a specific pickup mode.
item | item to check. |
mode | one value of Pickup modes, not a combination of modes. |
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().
This is a subset of the parse_id command. Basically, name can be a string separated lists of things to match, with certain keywords. pl is the player (only needed to set count properly) op is the item we are trying to match. Calling function takes care of what action might need to be done and if it is valid (pickup, drop, etc.) Return NONZERO if we have a match. A higher value means a better match. 0 means no match.
Brief outline of the procedure: We take apart the name variable into the individual components. cases for 'all' and unpaid are pretty obvious. Next, we check for a count (either specified in name, or in the player object.) If count is 1, make a quick check on the name. IF count is >1, we need to make plural name. Return if match. Last, make a check on the full name.
Details on values output (highest is output):
nothing 0 'all' 1 'unpaid' 2 'cursed' 2 'unlocked' 2 partial custom name 3 op->name with count >1 4 op->name with count <2 6 op->name_pl with count >1 6 inside base name 12 inside short name 12 begin of base name 14 custom name 15 base name 16 short name 18 full name 20 (note, count is extracted from begin of name parameter or from pl->contr->count, name has priority)
pl | object we're searching an item for. Must not be NULL. |
op | object we're considering. Must not be NULL. |
name | string we're searching. |
Definition at line 4574 of file object.cpp.
References 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().
This function goes through all objects below and including top, and merges op to the first matching object.
Will correctly send updated objects to client if needed.
op | object to merge. |
top | from which item to merge. If NULL, it is calculated. |
Definition at line 2051 of file object.cpp.
References 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().
void object_merge_spell | ( | object * | op, |
int16_t | x, | ||
int16_t | y | ||
) |
This sees if there are any objects on the space that can merge with op. Note that op does not need to actually be inserted on the map (when called from object_insert_in_map, it won't be), but op->map should be set correctly.
Note that even if we find a match on the space, we keep progressing looking for more. This is because op->range is set to 0 in explosion, so what may not have been mergable now is.
op | object to try to merge into. |
x | |
y | coordinates to look at for merging. |
Definition at line 2129 of file object.cpp.
References 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().
object* object_new | ( | void | ) |
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
If there are no free objects, expand_objects() is called to get more.
Definition at line 1273 of file object.cpp.
References BITMASK_VALID, expand_objects(), fatal(), FLAG_FREED, FLAG_REMOVED, free_objects, llevError, LOG(), nroffreeobjects, ob_count, object_clear(), objects, give::op, OUT_OF_MEMORY, object::prev, QUERY_FLAG, and SET_FLAG.
Referenced by add_abilities(), arch_to_object(), artifact_describe(), cast_create_food(), cfapi_object_clone(), cfapi_object_create(), command_reset(), command_summon(), command_teleport(), create_singularity(), do_goto(), do_learn_spell(), enter_exit(), enter_player_savebed(), explosion(), forklightning(), generate_treasure(), get_jail_exit(), infect_object(), key_change_class(), load_objects(), magic_wall(), make_throw_ob(), move_bolt(), move_cone(), object_copy_with_inv(), object_create_clone(), CRETreasurePanel::onGenerate(), pay_from_container(), place_chest(), place_fountain_with_specials(), place_special_exit(), polymorph_item(), sell_item(), setup(), START_TEST(), while(), write_note(), write_rune(), and write_scroll().
Searches for any objects with a matching type variable in the inventory of the given object.
type | type to search for. |
op | object to search into. |
Definition at line 3168 of file object.cpp.
References give::op, Ice::tmp, and is_valid_types_gen::type.
Referenced by blind_living(), cfapi_object_get_property(), check_probe(), and examine_monster().
Searches for any objects with a matching type & name variable in the inventory of the given object. This is mostly used by spell effect code, so that we only have one spell effect at a time. type can be used to narrow the search - if type is set, the type must also match. -1 can be passed for the type, in which case the type does not need to pass. str is the string to match against. Note that we match against the object name, not the archetype name. this is so that the spell code can use one object type (force), but change it's name to be unique.
type | object type to search for. -1 means to ignore it. |
str | object name to search for. |
op | where to search. |
Definition at line 3203 of file object.cpp.
References 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().
void object_remove | ( | object * | op | ) |
This function removes the object op from the linked list of objects which it is currently tied to. When this function is done, the object will have no environment. If the object previously had an environment, the x and y coordinates will be updated to the previous environment.
Will inform the client of the removal if needed.
op | object to remove. Must not be removed yet, else abort() is called. |
Definition at line 1833 of file object.cpp.
References 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().
void object_remove_from_active_list | ( | object * | op | ) |
This function removes object 'op' from the list of active objects. This should only be used for style maps or other such reference maps where you don't want an object that isn't in play chewing up cpu time getting processed. The reverse of this is to call object_update_speed(), which will do the right thing based on the speed of the object.
op | object to remove. |
Definition at line 1392 of file object.cpp.
References active_objects, and give::op.
Referenced by load_objects(), object_update_speed(), and START_TEST().
void object_replace_insert_in_map | ( | const char * | arch_string, |
object * | op | ||
) |
This function inserts an object of a specified archetype in the map, but if it finds objects of its own type, it'll remove them first.
arch_string | object's archetype to insert. |
op | object to insert it under: supplies x and the map. |
Definition at line 2597 of file object.cpp.
References arch_to_object(), find_archetype(), FOR_MAP_FINISH, FOR_MAP_PREPARE, INS_BELOW_ORIGINATOR, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), give::op, and Ice::tmp.
Referenced by save_throw_object(), and START_TEST().
void object_reset | ( | object * | op | ) |
Totally resets the specified object, without freeing associated memory.
op | object to reset. |
Definition at line 934 of file object.cpp.
References object_clear(), and give::op.
Referenced by cfapi_object_reset(), check_login(), ArtifactLoader::load(), and START_TEST().
void object_set_cheat | ( | object * | op | ) |
object_set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in all it's inventory (recursively). If checksums are used, a player will get object_set_cheat called for him/her-self and all object carried by a call to this function.
op | object for which to set the flag. |
Definition at line 3274 of file object.cpp.
References FLAG_WAS_WIZ, object_set_flag_inv(), give::op, and SET_FLAG.
Referenced by cfapi_object_set_property().
Sets the enemy of an object.
op | the object of which to set the enemy |
enemy | the new enemy for op; can be NULL to clear the enemy |
Definition at line 915 of file object.cpp.
References object::count, 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().
void object_set_flag_inv | ( | object * | op, |
int | flag | ||
) |
Activate recursively a flag on an object's inventory
op | object to recurse. Can have an empty inventory. |
flag | flag to set. |
Definition at line 3239 of file object.cpp.
References object_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().
void object_set_msg | ( | object * | op, |
const char * | msg | ||
) |
Set the message field of an object.
op | the object to modify |
msg | the new message to set or NULL to clear |
Definition at line 4811 of file object.cpp.
References add_string(), free_string(), navar-midane_pickup::msg, give::op, stringbuffer_append_string(), stringbuffer_finish_shared(), and stringbuffer_new().
Referenced by add_abilities(), adjust_sign_msg(), apply_race_and_class(), cast_create_town_portal(), change_book(), commit_crime(), copy_message(), do_symptoms(), find_or_create_connection_for_map(), key_change_class(), kill_player(), kill_player_not_permadeath(), kill_player_permadeath(), make_formula_book(), place_exits(), place_special_exit(), tailor_readable_ob(), while(), write_mark(), write_note(), and write_rune().
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects.
op | object of which to set the owner |
owner | new owner for object. Can be NULL, in which case it's equivalent of calling object_clear_owner(op) |
Definition at line 840 of file object.cpp.
References object::count, object_clear_owner(), object_get_owner(), 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().
int object_set_value | ( | object * | op, |
const char * | key, | ||
const char * | value, | ||
int | add_key | ||
) |
Updates the key in op to value.
op | object we're considering. |
key | key to set or update. Doesn't need to be a shared string. |
value | value to set. Doesn't need to be a shared string. |
add_key | if 0, will not add the key if it doesn't exist in op. |
Definition at line 4499 of file object.cpp.
References add_string(), FALSE, find_string(), free_string(), 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().
object_split(ob,nr) splits up ob into two parts. The part which is returned contains nr objects, and the remaining parts contains the rest (or is removed and freed if that number is 0). On failure, NULL is returned, and the reason LOG()ed.
This function will send an update to the client if the remaining object is in a player inventory.
orig_ob | object from which to split. |
nr | number of elements to split. |
err | buffer that will contain failure reason if NULL is returned. Can be NULL. |
size | err's size |
Definition at line 2637 of file object.cpp.
References FLAG_REMOVED, FREE_OBJ_FREE_INVENTORY, llevDebug, LOG(), MAX, object::name, 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().
void object_sub_weight | ( | object * | op, |
signed long | weight | ||
) |
Recursively (outwards) subtracts a number from the weight of an object (and what is carried by it's environment(s)).
Takes into account the container's weight reduction.
op | object to which weight is substracted. |
weight | weight to remove. |
Definition at line 1807 of file object.cpp.
References CONTAINER, and give::op.
Referenced by make_item_from_recipe(), object_decrease_nrof(), object_increase_nrof(), object_remove(), and START_TEST().
signed long object_sum_weight | ( | object * | op | ) |
object_sum_weight() is a recursive function which calculates the weight an object is carrying. It goes through in figures out how much containers are carrying, and sums it up.
This takes into account the container's weight reduction.
op | object we want the weight of. |
Definition at line 568 of file object.cpp.
References 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().
void object_unset_flag_inv | ( | object * | op, |
int | flag | ||
) |
Desactivate recursively a flag on an object inventory
op | object to recurse. Can have an empty inventory. |
flag | flag to unset. |
Definition at line 3256 of file object.cpp.
References 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().
void object_update | ( | object * | op, |
int | action | ||
) |
object_update() updates the array which represents the map.
It takes into account invisible objects (and represent squares covered by invisible objects by whatever is below them (unless it's another invisible object, etc...)
If the object being updated is beneath a player, the look-window of that player is updated (this might be a suboptimal way of updating that window, though, since object_update() is called often)
op | object to update |
action | Hint of what the caller believes need to be done. One of UP_OBJ_xxx values. For example, if the only thing that has changed is the face (due to an animation), we don't need to call update_position until that actually comes into view of a player. OTOH, many other things, like addition/removal of walls or living creatures may need us to update the flags now. |
Definition at line 1434 of file object.cpp.
References 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().
void object_update_speed | ( | object * | op | ) |
Updates the speed of an object. If the speed changes from 0 to another value, or vice versa, then add/remove the object from the active list. This function needs to be called whenever the speed of an object changes.
op | object to update. Must not be freed and still have a speed. |
Definition at line 1349 of file object.cpp.
References active_objects, FABS, FLAG_FREED, llevError, LOG(), MIN_ACTIVE_SPEED, object_remove_from_active_list(), give::op, and QUERY_FLAG.
Referenced by add_abilities(), add_force(), animate_weapon(), apply_auto_fix(), apply_savebed(), cast_detection(), cast_word_of_recall(), cfapi_object_set_property(), check_loaded_object(), check_login(), check_trigger(), command_remove(), do_auto_apply(), do_mood_floor(), do_throw(), drain_wand_charge(), eat_special_food(), enter_exit(), find_or_create_connection_for_map(), fire_bow(), fix_object(), fix_stopped_arrow(), gate_type_process(), kill_object(), local_check_loaded_object(), move_cone(), move_detector(), move_hole(), move_player_mover(), object_copy(), object_free(), place_fountain_with_specials(), power_crystal_type_apply(), process_events(), recharge(), remove_door(), remove_locked_door(), setup(), START_TEST(), swap_random_stats(), timed_gate_type_process(), transmute_item_to_flower(), trigger_connected(), trigger_move(), and while().
void object_update_turn_face | ( | object * | op | ) |
If an object with the IS_TURNABLE() flag needs to be turned due to the closest player being on the other side, this function can be called to update the face variable, and how it looks on the map.
op | object to update. |
Definition at line 1332 of file object.cpp.
References animate_object(), 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().
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().
Determine if an extra value is set to a non empty or 0 value.
op | object which may contain the value. |
key | value to search for, must be a shared string. |
Definition at line 4390 of file object.cpp.
References castle_read::key, and give::op.
Referenced by update_position().
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
op1 | first object. |
op2 | second object. |
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().
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.
altar | item to which there is a sacrifice |
sacrifice | object that may be sacrifed |
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().
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.
m | map to consider. Must not be NULL. |
x | |
y | coordinates. |
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().
char* path_combine | ( | const char * | src, |
const char * | dst, | ||
char * | path, | ||
size_t | size | ||
) |
Combines 2 paths, which can be relative.
src | path we're starting from. |
dst | path we're doing to. |
path | buffer containing the combined path. |
size | size of path. |
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 | ) |
Returns the player's own title. The returned value must not be modified and points into the player structure.
pl | the player |
Definition at line 260 of file player.cpp.
References altar_valkyrie::pl.
Referenced by save_player().
void player_get_title | ( | const struct player * | pl, |
char * | buf, | ||
size_t | bufsize | ||
) |
int player_has_own_title | ( | const struct player * | pl | ) |
Returns whether the player has a custom title.
pl | the player to check |
Definition at line 247 of file player.cpp.
References altar_valkyrie::pl.
Referenced by command_title(), and save_player().
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.
who | player, must not be NULL. |
op | what 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().
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.
pl | the player to update |
level | the dragon's current level |
attack | the dragon's current attack focus |
skin_resist | the dragon's skin resistance for attack |
Definition at line 202 of file player.cpp.
References altar_valkyrie::pl.
Referenced by set_dragon_name().
void player_set_own_title | ( | struct player * | pl, |
const char * | title | ||
) |
Sets the custom title.
pl | the player to modify |
title | the 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().
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.
op | DM asking for information. |
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().
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().
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...
op | object 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().
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.
op | item we want the name of. |
plural | whether to get the singular or plural name |
buf | buffer that will contain the object's name. Must not be NULL. |
size | buffer'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().
void query_name | ( | const object * | op, |
char * | buf, | ||
size_t | size | ||
) |
Describes an item.
op | item to describe. Must not be NULL. |
buf | buffer that will contain the description. |
size | size 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().
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.)
op | object to describe. |
buf | buffer which will contain the name. Must not be NULL. |
size | buffer 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().
void query_weight | ( | const object * | op, |
char * | buf, | ||
size_t | size | ||
) |
Formats the item's weight.
op | object we want the weight of. | |
[out] | buf | buffer to write to. |
size | buffer size. |
Definition at line 415 of file item.cpp.
References buf, NROF(), and give::op.
Referenced by inventory().
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().
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().
const char* re_cmp | ( | const char * | , |
const char * | |||
) |
re-cmp - get regular expression match.
str | string that will be matched against the regexp. |
regexp | regular expression. |
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().
mapstruct* ready_map_name | ( | const char * | name, |
int | flags | ||
) |
Makes sure the given map is loaded and swapped in.
name | path name of the map. |
flags |
|
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().
const char* recipe_get_difficulty_string | ( | int | difficulty | ) |
A method to produce a difficulty adjective to describe alchemy projects.
difficulty | the base difficulty of the recipe |
Definition at line 962 of file recipe.cpp.
Referenced by knowledge_alchemy_detail(), and make_formula_book().
Return the best face associated with a recipe.
rp | recipe to get the face of. |
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().
Checks if a region is a child of another.
child | region we want to test. |
r | potential parent. |
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().
void register_apply | ( | int | ob_type, |
apply_func | method | ||
) |
Registers the apply method for the given type.
ob_type | The type of object to register this method to |
method | The method to link |
Definition at line 62 of file ob_types.cpp.
References ob_methods::apply, and type_methods.
Referenced by init_type_armour_improver(), init_type_book(), init_type_cf_handle(), init_type_clock(), init_type_converter(), init_type_dragon_focus(), init_type_exit(), init_type_food(), init_type_lamp(), init_type_lightable(), init_type_lighter(), init_type_mimic(), init_type_poison(), init_type_potion(), init_type_power_crystal(), init_type_savebed(), init_type_scroll(), init_type_shop_inventory(), init_type_sign(), init_type_skillscroll(), init_type_spellbook(), init_type_transport(), init_type_treasure(), init_type_trigger(), and init_type_weapon_improver().
void register_describe | ( | int | ob_type, |
describe_func | method | ||
) |
Registers the describe method for the given type.
ob_type | The type of object to register this method to |
method | The 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().
void register_move_on | ( | int | ob_type, |
move_on_func | method | ||
) |
Registers the move_on method for the given type.
ob_type | The type of object to register this method to |
method | The method to link |
Definition at line 89 of file ob_types.cpp.
References ob_methods::move_on, and type_methods.
Referenced by init_type_altar(), init_type_arrow(), init_type_button(), init_type_check_inv(), init_type_container(), init_type_converter(), init_type_deep_swamp(), init_type_director(), init_type_exit(), init_type_hole(), init_type_identify_altar(), init_type_pedestal(), init_type_player_mover(), init_type_rune(), init_type_shop_mat(), init_type_sign(), init_type_spell_effect(), init_type_spinner(), init_type_thrown_object(), init_type_trap(), init_type_trapdoor(), init_type_trigger_altar(), init_type_trigger_button(), and init_type_trigger_pedestal().
void register_process | ( | int | ob_type, |
process_func | method | ||
) |
Registers the process method for the given type.
ob_type | The type of object to register this method to |
method | The 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().
void register_trigger | ( | int | ob_type, |
trigger_func | method | ||
) |
Registers the trigger method for the given type.
ob_type | The type of object to register this method to |
method | The 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().
void remove_button_link | ( | object * | op | ) |
Remove the object from the linked lists of buttons in the map. This is only needed by editors.
op | object 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().
int remove_depletion | ( | object * | op, |
int | level | ||
) |
Remove depletion from op, if present, and warn player of such restorations.
op | who to remove depletion from. |
level | maximum depletion level to remove, if -1 no maximum. |
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().
void remove_directory | ( | const char * | path | ) |
This function removes everything in the directory, and the directory itself.
Errors are LOG() to error level.
path | directory to remove. |
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().
void remove_friendly_object | ( | object * | op | ) |
Removes the specified object from the linked list of friendly objects.
op | object 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().
void remove_statbonus | ( | object * | op | ) |
Subtracts stat-bonuses given by the class which the player has chosen.
op | object 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().
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().
void replace_unprintable_chars | ( | char * | buf | ) |
Replaces any unprintable character in the given buffer with a space.
buf | the 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().
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().
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().
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)
m | map to save. |
flag | One of SAVE_MODE_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().
int save_object | ( | FILE * | fp, |
object * | op, | ||
int | flag | ||
) |
Dumps all variables in an object to a file.
fp | file to write to. |
op | object to save. |
flag | combination of SAVE_FLAG_xxx flags. |
Definition at line 5397 of file object.cpp.
References give::op, SAVE_ERROR_OK, SAVE_ERROR_WRITE, save_object_in_sb(), stringbuffer_finish(), and stringbuffer_new().
Referenced by save_player().
void save_object_in_sb | ( | StringBuffer * | sb, |
object * | op, | ||
const int | flag | ||
) |
Store a string representation of op in sb. Suitable for saving an object to a file.
Definition at line 5311 of file object.cpp.
References ADD_STRINGLINE_ENTRY(), arch_to_object(), archetype::clone, empty_archetype, FAST_SAVE_LONG(), find_archetype(), find_artifact(), FLAG_NO_SAVE, FLAG_UNPAID, FOR_INV_FINISH, FOR_INV_PREPARE, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, get_ob_diff(), give_artifact_abilities(), living::grace, living::hp, artifact::item, llevError, LOG(), archetype::name, object_free(), object_get_owner(), give::op, QUERY_FLAG, archetype::reference_count, SAVE_FLAG_SAVE_UNPAID, save_object_in_sb(), living::sp, object::stats, stringbuffer_append_string(), Ice::tmp, object::x, and object::y.
Referenced by save_object(), save_object_in_sb(), and save_objects().
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().
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
op | object we're modifying. |
magic | magic 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().
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).
stats | item to modify. Must not be NULL. |
attr | attribute to change. |
value | new value. |
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().
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'.
pl | player's object to change. |
abil | dragon's innate abilities. |
skin | dragon'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().
void set_map_reset_time | ( | mapstruct * | map | ) |
Updates the map's timeout.
map | map 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().
void set_materialname | ( | object * | op | ) |
Set the material name and type for an item, if not set.
op | item 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().
void set_tick_duration | ( | long | t | ) |
Sets the tick duration. Can be called by a DM through the speed command.
t | new duration. |
Definition at line 209 of file time.cpp.
References Floor::t, and tick_duration.
Referenced by command_speed().
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.
op | object to alter. |
buf | modifications to apply. |
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().
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().
op | victim to alter. |
exp | experience to gain (positive) or lose (negative). |
skill | skill to change. Can be NULL. |
flag |
|
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().
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.
str | the string to be split; will be modified |
array | the string array; will be filled with pointers into str |
array_size | the number of elements in array; if str contains more fields excess fields are not split but included into the last element |
sep | separator to use. |
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().
void stringbuffer_append_multiline_block | ( | StringBuffer * | sb, |
const char * | start, | ||
const char * | content, | ||
const char * | end | ||
) |
Definition at line 196 of file stringbuffer.cpp.
void stringbuffer_append_printf | ( | StringBuffer * | sb, |
const char * | format, | ||
... | |||
) |
Definition at line 138 of file stringbuffer.cpp.
void stringbuffer_append_string | ( | StringBuffer * | sb, |
const char * | str | ||
) |
Definition at line 95 of file stringbuffer.cpp.
void stringbuffer_append_stringbuffer | ( | StringBuffer * | sb, |
const StringBuffer * | sb2 | ||
) |
Definition at line 165 of file stringbuffer.cpp.
void stringbuffer_delete | ( | StringBuffer * | sb | ) |
Definition at line 71 of file stringbuffer.cpp.
char* stringbuffer_finish | ( | StringBuffer * | sb | ) |
Definition at line 76 of file stringbuffer.cpp.
sstring stringbuffer_finish_shared | ( | StringBuffer * | sb | ) |
Definition at line 85 of file stringbuffer.cpp.
size_t stringbuffer_length | ( | StringBuffer * | sb | ) |
Definition at line 218 of file stringbuffer.cpp.
StringBuffer* stringbuffer_new | ( | void | ) |
Definition at line 57 of file stringbuffer.cpp.
void strip_endline | ( | char * | buf | ) |
Removes endline from buffer (modified in place).
Definition at line 314 of file utils.cpp.
Referenced by parse_shop_string(), and send_news().
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).
buf | buffer we want to convert. Can contain an initial number. |
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().
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.
buf1 | buffer to split. |
buf2 | what to split buf1 by. |
retbuf | where to write the resulting string. |
size | length of retbuf. |
Definition at line 684 of file readable.cpp.
References buf, MAX_BUF, nstrtok(), strlcpy(), and trim().
Referenced by describe_god().
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 s@as tro.p su.e du
book | the object we are creating into. Must be a book, can have a level. |
msg_type | if 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().
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.
dir | Directory where to create the file. Can be NULL, in which case NULL is returned. |
pfx | Prefix to create unique name. Can be NULL. |
filename | This 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. |
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().
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().
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().
const char* time_format_time | ( | const timeofday_t * | tod, |
char * | buf, | ||
size_t | bufsize | ||
) |
Formats a timestamp in Crossfire time.
tod | the timestamp to format |
buf | the buffer to fill |
bufsize | the size of buf in bytes |
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().
void time_info | ( | object * | op | ) |
Players wants to know the time. Called through the 'time' command.
op | player 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().
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().
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().
void treasure_free | ( | treasure * | t | ) |
Frees a treasure, including its yes, no and next items.
t | treasure 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().
treasure* treasure_insert | ( | treasurelist * | list, |
int | position | ||
) |
Insert a new treasure in the treasure list, at a specific position in the children list.
list | list to insert the new treasure into. |
position | if less than the number of items then before this item, else at end of list. |
Definition at line 1428 of file treasure.cpp.
References get_empty_treasure(), guildoracle::list, and treasure::next.
Referenced by TreasureListWrapper::drop(), and START_TEST().
void treasure_remove_item | ( | treasurelist * | list, |
int | position | ||
) |
Remove the treasure at the specified position from the list.
list | list to remove the treasure from. |
position | index 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().
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)
ol | the objectlink to trigger. This can be acquire from map |
cause | the object that cause this path to trigger, may be NULL |
state | which 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().
Animations* try_find_animation | ( | const char * | name | ) |
Definition at line 278 of file assets.cpp.
References AssetsManager::animations(), AssetsCollection< T, Key >::find(), manager, and give::name.
Referenced by add_abilities(), apply_anim_suffix(), apply_changes_to_player(), cfapi_object_set_property(), cfapi_system_find_animation(), move_aura(), object_give_identified_properties(), and write_rune().
archetype* try_find_archetype | ( | const char * | name | ) |
Definition at line 270 of file assets.cpp.
References AssetsManager::archetypes(), AssetsCollection< T, Key >::find(), manager, and give::name.
Referenced by alchemy_object(), annotate_ob(), artifact_describe(), artifact_get_face(), cast_consecrate(), cast_create_missile(), cast_heal(), cfapi_map_find_by_archetype_name(), cfapi_object_create(), cfapi_object_find_archetype_inside(), check_formulae(), check_probe(), check_recipe(), command_create(), create_archetype(), create_player_cmd(), do_artifact(), do_harvest(), do_test(), dump_alchemy(), dump_alchemy_costs(), fix_walls(), get_npc(), knowledge_alchemy_can_use_item(), knowledge_alchemy_detail(), knowledge_alchemy_summary(), knowledge_god_face(), knowledge_monster_detail(), knowledge_monster_face(), knowledge_monster_summary(), knowledge_monster_validate(), magic_wall(), perceive_self(), pick_joined_wall(), place_exits(), put_a_monster(), recipe_get_face(), retrofit_joined_wall(), send_arch_info(), send_class_info(), send_race_info(), and town_portal_destroy_existing().
Definition at line 286 of file assets.cpp.
References report::error(), AssetsManager::faces(), AssetsCollection< T, Key >::find(), is_valid_types_gen::found, manager, and give::name.
Referenced by add_abilities(), cfapi_object_set_property(), cfapi_system_find_face(), fix_flesh_item(), knowledge_process_incremental(), knowledge_send_info(), object_give_identified_properties(), send_account_players(), set_object_face_main(), set_object_face_other(), transport_type_apply(), and write_rune().
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.
map | map that changed. |
x | |
y | coordinates of the change. |
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().
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
map | map 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().
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.
op | object 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().
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().
void update_los | ( | object * | op | ) |
Recalculates the array which specifies what is visible for the given player-object.
op | player'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().
void update_position | ( | mapstruct * | m, |
int | x, | ||
int | y | ||
) |
This function updates various attributes about a specific space on the map (what it looks like, whether it blocks magic, has a living creatures, prevents people from passing through, etc)
m | map considered |
x | |
y | coordinates to update |
Definition at line 2118 of file map.cpp.
References add_face_layer(), blank_face, blocks_prayer, FLAG_ALIVE, FLAG_BLOCKSVIEW, FLAG_DAMNED, FLAG_IS_FLOOR, FLAG_MONSTER, FLAG_NO_MAGIC, FLAG_NO_PICK, FLAG_WIZ, flags, FOR_MAP_FINISH, FOR_MAP_PREPARE, GET_MAP_FACE_OBJS, GET_MAP_FLAGS, Map_Layer_Info::high_layer, Map_Layer_Info::honor_visibility, llevDebug, llevError, LOG(), m, MAP_LAYER_FLOOR, MAP_LAYER_FLY1, MAP_LAYER_FLY2, map_layer_info, MAP_LAYER_ITEM1, MAP_LAYER_ITEM3, MAP_LAYER_LIVING1, MAP_LAYER_LIVING2, MAP_LAYER_NO_PICK1, MAP_LAYER_NO_PICK2, MAP_LAYERS, MOVE_FLYING, object_value_set_shared(), P_BLOCKSVIEW, P_IS_ALIVE, P_NEED_UPDATE, P_NO_CLERIC, P_NO_ERROR, P_NO_MAGIC, P_PLAYER, PLAYER, QUERY_FLAG, SET_MAP_FLAGS, SET_MAP_LIGHT, SET_MAP_MOVE_BLOCK, SET_MAP_MOVE_OFF, SET_MAP_MOVE_ON, SET_MAP_MOVE_SLOW, SET_MAP_PLAYER, Ice::tmp, diamondslots::x, and diamondslots::y.
Referenced by cfapi_map_update_position(), cfapi_object_set_property(), do_turn(), draw_client_map(), object_insert_in_ob(), object_remove(), and object_update().
void use_trigger | ( | object * | op | ) |
Toggles the state of specified button.
op | object 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().
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().
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().
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().
void yyfree | ( | void * | ptr | ) |
Definition at line 38872 of file loader.cpp.
Referenced by yy_delete_buffer(), and yylex_destroy().
int yyget_debug | ( | void | ) |
Definition at line 38761 of file loader.cpp.
References yy_flex_debug.
FILE* yyget_in | ( | void | ) |
int yyget_lineno | ( | void | ) |
FILE* yyget_out | ( | void | ) |
char* yyget_text | ( | void | ) |
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().
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().
void yyrestart | ( | FILE * | input_file | ) |
Immediately switch to a different input stream.
input_file | A readable stream. |
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().
void yyset_debug | ( | int | bdebug | ) |
Definition at line 38766 of file loader.cpp.
References yy_flex_debug.
void yyset_in | ( | FILE * | _in_str | ) |
Set the input stream. This does not discard the current input buffer.
_in_str | A readable stream. |
Definition at line 38751 of file loader.cpp.
References yyin.
void yyset_lineno | ( | int | _line_number | ) |
Set the current line number.
_line_number | line number |
Definition at line 38739 of file loader.cpp.
References yylineno.
void yyset_out | ( | FILE * | out_str | ) |
Definition at line 38756 of file loader.cpp.
References yyout.