Crossfire Server, Branches 1.12
R18729
|
Go to the source code of this file.
Functions | |
int | absdir (int d) |
void | add_abilities (object *op, object *change) |
void | add_button_link (object *button, mapstruct *map, int connected) |
void | add_friendly_object (object *op) |
sstring | add_refcount (sstring str) |
void | add_statbonus (object *op) |
sstring | add_string (const char *str) |
void | add_weight (object *op, signed long weight) |
int | allowed_class (const object *op) |
void | animate_object (object *op, int dir) |
void | animate_turning (object *op) |
void | apply_anim_suffix (object *who, sstring suffix) |
void | apply_death_exp_penalty (object *op) |
void | arch_info (object *op) |
object * | arch_to_object (archetype *at) |
int | atnr_is_dragon_enabled (int attacknr) |
void | bitstostring (long bits, int num, char *str) |
int | blocked_link (object *ob, mapstruct *m, int sx, int sy) |
int | book_overflow (const char *buf1, const char *buf2, size_t booksize) |
int | buf_overflow (const char *buf1, const char *buf2, size_t bufsize) |
int | calc_item_power (const object *op, int flag) |
void | calc_perm_exp (object *op) |
int | calculate_difficulty (mapstruct *m) |
int | can_merge (object *ob1, object *ob2) |
int | can_pick (const object *who, const object *item) |
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, sint8 value) |
void | change_exp (object *op, sint64 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) |
sint64 | check_exp_adjust (const object *op, sint64 exp) |
sint64 | check_exp_loss (const object *op, sint64 exp) |
void | check_generators (void) |
void | check_inv (object *op, object *trig) |
object * | check_inv_recursive (object *op, const object *trig) |
int | check_move_on (object *op, object *originator) |
int | check_path (const char *name, int prepend_dir) |
void | check_stat_bounds (living *stats) |
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_archetable (void) |
void | clear_los (object *op) |
void | clear_object (object *op) |
void | clear_owner (object *op) |
void | clear_player (player *pl) |
void | close_and_delete (FILE *fp, int compressed) |
void | copy_object (object *op2, object *op) |
void | copy_object_with_inv (object *src_ob, object *dest_ob) |
void | copy_owner (object *op, object *clone) |
int | count_active (void) |
int | count_free (void) |
int | count_used (void) |
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) |
object * | decrease_ob_nr (object *op, uint32 i) |
void | delete_map (mapstruct *m) |
void | describe_item (const object *op, const object *owner, char *retbuf, size_t size) |
void | describe_monster (const object *op, char *retbuf, size_t size) |
void | describe_resistance (const object *op, int newline, char *buf, size_t size) |
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) |
int | distance (const object *ob1, const object *ob2) |
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_all_objects (void) |
void | dump_arch (archetype *at, StringBuffer *sb) |
void | dump_artifacts (void) |
void | dump_experience (void) |
void | dump_friendly_objects (void) |
void | dump_gods (void) |
void | dump_map (const mapstruct *m) |
void | dump_monster_treasure (const char *name) |
void | dump_object (object *op, StringBuffer *sb) |
int | enough_elapsed_time (void) |
void | fatal (int err) |
int | 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) |
artifactlist * | find_artifactlist (int type) |
int | find_dir (mapstruct *m, int x, int y, object *exclude) |
int | find_dir_2 (int x, int y) |
unsigned | find_face (const char *name, unsigned error) |
int | find_first_free_spot (const object *ob, mapstruct *m, int x, int y) |
int | find_free_spot (const object *ob, mapstruct *m, int x, int y, int start, int stop) |
int | find_multi_free_spot_around (object *ob, object *gen, int *hx, int *hy) |
int | find_multi_free_spot_within_radius (object *ob, object *gen, int *hx, int *hy) |
object * | find_obj_by_type_subtype (const object *who, int type, int subtype) |
object * | find_object (tag_t i) |
object * | find_object_name (const char *str) |
int | find_smooth (uint16 face, uint16 *smoothed) |
sstring | find_string (const char *str) |
archetype * | find_treasure_by_name (const treasure *t, const char *name, int depth) |
treasurelist * | find_treasurelist (const char *name) |
void | fix_container (object *container) |
void | fix_generated_item (object *op, object *creator, int difficulty, int max_magic, int flags) |
void | fix_multipart_object (object *tmp) |
void | fix_object (object *op) |
void | flag_inv (object *op, int flag) |
void | free_all_anim (void) |
void | free_all_archs (void) |
void | free_all_god (void) |
void | free_all_images (void) |
void | free_all_maps (void) |
void | free_all_object_data (void) |
void | free_all_readable (void) |
void | free_all_recipes (void) |
void | free_all_treasures (void) |
void | free_arch (archetype *at) |
void | free_dialog_information (object *op) |
void | free_experience (void) |
void | free_globals (void) |
void | free_key_values (object *op) |
void | free_loader (void) |
void | free_map (mapstruct *m) |
void | free_object (object *ob) |
void | free_object2 (object *ob, int free_inventory) |
void | free_objectlink (objectlink *ol) |
void | free_objectlinkpt (oblinkpt *obp) |
void | free_player (player *pl) |
void | free_socket_images (void) |
void | free_string (sstring str) |
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) |
sint8 | get_attr_value (const living *stats, int attr) |
int | get_button_value (const object *button) |
client_spell * | get_client_spell_state (player *pl, object *spell) |
int | get_dialog_message (object *op, const char *text, struct_dialog_message **message, struct_dialog_reply **reply) |
mapstruct * | get_empty_map (int sizex, int sizey) |
int | get_face_fallback (int faceset, int imageno) |
recipelist * | get_formulalist (int i) |
object * | get_jail_exit (object *op) |
int | get_language (object *op) |
void | get_levelnumber (int i, char *buf, size_t size) |
mapstruct * | get_linked_map (void) |
int | get_map_flags (mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny) |
mapstruct * | get_map_from_coord (mapstruct *m, sint16 *x, sint16 *y) |
const char * | get_month_name (const int index) |
void | get_multi_size (object *ob, int *sx, int *sy, int *hx, int *hy) |
const char * | get_name_of_region_for_map (const mapstruct *m) |
void | get_ob_diff (StringBuffer *sb, object *op, object *op2) |
key_value * | get_ob_key_link (const object *ob, const char *key) |
const char * | get_ob_key_value (const object *op, const char *const key) |
object * | get_object (void) |
objectlink * | get_objectlink (void) |
oblinkpt * | get_objectlinkpt (void) |
object * | get_owner (object *op) |
const char * | get_periodofday (const int index) |
object * | get_player_container (object *op) |
int | get_power_from_ench (int ench) |
godlink * | get_rand_god (void) |
object * | get_random_mon (int level) |
recipe * | get_random_recipe (recipelist *rpl) |
void | get_rangevector (object *op1, const object *op2, rv_vector *retval, int flags) |
void | get_rangevector_from_mapcoord (const mapstruct *m, int x, int y, const object *op2, rv_vector *retval, int flags) |
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) |
object * | get_split_ob (object *orig_ob, uint32 nr, char *err, size_t size) |
void | get_tod (timeofday_t *tod) |
const typedata * | get_typedata (int itemtype) |
const typedata * | get_typedata_by_name (const char *name) |
const char * | get_weekday (const int index) |
void | give_artifact_abilities (object *op, 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) |
void | i18n_init (void) |
const char * | i18n_translate (int language, int id) |
void | identify (object *op) |
void | init_anim (void) |
void | init_archetype_pointers (void) |
void | init_archetypes (void) |
void | init_artifacts (void) |
void | init_block (void) |
void | init_experience (void) |
void | init_formulae (void) |
void | init_globals (void) |
void | init_gods (void) |
void | init_hash_table (void) |
void | init_library (void) |
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 (void) |
void | init_vars (void) |
object * | insert_ob_in_map (object *op, mapstruct *m, object *originator, int flag) |
object * | insert_ob_in_map_at (object *op, mapstruct *m, object *originator, int flag, int x, int y) |
object * | insert_ob_in_ob (object *op, object *where) |
int | is_dragon_pl (const object *op) |
int | is_friendly (const object *op) |
int | is_magical (const object *op) |
int | is_old_wraith_pl (object *op) |
int | is_valid_faceset (int fsn) |
int | is_wraith_pl (object *op) |
int | isqrt (int n) |
int | item_matched_string (object *pl, object *op, const char *name) |
int | legal_artifact_combination (object *op, artifact *art) |
sint64 | level_exp (int level, double expmul) |
int | lex_load (int *depth, object **items, int maxdepth, int map_flags, int linemode) |
int | load_object (FILE *fp, object *op, int bufstate, int map_flags) |
mapstruct * | load_original_map (const char *filename, int flags) |
void | load_treasures (void) |
artifact * | locate_recipe_artifact (const recipe *rp, size_t idx) |
void | LOG (LogLevel logLevel, const char *format,...) |
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) |
void | map_remove_unique_files (const mapstruct *map) |
object * | merge_ob (object *op, object *top) |
void | merge_spell (object *op, sint16 x, sint16 y) |
materialtype_t * | name_to_material (const char *name) |
int | need_identify (const object *op) |
sint64 | new_exp (const object *ob) |
method_ret | ob_apply (object *op, object *applier, int aflags) |
int | ob_blocked (const object *ob, mapstruct *m, sint16 x, sint16 y) |
char * | ob_describe (const object *op, const object *observer, 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) |
object * | object_create_arch (archetype *at) |
object * | object_create_clone (object *asrc) |
object * | object_get_env_recursive (object *op) |
int | on_same_map (const object *op1, const object *op2) |
FILE * | open_and_uncompress (const char *name, int flag, int *compressed) |
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) |
void | player_lvl_adj (object *who, object *op) |
const object * | pntr_to_god_obj (godlink *godlnk) |
object * | present (uint8 type, mapstruct *m, int x, int y) |
object * | present_arch (const archetype *at, mapstruct *m, int x, int y) |
object * | present_arch_in_ob (const archetype *at, const object *op) |
object * | present_in_ob (uint8 type, const object *op) |
object * | present_in_ob_by_name (int type, const char *str, const object *op) |
void | print_los (object *op) |
void | print_monsters (void) |
void | push_button (object *op) |
void | query_base_name (const object *op, int plural, char *buf, size_t size) |
void | query_name (const object *op, char *buf, size_t size) |
int | query_refcount (sstring str) |
void | query_short_name (const object *op, char *buf, size_t size) |
void | query_weight (const object *op, char *buf, size_t size) |
int | random_roll (int min, int max, const object *op, int goodbad) |
sint64 | random_roll64 (sint64 min, sint64 max, const object *op, int goodbad) |
const char * | re_cmp (const char *str, const char *regexp) |
void | read_bmap_names (void) |
void | read_client_images (void) |
int | read_smooth (void) |
mapstruct * | ready_map_name (const char *name, int flags) |
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) |
void | remove_directory (const char *path) |
void | remove_friendly_object (object *op) |
void | remove_from_active_list (object *op) |
void | remove_ob (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_insert_ob_in_map (const char *arch_string, object *op) |
void | replace_unprintable_chars (char *buf) |
void | reset_object (object *op) |
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) |
long | seconds (void) |
void | set_abs_magic (object *op, int magic) |
void | set_attr_value (living *stats, int attr, sint8 value) |
void | set_cheat (object *op) |
void | set_dragon_name (object *pl, const object *abil, const object *skin) |
void | set_map_reset_time (mapstruct *map) |
void | set_materialname (object *op, int difficulty, materialtype_t *nmt) |
void | set_max_time (long t) |
int | set_ob_key_value (object *op, const char *key, const char *value, int add_key) |
void | set_owner (object *op, object *owner) |
int | set_variable (object *op, char *buf) |
void | share_exp (object *op, sint64 exp, const char *skill, int flag) |
void | sleep_delta (void) |
void | ss_dump_statistics (char *buf, size_t size) |
char * | ss_dump_table (int what, char *buf, size_t size) |
const char * | strcasestr_local (const char *s, const char *find) |
char * | strdup_local (const char *str) |
char * | strerror_local (int errnum, char *buf, size_t size) |
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) |
char * | stringbuffer_finish (StringBuffer *sb) |
sstring | stringbuffer_finish_shared (StringBuffer *sb) |
void | stringbuffer_finish_socklist (StringBuffer *sb, SockList *sl) |
StringBuffer * | stringbuffer_new (void) |
void | strip_endline (char *buf) |
void | strip_media_tag (char *message) |
const char * | strrstr (const char *haystack, const char *needle) |
int | strtoint (const char *buf) |
void | sub_weight (object *op, signed long weight) |
signed long | sum_weight (object *op) |
void | tailor_readable_ob (object *book, int msg_type) |
char * | tempnam_local (const char *dir, const char *pfx) |
FILE * | tempnam_secure (const char *dir, const char *pfx, char **filename) |
void | time_info (object *op) |
void | transmute_materialname (object *op, const object *change) |
void | trigger_connected (objectlink *ol, object *cause, const int state) |
int | try_find_animation (const char *name) |
archetype * | try_find_archetype (const char *name) |
void | unflag_inv (object *op, int flag) |
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_ob_speed (object *op) |
void | update_object (object *op, int action) |
void | update_position (mapstruct *m, int x, int y) |
void | update_turn_face (object *op) |
void | use_trigger (object *op) |
void | verify_button_links (const mapstruct *map) |
void | write_book_archive (void) |
void | write_todclock (void) |
void | yyfree (void *ptr) |
int | yyget_debug (void) |
FILE * | yyget_in (void) |
int | yyget_leng (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 3417 of file object.c.
Referenced by check_spell_knockback(), common_process_projectile(), compute_path(), dist_att(), disthit_att(), fire_bolt(), fire_bullet(), flee_player(), forklightning(), hitrun_att(), monster_cast_spell(), monster_use_bow(), monster_use_range(), monster_use_scroll(), monster_use_skill(), move_ball_spell(), move_bolt(), move_bullet(), move_cone(), move_monster(), move_player(), move_swarm_spell(), path_to_player(), pet_move(), player_fire_bow(), pray_at_altar(), run_att(), spinner_type_move_on(), summon_object(), turn_transport(), wait_att(), and wait_att2().
Used in artifact generation. The bonuses of the first object is modified by the bonuses of the second object.
Definition at line 1653 of file treasure.c.
References liv::ac, add_refcount(), animate_object(), obj::animation_id, arch_to_object(), obj::attacktype, obj::below, blank_face, change_attr_value(), CLEAR_FLAG, copy_object(), liv::dam, liv::exp, obj::face, obj::facing, FLAG_ALIVE, FLAG_ANIMATE, FLAG_BLIND, FLAG_CURSED, FLAG_DAMNED, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STAND_STILL, FLAG_STEALTH, FLAG_XRAYS, liv::food, free_object(), free_string(), obj::gen_sp_armour, get_attr_value(), get_object(), HORN, liv::hp, insert_ob_in_ob(), obj::inv, obj::item_power, obj::last_sp, obj::level, llevDebug, LOG(), liv::luck, obj::magic, obj::material, obj::materialname, liv::maxhp, liv::maxsp, obj::move_type, obj::msg, obj::nrof, NROFATTACKS, NUM_STATS, new_face_struct::number, obj::other_arch, obj::path_attuned, obj::path_denied, obj::path_repelled, POTION, QUERY_FLAG, obj::race, remove_ob(), obj::resist, set_abs_magic(), SET_FLAG, obj::slaying, liv::sp, obj::speed, obj::stats, obj::type, update_ob_speed(), obj::value, liv::wc, and obj::weight.
Referenced by artifact_msg(), and give_artifact_abilities().
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 663 of file button.c.
References mapdef::buttons, obj::count, FLAG_IS_LINKED, free_objectlink(), get_objectlink(), get_objectlinkpt(), oblnk::id, oblinkpt::link, llevError, LOG(), oblnk::next, oblinkpt::next, oblnk::ob, SET_FLAG, and oblinkpt::value.
Referenced by apply_builder_item(), and include_map_in_map().
void add_friendly_object | ( | object * | op | ) |
Add a new friendly object to the linked 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 43 of file friend.c.
References obj::count, first_friendly_object, get_objectlink(), oblnk::id, is_friendly(), llevError, LOG(), obj::name, oblnk::next, and oblnk::ob.
Referenced by add_player(), animate_weapon(), cfapi_object_set_property(), do_mood_floor(), fix_summon_pet(), hit_player(), mood_change(), polymorph_living(), receive_play_again(), summon_golem(), summon_object(), and use_oratory().
This will increase the refcount of the string str.
str | string which *must *have been returned from a previous add_string(). |
Definition at line 202 of file shstr.c.
Referenced by add_abilities(), adjust_sign_msg(), animate_bomb(), attack_ob_simple(), cast_bless(), cast_change_ability(), cast_curse(), cast_invisible(), cone_drop(), copy_object(), do_symptoms(), explode_bullet(), fire_bolt(), fire_bow(), fire_bullet(), fix_object(), hit_with_arrow(), identify(), infect_object(), init_skills(), move_monster(), poison_living(), receive_play_again(), set_ob_key_value_s(), set_spell_skill(), and START_TEST().
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 863 of file living.c.
References obj::arch, liv::Cha, archt::clone, liv::Con, obj::contr, liv::Dex, liv::Int, pl::orig_stats, liv::Pow, obj::stats, liv::Str, and liv::Wis.
Referenced by key_change_class(), and key_roll_stat().
sstring add_string | ( | const char * | str | ) |
This will add 'str' to the hash table. If there's no entry for this string, a copy will be allocated, and a pointer to that is returned.
str | string to share. |
Definition at line 116 of file shstr.c.
References _shared_string::array, GATHER, hashstr(), new_shared_string(), _shared_string::next, _shared_string::previous, _shared_string::refcount, _shared_string::string, TOPBIT, and _shared_string::u.
Referenced by add_author(), add_book_to_list(), add_god_to_list(), add_to_racelist(), adjust_sign_msg(), alchemy_failure_effect(), animate_weapon(), become_follower(), cast_bless(), cast_create_town_portal(), cast_word_of_recall(), cctk_set_object_strings(), cfapi_system_add_string(), change_abil(), change_book(), change_treasure(), check_output_buffers(), command_follow(), command_goto(), command_reset(), command_summon(), command_teleport(), confuse_living(), create_singularity(), determine_god(), do_symptoms(), do_throw(), enter_player_savebed(), enter_random_map(), find_archetype_by_object_name(), find_object_name(), find_or_create_connection_for_map(), fire_bow(), fix_container_multipart(), fix_generated_item(), fix_multipart_object(), fix_stopped_arrow(), get_jail_exit(), get_player(), give_artifact_abilities(), god_enchants_weapon(), grant_immunity(), init_anim(), init_artifacts(), init_book_archive(), init_formulae(), init_globals(), init_msgfile(), init_races(), init_skills(), key_change_class(), keyplace(), kill_player(), load_materials(), load_treasure(), load_treasures(), local_check_loaded_object(), lock_and_hide_doors(), main(), make_formula_book(), move_marker(), new_text_name(), place_chest(), place_exits(), place_fountain_with_specials(), place_special_exit(), receive_play_again(), set_materialname(), set_ob_key_value(), set_ob_key_value_s(), START_TEST(), stringbuffer_finish_shared(), summon_golem(), tailor_god_spell(), tailor_readable_ob(), write_mark(), write_note(), and write_rune().
void add_weight | ( | object * | op, |
signed long | weight | ||
) |
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 2486 of file object.c.
References obj::carrying, CONTAINER, obj::env, obj::stats, liv::Str, and obj::type.
Referenced by increase_ob_nr(), insert_ob_in_ob(), and make_item_from_recipe().
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 1543 of file living.c.
References liv::Cha, liv::Con, liv::Dex, liv::Int, liv::Pow, obj::stats, liv::Str, and liv::Wis.
Referenced by 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, ...)
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. |
Definition at line 186 of file anim.c.
References animate_object(), obj::animation_id, obj::arch, blank_face, CLEAR_FLAG, archt::clone, obj::direction, dump_object(), obj::face, FLAG_ALIVE, obj::head, obj::invisible, llevError, LOG(), obj::more, NUM_ANIMATIONS, NUM_FACINGS, new_face_struct::number, PLAYER, QUERY_FLAG, SET_ANIMATION, SET_FLAG, obj::state, stringbuffer_finish(), stringbuffer_new(), obj::temp_animation_id, obj::type, UP_OBJ_FACE, and update_object().
Referenced by add_abilities(), animate_object(), apply_anim_suffix(), apply_changes_to_player(), dragon_ability_gain(), monster_use_scroll(), move_hole(), move_monster(), move_player(), 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 284 of file button.c.
References NUM_ANIMATIONS, SET_ANIMATION, liv::sp, obj::state, obj::stats, UP_OBJ_FACE, and update_object().
Referenced by legacy_ob_process(), and trigger_connected().
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 289 of file anim.c.
References animate_object(), obj::animation_id, animations, obj::facing, animations_struct::facings, obj::head, obj::last_anim, MAX_BUF, obj::more, animations_struct::name, animations_struct::num_animations, snprintf(), obj::state, obj::temp_anim_speed, obj::temp_animation_id, obj::temp_last_anim, and try_find_animation().
Referenced by attack_ob_simple(), cast_spell(), do_skill(), and player_apply().
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 2073 of file living.c.
References obj::below, check_exp_loss(), Settings::death_penalty_level, Settings::death_penalty_ratio, liv::exp, obj::inv, obj::level, levels, MAX, MIN, player_lvl_adj(), settings, SKILL, obj::stats, and obj::type.
Referenced by kill_player().
void arch_info | ( | object * | op | ) |
Stores debug-information about how efficient the hashtable used for archetypes has been in the static errmsg array.
Definition at line 209 of file arch.c.
References arch_cmp, arch_search, draw_ext_info_format(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DEBUG, and NDI_UNIQUE.
Referenced by command_archs().
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 576 of file arch.c.
References obj::arch, archt::clone, copy_object_with_inv(), get_object(), llevError, LOG(), and warn_archetypes.
Referenced by add_abilities(), animate_bomb(), animate_weapon(), apply_builder_floor(), apply_builder_window(), cast_cause_disease(), cast_cone(), cast_consecrate(), cast_create_town_portal(), cast_destruction(), cast_detection(), cast_light(), cast_polymorph(), cast_raise_dead_spell(), cast_smite_spell(), change_luck(), change_object(), command_create(), cone_drop(), create_all_treasures(), create_archetype(), create_archetype_by_object_name(), create_aura(), create_bomb(), create_one_treasure(), do_turn(), dragon_ability_gain(), drain_specific_stat(), explode_bullet(), fire_arch_from_position(), fire_bolt(), fire_bullet(), fire_swarm(), fix_container_multipart(), fix_multipart_object(), fix_summon_pet(), fix_walls(), generate_monster_arch(), get_player(), get_spell_by_name(), give_skill_by_name(), god_gives_present(), hit_player(), include_map_in_map(), insert_multisquare_ob_in_map(), kill_player(), magic_wall(), make_map_floor(), make_map_walls(), mood_change(), move_aura(), move_ball_spell(), move_symptom(), object_create_arch(), pick_joined_wall(), place_chest(), place_exits(), place_monsters(), poison_living(), print_monsters(), put_a_monster(), put_decor(), put_doors(), put_floor(), remove_door(), remove_locked_door(), replace_insert_ob_in_map(), retrofit_joined_wall(), save_throw_object(), slow_living(), spell_effect(), spring_trap(), START_TEST(), summon_object(), write_mark(), and write_rune().
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 106 of file player.c.
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(), and set_dragon_name().
void bitstostring | ( | long | bits, |
int | num, | ||
char * | str | ||
) |
Writes num ones and zeros to the given string based on the bits variable.
bits | variable to convert to binary string |
num | number of bits to dump. Values above 32 will be ignored. |
str | string to write to. Must be long enough. |
Definition at line 110 of file info.c.
Referenced by print_monsters().
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 373 of file map.c.
References obj::above, CHECK_INV, check_inv_recursive(), obj::contr, DOOR, draw_ext_info(), FLAG_ALIVE, FLAG_WIZ, MapSpace::flags, GET_MAP_MOVE_BLOCK, GET_MAP_OB, obj::head, pl::hidden, obj::last_sp, llevError, LOG(), obj::move_type, obj::msg, MSG_TYPE_ATTACK, MSG_TYPE_ATTACK_NOKEY, NDI_NAVY, NDI_UNIQUE, OB_MOVE_BLOCK, OB_TYPE_MOVE_BLOCK, OUT_OF_REAL_MAP, P_IS_ALIVE, PLAYER, QUERY_FLAG, mapdef::spaces, TRANSPORT, obj::type, and mapdef::width.
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 696 of file readable.c.
References BOOK_BUF, and buf_overflow().
Referenced by artifact_msg(), god_info_msg(), mon_info_msg(), msgfile_msg(), spellpath_msg(), and write_note().
int buf_overflow | ( | const char * | buf1, |
const char * | buf2, | ||
size_t | bufsize | ||
) |
We don't want to exceed the buffer size of buf1 by adding on buf2!
buf1 | |
buf2 | buffers we plan on concatening. Can be NULL. |
bufsize | size of buf1. Can be NULL. |
Definition at line 393 of file shstr.c.
Referenced by book_overflow(), init_msgfile(), and START_TEST().
int calc_item_power | ( | const object * | op, |
int | flag | ||
) |
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. If flag is 1, we return the number of enchantment, and not the the power. This is used in the treasure code.
op | object of which to compute the item_power |
flag | unused |
Definition at line 264 of file item.c.
References AMULET, ARMOUR, obj::attacktype, BOOTS, BRACERS, CLOAK, liv::exp, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_XRAYS, liv::food, get_attr_value(), get_power_from_ench(), GIRDLE, GLOVES, liv::grace, HELMET, liv::hp, liv::luck, obj::magic, NROFATTACKS, NRSPELLPATHS, NUM_STATS, obj::path_attuned, obj::path_denied, obj::path_repelled, QUERY_FLAG, obj::resist, RING, SHIELD, obj::slaying, liv::sp, obj::stats, obj::type, 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 1804 of file living.c.
References liv::exp, MAX_EXPERIENCE, obj::perm_exp, Settings::permanent_exp_ratio, settings, and obj::stats.
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 1917 of file map.c.
References obj::above, archt::clone, liv::exp, FLAG_GENERATOR, FLAG_MONSTER, GENERATE_TYPE, get_archetype_by_type_subtype(), GET_MAP_OB, level_exp(), MAP_DIFFICULTY, MAP_HEIGHT, MAP_WIDTH, QUERY_FLAG, and obj::stats.
Referenced by cfapi_map_get_map_property(), generate_random_map(), and load_original_map().
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 can_merge()
Improvements made with merge: Better checking on potion, and also check weight
ob1 | |
ob2 | objects to try to merge. |
Definition at line 178 of file object.c.
References obj::animation_id, obj::arch, obj::attacktype, can_merge(), obj::client_type, compare_ob_value_lists(), obj::custom_name, FABS, FLAG_ANIMATE, FLAG_APPLIED, FLAG_BEEN_APPLIED, FLAG_IDENTIFIED, obj::flags, obj::inv, obj::item_power, obj::key_values, obj::level, obj::lore, obj::magic, obj::map_layer, obj::materialname, MIN_ACTIVE_SPEED, obj::move_allow, obj::move_block, obj::move_off, obj::move_on, obj::move_slow, obj::move_slow_penalty, obj::move_type, obj::msg, obj::name, obj::nrof, QUERY_FLAG, obj::resist, SCROLL, SET_FLAG, obj::skill, obj::slaying, obj::speed, obj::stats, obj::subtype, obj::title, obj::type, obj::value, and obj::weight.
Referenced by can_merge(), cfapi_object_get_property(), insert_ob_in_map(), insert_ob_in_ob(), local_check_loaded_object(), merge_ob(), 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 3569 of file object.c.
References FLAG_ALIVE, FLAG_NO_PICK, obj::head, obj::invisible, obj::more, PLAYER, QUERY_FLAG, obj::type, and obj::weight.
Referenced by cfapi_object_get_property(), check_pick(), command_take(), do_skill_detect_curse(), do_skill_detect_magic(), esrv_move_object(), monster_can_pick(), and pick_up().
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 3524 of file object.c.
References can_see_monsterP(), freearr_x, freearr_y, get_map_flags(), P_BLOCKSVIEW, P_OUT_OF_MAP, and reduction_dir.
Referenced by can_see_monsterP(), do_skill_ident(), find_nearest_living_creature(), and spell_find_dir().
Permanently alters an object's stats/flags based on another object.
Definition at line 443 of file living.c.
References add_string(), obj::arch, AT_CONFUSION, ATNR_PHYSICAL, obj::attacktype, BOW, change_attr_value(), change_resist_msg, check_move_on(), check_stat_bounds(), CLEAR_FLAG, archt::clone, obj::contr, DIFF_MSG, pl::do_los, draw_ext_info(), draw_ext_info_format(), EXPERIENCE, 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, liv::food, free_string(), gain_msg, get_attr_value(), liv::grace, liv::hp, lose_msg, liv::luck, MOVE_FLY_HIGH, MOVE_FLY_LOW, MOVE_SWIM, obj::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, pl::orig_stats, obj::path_attuned, obj::path_denied, obj::path_repelled, PLAYER, POTION, QUERY_FLAG, obj::race, obj::resist, set_attr_value(), SET_FLAG, SKILL, liv::sp, obj::stats, and obj::type.
Referenced by apply_special(), become_follower(), blind_living(), blindness_type_process(), cast_bless(), cast_change_ability(), cast_curse(), cfapi_object_change_abil(), eat_special_food(), potion_type_apply(), remove_force(), swap_random_stats(), and unapply_special().
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 336 of file living.c.
References CHA, liv::Cha, CON, liv::Con, DEX, liv::Dex, INT, liv::Int, llevError, LOG(), POW, liv::Pow, STR, liv::Str, WIS, and liv::Wis.
Referenced by add_abilities(), alchemy_failure_effect(), apply_changes_to_player(), change_abil(), drain_specific_stat(), fix_object(), and kill_player().
void change_exp | ( | object * | op, |
sint64 | 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 2015 of file living.c.
References add_player_exp(), liv::exp, FABS, FLAG_ALIVE, llevDebug, llevError, LOG(), MAX_BUF, MAX_EXPERIENCE, PLAYER, QUERY_FLAG, query_name(), obj::stats, subtract_player_exp(), and obj::type.
Referenced by attempt_do_alchemy(), book_type_apply(), cfapi_object_change_exp(), cure_disease(), do_harvest(), do_hidden_move(), do_skill(), god_examines_priest(), hit_with_one_attacktype(), pay_for_item(), peacemaker_type_process(), pray_at_altar(), scroll_type_apply(), sell_item(), share_exp(), and spellbook_type_apply().
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 791 of file living.c.
References arch_to_object(), FABS, find_archetype(), FLAG_APPLIED, insert_ob_in_ob(), llevError, LOG(), liv::luck, present_arch_in_ob(), SET_FLAG, and obj::stats.
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 2000 of file map.c.
References mapdef::darkness, ext_info_map(), 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(), 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 355 of file button.c.
References obj::above, ARCH_SACRIFICE, decrease_ob_nr(), FLAG_UNPAID, llevError, LOG(), obj::map, matches_sacrifice(), obj::nrof, NROF_SACRIFICE, mapdef::path, QUERY_FLAG, remove_ob(), and obj::value.
Referenced by identify_altar_type_move_on(), and operate_altar().
sint64 check_exp_adjust | ( | const object * | op, |
sint64 | 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 1937 of file living.c.
References check_exp_loss(), liv::exp, MAX_EXPERIENCE, MIN, and obj::stats.
Referenced by command_addexp().
sint64 check_exp_loss | ( | const object * | op, |
sint64 | 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 to which to substract. |
exp | experience to lose. |
Definition at line 1915 of file living.c.
References liv::exp, obj::perm_exp, PERM_EXP_MAX_LOSS_RATIO, Settings::permanent_exp_ratio, settings, and obj::stats.
Referenced by apply_death_exp_penalty(), check_exp_adjust(), kill_object(), and subtract_player_exp().
void check_generators | ( | void | ) |
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 828 of file button.c.
References check_inv_recursive(), decrease_ob, obj::last_heal, obj::last_sp, PLAYER, obj::type, and use_trigger().
Referenced by cfapi_object_check_inventory(), and 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 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 788 of file button.c.
References obj::arch, obj::below, check_inv_recursive(), liv::hp, obj::inv, archt::name, obj::race, obj::slaying, obj::stats, obj::title, and obj::type.
Referenced by blocked_link(), cast_create_town_portal(), cfapi_object_check_inventory(), check_inv(), and check_inv_recursive().
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. insert_ob_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 2651 of file object.c.
References obj::above, obj::below, obj::count, FABS, find_skill_by_number(), FLAG_IS_HILLY, FLAG_IS_WOODED, FLAG_NO_APPLY, FLAG_NO_PICK, FLAG_WIZPASS, GET_MAP_MOVE_BLOCK, GET_MAP_MOVE_ON, GET_MAP_MOVE_SLOW, GET_MAP_OB, obj::map, obj::move_block, MOVE_FLY_LOW, obj::move_on, obj::move_slow, obj::move_slow_penalty, obj::move_type, MOVE_WALK, ob_move_on(), PLAYER, QUERY_FLAG, SK_CLIMBING, SK_WOODSMAN, obj::speed, obj::speed_left, obj::type, was_destroyed, obj::x, and obj::y.
Referenced by change_abil(), and insert_ob_in_map().
int check_path | ( | const char * | name, |
int | prepend_dir | ||
) |
This function checks if a file with the given path exists.
It tries out all the compression suffixes listed in the uncomp[] array, except for Windows which checks an exact file.
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 216 of file map.c.
References create_pathname(), MAX_BUF, NROF_COMPRESS_METHODS, S_IRGRP, S_IROTH, S_IRUSR, S_ISREG, S_IWGRP, S_IWOTH, S_IWUSR, snprintf(), and uncomp.
Referenced by cfapi_system_check_path(), check_login(), and load_map_header().
void check_stat_bounds | ( | living * | stats | ) |
Ensures that all stats (str/dex/con/wis/cha/int) are within the 1-30 stat limit.
stats | attributes to check. |
Definition at line 404 of file living.c.
References get_attr_value(), MAX_STAT, MIN_STAT, NUM_STATS, and set_attr_value().
Referenced by change_abil(), fix_object(), and kill_player().
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 525 of file button.c.
References obj::above, liv::ac, obj::carrying, obj::head, obj::last_sp, llevDebug, LOG(), obj::move_on, obj::move_type, obj::name, obj::nrof, NUM_ANIMATIONS, operate_altar(), PLAYER, push(), obj::race, SET_ANIMATION, obj::slaying, obj::speed, obj::stats, TRIGGER, TRIGGER_ALTAR, TRIGGER_BUTTON, trigger_move(), TRIGGER_PEDESTAL, obj::type, UP_OBJ_FACE, update_ob_speed(), update_object(), obj::value, liv::wc, and obj::weight.
Referenced by animate_trigger(), cfapi_object_check_trigger(), do_auto_apply(), fix_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 124 of file friend.c.
References first_friendly_object, FLAG_FREED, FLAG_FRIENDLY, llevDebug, LOG(), oblnk::next, and QUERY_FLAG.
Referenced by do_specials().
void clean_object | ( | object * | op | ) |
Remove and free all objects in the inventory of the given object.
op | object to clean. |
Definition at line 1640 of file map.c.
References obj::below, clean_object(), FLAG_IS_LINKED, free_object(), obj::inv, QUERY_FLAG, remove_button_link(), and remove_ob().
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 1959 of file map.c.
References mapdef::tmpname, and unlink.
Referenced by clean_tmp_files(), flush_old_maps(), and ready_map_name().
void clear_archetable | ( | void | ) |
Initialise the hashtable used by the archetypes.
Definition at line 219 of file arch.c.
References ARCHTABLE.
Referenced by free_all_archs(), load_archetypes(), and START_TEST().
void clear_los | ( | object * | op | ) |
Clears/initialises the los-array associated to the player controlling the object.
op | player's object. |
Definition at line 258 of file los.c.
References pl::blocked_los, obj::contr, MAP_CLIENT_X, and MAP_CLIENT_Y.
Referenced by do_wizard_dm(), get_player(), and update_los().
void clear_object | ( | 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 688 of file object.c.
References obj::above, obj::active_next, obj::active_prev, obj::attacked_by_count, obj::below, blank_face, obj::casting_time, Settings::casting_time, obj::container, obj::contr, obj::discrete_damage, obj::env, obj::expmul, obj::face, FLAG_FRIENDLY, FLAG_REMOVED, FREE_AND_CLEAR, FREE_AND_CLEAR_STR, free_dialog_information(), free_key_values(), obj::head, obj::inv, obj::lore, obj::map, obj::materialname, obj::more, obj::msg, obj::name, obj::name_pl, offsetof, QUERY_FLAG, obj::race, remove_friendly_object(), SET_FLAG, settings, obj::skill, obj::slaying, and obj::title.
Referenced by cfapi_object_clear(), first_arch_pass(), get_archetype_struct(), get_object(), reset_object(), and START_TEST().
void 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 544 of file object.c.
References obj::owner, and obj::ownercount.
Referenced by set_owner(), START_TEST(), and stop_projectile().
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 45 of file player.c.
References client_spell::next, pl::spell_state, pl::stack_items, and pl::stack_position.
Referenced by free_player(), and get_player().
void close_and_delete | ( | FILE * | fp, |
int | compressed | ||
) |
Closes specified file.
fp | file to close. |
compressed | whether the file was compressed or not. Set by open_and_uncompress(). |
Definition at line 748 of file porting.c.
References pclose.
Referenced by add_score(), check_login(), display_high_score(), display_motd(), forbid_play(), init_artifacts(), init_attackmess(), init_book_archive(), init_experience(), init_formulae(), init_msgfile(), init_regions(), init_startup(), load_archetypes(), load_original_map(), load_overlay_map(), load_settings(), load_temporary_map(), load_treasures(), load_unique_objects(), metaserver2_init(), read_client_images(), send_news(), send_rules(), and verify_player().
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.
op2 | object that we copy.from |
op | object that we copy to. |
Definition at line 758 of file object.c.
References add_refcount(), obj::anim_suffix, obj::arch, CLEAR_FLAG, obj::custom_name, obj::discrete_damage, FLAG_DIALOG_PARSED, FLAG_FREED, FLAG_REMOVED, FREE_AND_CLEAR, free_dialog_information(), free_key_values(), free_string(), _key_value::key, obj::key_values, obj::lore, obj::materialname, obj::msg, obj::name, obj::name_pl, _key_value::next, NROFATTACKS, offsetof, QUERY_FLAG, obj::race, archt::reference_count, SET_FLAG, obj::skill, obj::slaying, obj::speed, obj::speed_left, SPELL_TAG_SIZE, obj::spell_tags, obj::title, update_ob_speed(), and _key_value::value.
Referenced by add_abilities(), cast_create_food(), cfapi_object_clone(), change_book(), command_create(), copy_object_with_inv(), do_learn_spell(), explosion(), first_arch_pass(), forklightning(), infect_object(), key_change_class(), local_check_loaded_object(), magic_wall(), make_throw_ob(), move_bolt(), move_cone(), object_create_clone(), pay_from_container(), place_alchemy_objects(), place_chest(), place_fountain_with_specials(), place_special_exit(), polymorph_item(), polymorph_living(), put_decor(), put_doors(), sell_item(), setup(), START_TEST(), write_note(), write_rune(), and write_scroll().
copy an object with an inventory... i.e., duplicate the inv too.
src_ob | object to copy. |
dest_ob | where to copy. |
Definition at line 862 of file object.c.
References obj::below, copy_object(), get_object(), insert_ob_in_ob(), and obj::inv.
Referenced by arch_to_object(), do_harvest(), include_map_in_map(), and place_monsters().
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 614 of file object.c.
References get_owner(), PLAYER, set_owner(), and obj::type.
Referenced by animate_bomb(), explode_bullet(), fire_arch_from_position(), poison_living(), and START_TEST().
int count_active | ( | void | ) |
Objects statistics.
Definition at line 1465 of file object.c.
References obj::active_next, and active_objects.
Referenced by malloc_info(), and START_TEST().
int count_free | ( | void | ) |
Objects statistics.
Definition at line 1433 of file object.c.
References free_objects, and obj::next.
Referenced by malloc_info(), and START_TEST().
int count_used | ( | void | ) |
Object statistics.
Definition at line 1449 of file object.c.
References obj::next, and objects.
Referenced by malloc_info(), and START_TEST().
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 625 of file arch.c.
References arch_to_object(), create_singularity(), and find_archetype().
Referenced by alchemy(), alchemy_failure_effect(), become_follower(), blind_living(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_create_missile(), cast_create_town_portal(), cast_curse(), cast_word_of_recall(), change_book(), charge_mana_effect(), confuse_living(), convert_item(), converter_type_move_on(), do_symptoms(), eat_special_food(), find_or_create_connection_for_map(), find_transmution_ob(), fire_swarm(), fix_generated_item(), god_examines_priest(), god_intervention(), grant_immunity(), handle_apply_yield(), keyplace(), kill_object(), kill_player(), local_check_loaded_object(), locate_recipe_artifact(), lock_and_hide_doors(), make_object_glow(), move_marker(), place_chest(), place_exits(), place_fountain_with_specials(), potion_type_apply(), pray_at_altar(), prayer_failure(), put_a_monster(), recharge(), save_throw_object(), scroll_failure(), second_arch_pass(), setup(), spell_failure(), START_TEST(), surround_by_doors(), swap_random_stats(), 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 173 of file arch.c.
References arch_to_object(), create_singularity(), find_archetype_by_object_name(), and MAX_BUF.
Referenced by 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 135 of file map.c.
References Settings::localdir, Settings::mapdir, settings, and snprintf().
Referenced by cfapi_map_create_path(), command_overlay_reset(), load_original_map(), load_overlay_map(), and save_map().
char* create_pathname | ( | const char * | name, |
char * | buf, | ||
size_t | size | ||
) |
This makes a path absolute outside the world of Crossfire. In other words, it prepends LIBDIR/MAPDIR/ to the given path and returns the pointer to a static array containing the result. it really should be called create_mapname
name | path of the map. |
buf | buffer that will contain the full path. |
size | buffer's length. |
Definition at line 114 of file map.c.
References Settings::datadir, Settings::mapdir, settings, and snprintf().
Referenced by cfapi_map_create_path(), check_path(), enter_fixed_template_map(), enter_unique_map(), load_original_map(), process_map(), ready_map_name(), 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 603 of file arch.c.
References add_string(), ARCH_SINGULARITY, FLAG_NO_PICK, get_object(), MAX_BUF, obj::name, obj::name_pl, SET_FLAG, and snprintf().
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 155 of file map.c.
References Settings::localdir, settings, snprintf(), 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 187 of file utils.c.
References obj::above, liv::ac, CLOAK, liv::dam, FLAG_IS_FLOOR, FLAG_OBJ_ORIGINAL, FLAG_OVERLAY_FLOOR, FLAG_UNIQUE, FLAG_UNPAID, liv::food, FOOD, free_object(), GET_MAP_OB, GIRDLE, GLOVES, obj::head, IS_ARMOR, IS_LIVE, IS_SHIELD, IS_WEAPON, 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, obj::material, QUERY_FLAG, remove_ob(), rndm(), obj::stats, obj::type, and mapdef::unique.
Referenced by ready_map_name().
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 2345 of file object.c.
References obj::above, obj::container, obj::contr, obj::env, esrv_update_item(), first_player, FLAG_REMOVED, free_object(), GET_MAP_OB, get_player_container(), obj::map, pl::next, obj::nrof, pl::ob, QUERY_FLAG, remove_ob(), pl::socket, sub_weight(), UPD_NROF, socket_struct::update_look, obj::weight, obj::x, and obj::y.
Referenced by cfapi_object_set_property(), check_altar_sacrifice(), convert_item(), eat_item(), get_split_ob(), operate_altar(), save_throw_object(), and START_TEST().
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 1745 of file map.c.
References first_map, free_map(), mapdef::in_memory, llevError, LOG(), MAP_IN_MEMORY, MAP_SAVING, mapdef::next, mapdef::path, mapdef::tile_map, and mapdef::tmpname.
Referenced by cfapi_map_delete_map(), flush_old_maps(), free_all_maps(), free_style_maps(), init_dynamic(), key_confirm_quit(), load_original_map(), load_overlay_map(), load_temporary_map(), process_map(), ready_map_name(), START_TEST(), and swap_map().