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().
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. |
retbuf | buffer that will contain the description. Must not be NULL. |
size | size of buffer. |
Definition at line 1018 of file item.c.
References liv::ac, AMULET, ARMOUR, ARMOUR_SPEED, ARMOUR_SPELLS, ARROW, atnr_is_dragon_enabled(), obj::attacktype, BOOTS, BOW, BRACERS, change_resist_msg, CLOAK, liv::dam, DESCRIBE_ABILITY_SAFE, describe_monster(), DESCRIBE_PATH_SAFE, describe_resistance(), DRINK, liv::exp, FLAG_BEEN_APPLIED, FLAG_CURSED, FLAG_IDENTIFIED, FLAG_LIFESAVE, FLAG_MONSTER, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_XRAYS, FLESH, liv::food, FOOD, FORCE, get_attr_value(), GIRDLE, GLOVES, obj::glow_radius, liv::grace, HELMET, HORN, liv::hp, is_dragon_pl(), obj::item_power, LAMP, obj::last_eat, obj::level, liv::luck, obj::magic, liv::maxsp, MOVE_FLY_HIGH, MOVE_FLY_LOW, MOVE_SWIM, obj::move_type, need_identify(), NUM_STATS, obj::path_attuned, obj::path_denied, obj::path_repelled, PLAYER, POWER_CRYSTAL, QUERY_FLAG, RING, ring_desc(), ROD, SHIELD, short_stat_name, SKILL, SKILL_TOOL, obj::slaying, snprintf(), liv::sp, obj::stats, obj::title, obj::type, WAND, liv::wc, WEAPON, and WEAPON_SPEED.
Referenced by artifact_msg(), cfapi_object_describe(), common_ob_describe(), dump_abilities(), mon_desc(), perceive_self(), and START_TEST().
void describe_monster | ( | const object * | op, |
char * | retbuf, | ||
size_t | size | ||
) |
Describes a monster.
op | monster to describe. Must not be NULL. |
retbuf | buffer that will contain the description. Must not be NULL. |
size | buffer size. |
Definition at line 840 of file item.c.
References obj::attacktype, obj::below, archt::clone, obj::contr, DESCRIBE_ABILITY_SAFE, DESCRIBE_PATH_SAFE, pl::digestion, FABS, FLAG_CAN_USE_SKILL, FLAG_CAST_SPELL, FLAG_FRIENDLY, FLAG_HITBACK, 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, pl::gen_grace, pl::gen_hp, pl::gen_sp, obj::inv, is_dragon_pl(), treasurestruct::item, treasureliststruct::items, liv::luck, MIN_ACTIVE_SPEED, obj::name, treasurestruct::next, NROFATTACKS, obj::path_attuned, obj::path_denied, obj::path_repelled, PLAYER, QUERY_FLAG, obj::randomitems, obj::resist, resist_plus, SKILL, snprintf(), obj::speed, SPELL, obj::stats, and obj::type.
Referenced by describe_item().
void describe_resistance | ( | const object * | op, |
int | newline, | ||
char * | buf, | ||
size_t | size | ||
) |
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 | |
[out] | buf | buffer that will receive the description. |
size | buffer size. |
Definition at line 399 of file item.c.
References atnr_is_dragon_enabled(), FLESH, NROFATTACKS, obj::resist, resist_plus, snprintf(), and obj::type.
Referenced by describe_item(), dump_gods(), god_info_msg(), and ring_desc().
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 2121 of file living.c.
References MAX_SAVE_LEVEL, 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 134 of file utils.c.
References llevError, LOG(), liv::luck, MAX, MIN, PLAYER, obj::stats, and obj::type.
Referenced by attempt_hide(), attempt_pick_lock(), attempt_steal(), do_skill_ident2(), fire_swarm(), pick_arrow_target(), player_lvl_adj(), scroll_type_apply(), spellbook_type_apply(), and summon_object().
int dirdiff | ( | int | dir1, |
int | dir2 | ||
) |
Computes a direction difference.
dir1 | |
dir2 | directions to compare. |
Definition at line 3434 of file object.c.
Referenced by monster_cast_spell(), monster_use_range(), monster_use_scroll(), and monster_use_skill().
Return the square of the distance between the two given objects.
ob1 | |
ob2 | objects we want to compute the distance of. |
Definition at line 3364 of file object.c.
References obj::x, and obj::y.
Referenced by cfapi_object_distance(), keyplace(), and play_sound_map().
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 760 of file living.c.
References ARCH_DEPLETION, arch_to_object(), change_attr_value(), drain_msg, draw_ext_info(), find_archetype(), fix_object(), FLAG_APPLIED, insert_ob_in_ob(), llevError, LOG(), MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_STAT_LOSS, NDI_UNIQUE, present_arch_in_ob(), SET_FLAG, and obj::stats.
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 748 of file living.c.
References drain_specific_stat(), and NUM_STATS.
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 40 of file info.c.
References liv::ac, archt::clone, describe_item(), liv::exp, first_archetype, FLAG_CHANGING, FLAG_MONSTER, liv::hp, bmappair::name, obj::name, archt::name, archt::next, obj::other_arch, QUERY_FLAG, obj::stats, and VERY_BIG_BUF.
Referenced by init_beforeplay().
void dump_alchemy | ( | void | ) |
Dumps alchemy recipes to output. Borrowed (again) from the artifacts code for this.
Definition at line 293 of file recipe.c.
References recipestruct::arch_name, recipestruct::arch_names, recipestruct::cauldron, recipestruct::chance, recipestruct::diff, recipestruct::exp, find_archetype(), formulalist, recipestruct::index, recipestruct::ingred, recipeliststruct::items, llevError, locate_recipe_artifact(), LOG(), logfile, MAX_BUF, linked_char::name, recipestruct::next, recipeliststruct::next, linked_char::next, recipeliststruct::number, recipestruct::skill, snprintf(), strtoint(), recipestruct::title, and recipeliststruct::total_chance.
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 495 of file recipe.c.
References recipestruct::arch_name, recipestruct::arch_names, recipestruct::chance, archt::clone, find_archetype(), find_ingred_cost(), formulalist, recipestruct::ingred, artifactstruct::item, recipeliststruct::items, llevError, locate_recipe_artifact(), LOG(), logfile, MAX_BUF, linked_char::name, recipestruct::next, recipeliststruct::next, linked_char::next, recipeliststruct::number, recipestruct::skill, snprintf(), recipestruct::title, recipeliststruct::total_chance, obj::value, and recipestruct::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 252 of file arch.c.
References dump_arch(), first_archetype, llevDebug, LOG(), archt::more, archt::next, 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 298 of file map.c.
References dump_map(), first_map, and mapdef::next.
Referenced by command_dumpallmaps().
void dump_all_objects | ( | 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 416 of file object.c.
References obj::count, dump_object(), llevDebug, LOG(), obj::next, stringbuffer_finish(), and stringbuffer_new().
Referenced by command_dumpallobjects(), and START_TEST().
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 243 of file arch.c.
References archt::clone, and dump_object().
Referenced by dump_all_archetypes().
void dump_artifacts | ( | void | ) |
For debugging purposes. Dumps all tables.
Definition at line 1446 of file treasure.c.
References artifactstruct::allowed, artifactstruct::chance, artifactstruct::difficulty, first_artifactlist, artifactstruct::item, artifactliststruct::items, logfile, linked_char::name, obj::name, artifactstruct::next, artifactliststruct::next, linked_char::next, artifactliststruct::total_chance, and artifactliststruct::type.
Referenced by init_beforeplay().
void dump_experience | ( | void | ) |
void dump_friendly_objects | ( | void | ) |
Dumps all friendly objects. Invoked in DM-mode with dumpfriendlyobjects command.
Definition at line 113 of file friend.c.
References obj::count, first_friendly_object, llevError, LOG(), obj::name, oblnk::next, and oblnk::ob.
Referenced by command_dumpfriendlyobjects().
void dump_gods | ( | void | ) |
Prints all gods to stderr.
Definition at line 161 of file holy.c.
References liv::ac, obj::attacktype, archt::clone, liv::Con, liv::dam, DESCRIBE_ABILITY, DESCRIBE_PATH, describe_resistance(), liv::Dex, first_god, 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, liv::hp, HUGE_BUF, liv::Int, obj::last_eat, obj::last_grace, obj::last_heal, obj::last_sp, obj::level, liv::luck, obj::msg, obj::name, archt::name, glnk::next, obj::other_arch, obj::path_attuned, obj::path_denied, obj::path_repelled, pntr_to_god_obj(), liv::Pow, QUERY_FLAG, obj::race, obj::slaying, snprintf(), obj::speed, obj::stats, liv::Str, obj::title, liv::wc, and liv::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 275 of file map.c.
References mapdef::darkness, mapdef::difficulty, mapdef::in_memory, llevError, LOG(), MAP_ENTER_X, MAP_ENTER_Y, MAP_HEIGHT, MAP_WIDTH, mapdef::maplore, mapdef::msg, mapdef::path, and mapdef::tmpname.
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 1515 of file treasure.c.
References archt::clone, dump_monster_treasure_rec(), first_archetype, treasureliststruct::items, logfile, obj::name, archt::name, archt::next, obj::randomitems, strcasecmp(), and obj::title.
Referenced by init_beforeplay().
void dump_object | ( | 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 372 of file object.c.
References obj::arch, archt::clone, obj::count, empty_archetype, obj::env, get_ob_diff(), obj::head, obj::inv, obj::more, obj::name, archt::name, obj::owner, stringbuffer_append_printf(), and stringbuffer_append_string().
Referenced by animate_object(), command_dump(), command_dumpbelow(), dump_all_objects(), dump_arch(), free_object2(), gate_type_process(), insert_ob_in_map(), insert_ob_in_ob(), process_events(), remove_ob(), and START_TEST().
int enough_elapsed_time | ( | void | ) |
Checks elapsed time since last tick.
Definition at line 175 of file time.c.
References GETTIMEOFDAY, last_time, log_time(), and max_time.
void fatal | ( | int | 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 60 of file glue.c.
References clean_tmp_files(), emergency_save(), fatalmsgs, and logfile.
Referenced by add_arch(), add_player(), allocate_map(), build_stringlist(), compute_path(), copy_message(), do_server(), 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_empty_treasurelist(), get_linked_map(), get_objectlink(), get_objectlinkpt(), get_player(), get_racelist(), get_region_struct(), init_godslist(), init_recipelist(), new_shared_string(), parse_dialog_information(), re_init(), SockList_AddPrintf(), SockList_Ensure(), stringbuffer_ensure(), and stringbuffer_new().
int find_animation | ( | const char * | name | ) |
Finds the animation id that matches name. Will LOG() an error if not found.
name | the animation's name. |
Definition at line 146 of file anim.c.
References llevError, LOG(), and try_find_animation().
Referenced by cfapi_system_find_animation(), and transport_type_apply().
archetype* find_archetype | ( | const char * | name | ) |
Finds, using the hashtable, which archetype matches the given name. Will LOG() if not found.
Definition at line 700 of file arch.c.
References llevError, LOG(), try_find_archetype(), and warn_archetypes.
Referenced by animate_bomb(), apply_builder_window(), apply_map_builder(), CREUtils::artifactNode(), can_pay(), cast_consecrate(), cast_create_missile(), cast_create_town_portal(), cast_heal(), cast_raise_dead_spell(), cctk_create_game_object(), change_luck(), check_recipe(), check_spells(), command_create(), command_use(), create_archetype(), drain_specific_stat(), dump_alchemy(), dump_alchemy_costs(), find_enclosed_spot(), find_next_coin(), fix_flesh_item(), fix_walls(), CREUtils::formulaeNode(), god_intervention(), init_archetype_pointers(), init_archetypes(), init_races(), kill_player(), load_treasure(), magic_wall(), make_formula_book(), op_on_battleground(), pay_from_container(), perceive_self(), place_exits(), poison_living(), potion_type_apply(), process_map(), put_a_monster(), replace_insert_ob_in_map(), save_throw_object(), second_arch_pass(), sell_item(), CREFormulaePanel::setRecipe(), slow_living(), and START_TEST().
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 70 of file arch.c.
References add_string(), archt::clone, first_archetype, free_string(), obj::name, and archt::next.
Referenced by cfapi_object_create(), command_create(), create_archetype_by_object_name(), CREArtifactPanel::setArtifact(), 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 96 of file arch.c.
References archt::clone, first_archetype, obj::name, archt::next, and obj::type.
Referenced by cast_create_food(), and START_TEST().
artifactlist* find_artifactlist | ( | int | type | ) |
Searches the artifact lists and returns one that has the same type of objects on it.
Definition at line 1431 of file treasure.c.
References first_artifactlist, artifactliststruct::next, and artifactliststruct::type.
Referenced by artifact_msg(), cast_create_missile(), command_create(), generate_artifact(), init_artifacts(), and locate_recipe_artifact().
Search some close squares in the given map at the given coordinates for live objects.
m | |
x | |
y | origin from which to search. |
exclude | an object that will be ignored. Can be NULL. |
Definition at line 3313 of file object.c.
References obj::above, FLAG_MONSTER, freearr_x, freearr_y, freedir, get_map_flags(), GET_MAP_MOVE_BLOCK, GET_MAP_OB, obj::head, maxfree, MOVE_ALL, obj::move_type, P_IS_ALIVE, P_OUT_OF_MAP, PLAYER, QUERY_FLAG, SIZEOFFREE, and obj::type.
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 3380 of file object.c.
Referenced by enter_map(), get_rangevector(), get_rangevector_from_mapcoord(), monster_use_bow(), monster_use_range(), monster_use_skill(), and pet_move().
unsigned find_face | ( | const char * | name, |
unsigned | error | ||
) |
This returns an the face number of face 'name'. Number is constant during an invocation, but not necessarily between versions (this is because the faces are arranged in alphabetical order, so if a face is removed or added, all faces after that will now have a different number.
name | face to search for |
error | value to return if face was not found. |
Definition at line 324 of file image.c.
References compar(), bmappair::name, nroffiles, and bmappair::number.
Referenced by cfapi_system_find_face(), init_anim(), read_bmap_names(), read_face_data(), read_smooth(), set_object_face_main(), set_object_face_other(), and transport_type_apply().
find_first_free_spot(archetype, mapstruct, x, y) works like 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 3240 of file object.c.
References freearr_x, freearr_y, ob_blocked(), and SIZEOFFREE.
Referenced by cfapi_object_teleport(), change_object(), find_enclosed_spot(), hit_player(), keyplace(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), put_a_monster(), and transfer_ob().
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 3200 of file object.c.
References AB_NO_PASS, freearr_x, freearr_y, maxfree, ob_blocked(), and SIZEOFFREE.
Referenced by animate_weapon(), command_summon(), command_teleport(), do_harvest(), enter_map(), follow_owner(), free_object2(), gate_type_process(), polymorph_living(), process_players1(), shop_mat_type_move_on(), summon_golem(), summon_object(), teleport(), and transfer_ob().
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 2935 of file object.c.
References get_multi_size(), obj::head, obj::map, MAP_HEIGHT, MAP_WIDTH, ob_blocked(), obj::x, and obj::y.
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 3052 of file object.c.
References get_map_flags(), get_multi_size(), get_ob_key_value(), obj::head, obj::map, ob_blocked(), P_OUT_OF_MAP, strtol(), obj::x, and obj::y.
Referenced by generate_monster_arch(), and generate_monster_inv().
Find object in inventory.
who | where to search. |
type | |
subtype | what to search. |
Definition at line 3656 of file object.c.
References obj::below, obj::inv, obj::subtype, and obj::type.
Referenced by cast_word_of_recall(), cfapi_object_find(), cftimer_create(), deep_swamp_type_process(), and do_hidden_move().
Returns the object which has the count-variable equal to the argument.
i | tag. |
Definition at line 439 of file object.c.
References obj::count, and obj::next.
Referenced by cfapi_object_find(), 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().
object* find_object_name | ( | 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 459 of file object.c.
References add_string(), free_string(), obj::name, and obj::next.
Referenced by cfapi_object_find(), command_possess(), find_object_both(), and START_TEST().
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 401 of file image.c.
References nrofpixmaps, and new_face_struct::smoothface.
Referenced by send_smooth().
sstring find_string | ( | const char * | str | ) |
Searches a string in the shared strings.
str | string to search for. |
Definition at line 228 of file shstr.c.
References GATHER, hashstr(), _shared_string::next, and _shared_string::string.
Referenced by cfapi_system_find_string(), find_treasurelist(), get_ob_key_value(), set_ob_key_value(), and START_TEST().
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 365 of file recipe.c.
References archt::clone, find_treasure_by_name(), find_treasurelist(), treasurestruct::item, treasureliststruct::items, treasurestruct::name, obj::name, treasurestruct::next, treasurestruct::next_no, treasurestruct::next_yes, and strcasecmp().
Referenced by find_ingred_cost(), and find_treasure_by_name().
void fix_container | ( | object * | container | ) |
When the map is loaded, load_object() does not actually insert objects into inventory, but just links them. What this does is go through and insert them properly.
container | object that contains the inventory. This is needed so that we can update the containers weight. |
Definition at line 580 of file map.c.
References obj::below, fix_container(), insert_ob_in_ob(), obj::inv, and sum_weight().
Referenced by fix_container().
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 1070 of file treasure.c.
References add_string(), AMULET, amulet_arch, obj::arch, ARMOUR, BOOK, BRACERS, calc_item_power(), CHANCE_FOR_ARTIFACT, CLOAK, CONTAINER, create_archetype(), create_treasure(), crown_arch, obj::dam_modifier, DICE2, mapdef::difficulty, obj::duration_modifier, liv::exp, fix_flesh_item(), FLAG_ALIVE, FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IS_THROWN, FLAG_MONSTER, FLAG_NO_PICK, FLAG_STARTEQUIP, liv::food, FREE_AND_COPY, free_object(), generate_artifact(), GET_ANIM_ID, get_power_from_ench(), liv::grace, GT_ENVIRONMENT, GT_MINIMAL, GT_ONLY_GOOD, GT_STARTEQUIP, HELMET, HORN, liv::hp, insert_ob_in_ob(), obj::inv, obj::item_power, obj::level, level_for_item(), llevDebug, LOG(), obj::magic, obj::map, MAX, liv::maxhp, MONEY, obj::msg, obj::name, obj::name_pl, obj::nrof, NUM_ANIMATIONS, POTION, QUERY_FLAG, obj::randomitems, obj::range_modifier, remove_ob(), RING, ring_arch, rndm(), ROD, RUNE, SCROLL, SET_ANIMATION, SET_FLAG, set_magic(), set_materialname(), set_ring_bonus(), SHIELD, obj::slaying, liv::sp, special_potion(), SPELL, spell_mapping, SPELLBOOK, obj::stats, tailor_readable_ob(), obj::title, TRAP, trap_adjust(), obj::type, obj::value, WAND, and WEAPON.
Referenced by convert_item(), create_all_treasures(), create_one_treasure(), god_gives_present(), move_creator(), and polymorph_item().
void fix_multipart_object | ( | 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 4007 of file object.c.
References add_string(), obj::arch, arch_to_object(), free_string(), obj::head, INS_ABOVE_FLOOR_ONLY, INS_NO_MERGE, INS_NO_WALK_ON, insert_ob_in_map(), llevError, LOG(), obj::map, obj::more, archt::more, obj::name, obj::title, obj::x, and obj::y.
Referenced by generate_monster_inv(), and link_multipart_objects().
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 900 of file living.c.
References liv::ac, add_refcount(), AMULET, obj::arch, ARMOUR, ARMOUR_SPEED, AT_PHYSICAL, ATNR_PHYSICAL, obj::attacktype, obj::below, obj::body_info, obj::body_used, BOOTS, BOW, pl::braced, BRACERS, obj::carrying, change_attr_value(), check_stat_bounds(), obj::chosen_skill, CLEAR_FLAG, CLOAK, archt::clone, CLOSE_CON, liv::Con, con_bonus, CONTAINER, obj::contr, obj::current_weapon, liv::dam, dam_bonus, liv::Dex, dex_bonus, pl::digestion, DISEASE, pl::encumbrance, esrv_update_spells(), EXPERIENCE, FLAG_APPLIED, FLAG_BLIND, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_READY_WEAPON, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_UNDEAD, FLAG_USE_ARMOUR, FLAG_WIZ, FLAG_XRAYS, FORCE, free_string(), pl::gen_grace, pl::gen_hp, pl::gen_sp, pl::gen_sp_armour, get_attr_value(), GIRDLE, GLOVES, obj::glow_radius, grace_bonus, HELMET, HORN, liv::hp, liv::Int, obj::inv, obj::invisible, IS_COMBAT_SKILL, IS_GRACE_SKILL, IS_MANA_SKILL, pl::item_power, obj::level, pl::levgrace, pl::levhp, pl::levsp, llevDebug, LOG(), liv::luck, MAX, max_carry, Settings::max_level, liv::maxgrace, liv::maxhp, liv::maxsp, MOVE_FLY_HIGH, MOVE_FLY_LOW, obj::move_type, MOVE_WALK, obj::name, NROFATTACKS, NUM_BODY_LOCATIONS, NUM_STATS, pl::orig_stats, obj::path_attuned, obj::path_denied, obj::path_repelled, PLAYER, POTION, POTION_EFFECT, liv::Pow, QUERY_FLAG, range_bow, range_misc, range_skill, pl::ranges, obj::resist, RING, ROD, Settings::search_items, pl::search_str, set_attr_value(), SET_FLAG, settings, SHIELD, SK_PRAYING, SKILL, SKILL_TOOL, obj::slaying, liv::sp, sp_bonus, obj::speed, speed_bonus, Settings::spell_encumbrance, obj::stats, liv::Str, SYMPTOM, thaco_bonus, TRUE, obj::type, update_ob_speed(), WAND, liv::wc, WEAPON, pl::weapon_sp, WEAPON_SPEED, and liv::Wis.
Referenced by animate_weapon(), apply_special(), blind_living(), blindness_type_process(), cast_bless(), cast_curse(), cfapi_object_fix(), cfapi_object_set_property(), change_abil(), check_login(), command_abil(), command_brace(), command_dropall(), command_fix_me(), command_possess(), command_search_items(), do_skill(), do_symptoms(), do_turn(), dragon_eat_flesh(), drain_specific_stat(), drop_object(), eat_special_food(), fire_bow(), fix_weight(), god_intervention(), hit_with_one_attacktype(), improve_armour(), improve_weapon_stat(), insert_ob_in_ob(), key_change_class(), kill_player(), lighter_type_apply(), 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_force(), remove_ob(), remove_symptoms(), roll_stats(), save_life(), slow_living(), stop_jump(), swap_random_stats(), swap_stat(), and unapply_special().
void 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 2876 of file object.c.
References obj::below, flag_inv(), obj::inv, and SET_FLAG.
Referenced by flag_inv(), local_check_loaded_object(), and set_cheat().
void free_all_anim | ( | void | ) |
Clears all animation-related memory.
Definition at line 41 of file anim.c.
References animations, free_string(), and num_animations.
Referenced by cleanup().
void free_all_archs | ( | void | ) |
Frees all memory allocated to archetypes. After calling this, it's possible to call again init_archetypes() to reload data.
Definition at line 298 of file arch.c.
References clear_archetable(), first_archetype, free_arch(), llevDebug, LOG(), archt::more, and archt::next.
Referenced by cleanup(), and START_TEST().
void free_all_god | ( | void | ) |
Frees all god information.
Definition at line 142 of file holy.c.
References first_god, free_string(), llevDebug, LOG(), glnk::name, and glnk::next.
Referenced by cleanup().
void free_all_images | ( | void | ) |
Deallocates memory allocated by read_bmap_names() and read_smooth().
Definition at line 418 of file image.c.
References bmappair::name, and nroffiles.
Referenced by cleanup().
void free_all_maps | ( | void | ) |
Frees all allocated maps.
Definition at line 1968 of file map.c.
References delete_map(), first_map, mapdef::in_memory, llevDebug, LOG(), MAP_IN_MEMORY, and MAP_SAVING.
Referenced by cleanup().
void free_all_object_data | ( | void | ) |
Destroys all allocated objects.
Definition at line 479 of file object.c.
References FLAG_FREED, llevDebug, LOG(), obj::name, obj::next, nrofallocobjects, nroffreeobjects, QUERY_FLAG, and STARTMAX.
Referenced by cleanup().
void free_all_readable | ( | void | ) |
Definition at line 2084 of file readable.c.
References titlestruct::archname, titlestruct::authour, titleliststruct::first_book, free_string(), llevDebug, LOG(), titlestruct::name, linked_char::name, titlestruct::next, titleliststruct::next, linked_char::next, and oblnk::next.
Referenced by cleanup().
void free_all_recipes | ( | void | ) |
Frees all memory allocated to recipes and recipes lists.
Definition at line 721 of file recipe.c.
References recipestruct::arch_name, recipestruct::cauldron, formulalist, free_string(), recipestruct::ingred, recipeliststruct::items, llevDebug, LOG(), linked_char::name, recipestruct::next, recipeliststruct::next, linked_char::next, recipestruct::skill, and recipestruct::title.
Referenced by cleanup().
void free_all_treasures | ( | void | ) |
Free all treasure-related memory.
Definition at line 2131 of file treasure.c.
References first_artifactlist, first_treasurelist, free_artifactlist(), free_string(), free_treasurestruct(), treasureliststruct::items, treasureliststruct::name, and treasureliststruct::next.
Referenced by cleanup().
void free_arch | ( | archetype * | at | ) |
Frees archetype.
at | archetype to free. Pointer becomes invalid after the call. |
Definition at line 273 of file arch.c.
References archt::clone, obj::discrete_damage, free_key_values(), free_string(), obj::msg, obj::name, archt::name, obj::name_pl, obj::race, obj::slaying, and obj::title.
Referenced by free_all_archs(), and free_object2().
void free_dialog_information | ( | object * | op | ) |
Frees obj::dialog_information.
op | what to clean for. |
Definition at line 39 of file dialog.c.
References struct_dialog_information::all_messages, struct_dialog_information::all_replies, CLEAR_FLAG, obj::dialog_information, FLAG_DIALOG_PARSED, struct_dialog_message::match, struct_dialog_reply::message, struct_dialog_message::message, struct_dialog_reply::next, struct_dialog_message::next, QUERY_FLAG, struct_dialog_message::replies, and struct_dialog_reply::reply.
Referenced by clear_object(), copy_object(), and free_object2().
void free_experience | ( | void | ) |
Frees experience-related memory.
Definition at line 269 of file exp.c.
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 307 of file init.c.
References attack_mess, Settings::emergency_mapname, first_friendly_object, first_region, FREE_AND_CLEAR, FREE_AND_CLEAR_STR, free_experience(), regiondef::jailmap, regiondef::longname, MAXATTACKMESS, regiondef::msg, regiondef::name, regiondef::next, oblnk::next, NROFATTACKMESS, regiondef::parent_name, and undead_name.
Referenced by cleanup().
void 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 659 of file object.c.
References FREE_AND_CLEAR_STR, _key_value::key, obj::key_values, _key_value::next, and _key_value::value.
Referenced by clear_object(), copy_object(), free_arch(), free_artifact(), and free_object2().
void free_loader | ( | void | ) |
void free_map | ( | mapstruct * | m | ) |
Frees everything allocated by the given mapstructure. Don't free tmpname - our caller is left to do that. Mapstructure itself is not freed.
m | map to free. |
Definition at line 1707 of file map.c.
References mapdef::background_music, mapdef::buttons, EVENT_MAPUNLOAD, execute_global_event(), free_all_objects(), FREE_AND_CLEAR, free_objectlinkpt(), mapdef::in_memory, llevError, LOG(), MAP_SWAPPED, mapdef::maplore, mapdef::msg, mapdef::name, mapdef::shopitems, mapdef::shoprace, mapdef::spaces, mapdef::tile_map, and mapdef::tile_path.
Referenced by delete_map(), START_TEST(), swap_map(), and teardown().
void free_object | ( | 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 remove_ob() 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 1238 of file object.c.
References free_object2().
Referenced by add_abilities(), adjust_sign_msg(), alchemy(), alchemy_failure_effect(), alchemy_object(), apply_builder_floor(), apply_builder_item(), apply_builder_remove(), apply_builder_wall(), apply_builder_window(), arrow_type_process(), artifact_msg(), auto_apply(), become_follower(), blindness_type_process(), cast_cause_disease(), cast_create_missile(), cast_create_town_portal(), cast_dust(), cast_raise_dead_spell(), cast_smite_spell(), cfapi_object_delete(), cfapi_object_insert(), change_book(), change_object(), check_bullet(), check_special_prayers(), clean_object(), command_arrest(), command_cast_spell(), command_create(), command_free(), command_goto(), command_kill_pets(), command_learn_spell_or_prayer(), command_reset(), command_summon(), command_teleport(), common_process_projectile(), convert_item(), counterspell(), cure_disease(), decay_objects(), decrease_ob_nr(), delete_unique_items(), destroy_object(), dispel_rune(), do_forget_spell(), do_turn(), drop(), drop_object(), eat_special_food(), enter_exit(), enter_map(), enter_player_savebed(), execute_event(), execute_word_of_recall(), explode_bullet(), explosion(), fire_arch_from_position(), fire_bolt(), fire_bow(), fire_bullet(), first_arch_pass(), fix_generated_item(), fix_stopped_arrow(), fix_walls(), follower_remove_given_items(), free_all_objects(), free_object2(), free_player(), generate_treasure(), give_initial_items(), god_intervention(), hit_player(), hit_with_arrow(), insert_ob_in_map(), insert_ob_in_ob(), insert_objects(), key_change_class(), kill_object(), kill_player(), load_objects(), locate_recipe_artifact(), lock_and_hide_doors(), loot_object(), merge_ob(), merge_spell(), monster_move_no_enemy(), move_aura(), move_bolt(), move_bullet(), move_cone(), move_creator(), move_disease(), move_duplicator(), move_golem(), move_marker(), move_missile(), move_monster(), move_player_mover(), move_swarm_spell(), move_symptom(), move_teleporter(), nuke_map_region(), pay_from_container(), pet_move(), pick_up_object(), place_chest(), place_exits(), place_fountain_with_specials(), player_apply(), poisoning_type_process(), polymorph_item(), polymorph_living(), polymorph_melt(), potion_type_apply(), prayer_failure(), print_monsters(), process_events(), process_object(), receive_play_again(), recharge(), remove_adjacent_doors(), remove_all_pets(), remove_contents(), remove_door(), remove_force(), remove_locked_door(), remove_marking_runes(), remove_monsters(), remove_symptoms(), remove_unpaid_objects(), replace_insert_ob_in_map(), retrofit_joined_wall(), rune_attack(), save_life(), save_throw_object(), scroll_failure(), second_arch_pass(), spell_effect_type_move_on(), spell_failure(), spring_trap(), START_TEST(), stop_item(), stop_projectile(), summon_golem(), tailor_god_spell(), tear_down_wall(), terminate_all_pets(), thrown_object_type_process(), and write_scroll().
void free_object2 | ( | object * | ob, |
int | free_inventory | ||
) |
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 remove_ob() first for this function to succeed.
ob | object to free. Will become invalid when function returns. |
free_inventory | if set, free inventory as well. Else drop items in inventory to the ground. |
Definition at line 1258 of file object.c.
References obj::arch, obj::below, obj::count, obj::discrete_damage, dump_object(), EVENT_DESTROY, execute_event(), find_free_spot(), FLAG_ALIVE, FLAG_FREED, FLAG_FRIENDLY, FLAG_IS_A_TEMPLATE, FLAG_NO_DROP, FLAG_REMOVED, FLAG_STARTEQUIP, FREE_AND_CLEAR, FREE_AND_CLEAR_STR, free_arch(), free_dialog_information(), free_key_values(), free_object(), free_object2(), free_objects, freearr_x, freearr_y, GET_MAP_MOVE_BLOCK, mapdef::in_memory, insert_ob_in_map(), obj::inv, llevDebug, llevError, llevMonster, LOG(), obj::lore, obj::map, MAP_IN_MEMORY, obj::materialname, obj::more, MOVE_ALL, obj::msg, obj::name, obj::name_pl, obj::next, nroffreeobjects, obj::prev, QUERY_FLAG, obj::race, archt::reference_count, remove_friendly_object(), remove_ob(), RUNE, SCRIPT_FIX_NOTHING, SET_FLAG, SIZEOFFREE, obj::skill, obj::slaying, obj::speed, obj::spell_tags, stringbuffer_finish(), stringbuffer_new(), obj::title, TRAP, obj::type, update_ob_speed(), obj::x, and obj::y.
Referenced by free_no_drop(), free_object(), free_object2(), and god_gives_present().
void free_objectlink | ( | objectlink * | ol | ) |
Recursively frees all objectlinks.
ol | object link to free. |
Definition at line 83 of file links.c.
References free_objectlink(), and oblnk::next.
Referenced by add_button_link(), free_objectlink(), and free_objectlinkpt().
void free_objectlinkpt | ( | oblinkpt * | obp | ) |
Recursively frees all linked list of objectlink pointers
obp | pointer to free. |
Definition at line 95 of file links.c.
References free_objectlink(), free_objectlinkpt(), oblinkpt::link, and oblinkpt::next.
Referenced by free_map(), and free_objectlinkpt().
void free_player | ( | player * | pl | ) |
Clears player structure, including pointed object (through free_object()).
pl | player to clear. Pointer is invalid after this call. |
Definition at line 68 of file player.c.
References CFREE, clear_player(), socket_struct::faces_sent, first_player, FLAG_REMOVED, free_object(), llevError, LOG(), pl::next, pl::ob, QUERY_FLAG, remove_ob(), and pl::socket.
Referenced by final_free_player().
void free_socket_images | ( | void | ) |
Frees all faceset information
Definition at line 584 of file image.c.
References MAX_FACE_SETS, and nrofpixmaps.
Referenced by free_all_newserver().
void free_string | ( | sstring | str | ) |
This will reduce the refcount, and if it has reached 0, str will be freed.
str | string to release, which *must *have been returned from a previous add_string(). |
Definition at line 272 of file shstr.c.
References _shared_string::array, GATHER, _shared_string::next, _shared_string::previous, _shared_string::refcount, SS, TOPBIT, and _shared_string::u.
Referenced by add_abilities(), adjust_sign_msg(), alchemy_failure_effect(), animate_bomb(), animate_weapon(), attack_ob_simple(), become_follower(), cast_bless(), cast_change_ability(), cast_create_town_portal(), cast_curse(), cfapi_system_remove_string(), change_abil(), change_book(), change_treasure(), check_output_buffers(), cone_drop(), confuse_living(), copy_object(), do_symptoms(), do_throw(), enter_player_savebed(), find_archetype_by_object_name(), find_object_name(), fire_bow(), fix_container_multipart(), fix_multipart_object(), fix_object(), flush_output_element(), free_all_anim(), free_all_god(), free_all_readable(), free_all_recipes(), free_all_treasures(), free_arch(), free_artifact(), free_races(), give_artifact_abilities(), hit_with_arrow(), identify(), infect_object(), init_races(), key_change_class(), keyplace(), kill_player(), local_check_loaded_object(), make_formula_book(), move_monster(), new_text_name(), poison_living(), set_ob_key_value(), START_TEST(), summon_golem(), tailor_god_spell(), tailor_readable_ob(), and write_note().
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.
Definition at line 1906 of file treasure.c.
References ARTIFACT_TRIES, artifactstruct::chance, FABS, find_artifactlist(), give_artifact_abilities(), artifactstruct::item, artifactliststruct::items, legal_artifact_combination(), llevDebug, llevError, LOG(), obj::magic, obj::name, artifactstruct::next, artifactliststruct::total_chance, and obj::type.
Referenced by alchemy_failure_effect(), fix_generated_item(), generate_monster_arch(), generate_monster_inv(), 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 120 of file arch.c.
References archt::clone, first_archetype, archt::next, obj::skill, and obj::type.
Referenced by 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 149 of file arch.c.
References archt::clone, first_archetype, archt::next, obj::subtype, and obj::type.
Referenced by CREUtils::artifactNode(), become_follower(), calculate_difficulty(), START_TEST(), and write_on_item().
archetype* get_archetype_struct | ( | void | ) |
Allocates, initialises and returns the pointer to an archetype structure.
Definition at line 323 of file arch.c.
References CALLOC, CLEAR_FLAG, clear_object(), fatal(), FLAG_FREED, FLAG_REMOVED, OUT_OF_MEMORY, and SET_FLAG.
Referenced by first_arch_pass(), local_check_loaded_object(), and START_TEST().
Gets the value of a stat.
stats | item from which to get stat. |
attr | attribute to get. |
Definition at line 377 of file living.c.
References CHA, liv::Cha, CON, liv::Con, DEX, liv::Dex, INT, liv::Int, POW, liv::Pow, STR, liv::Str, WIS, and liv::Wis.
Referenced by add_abilities(), apply_changes_to_player(), calc_item_power(), cast_change_ability(), change_abil(), check_good_weapon(), check_stat_bounds(), describe_item(), eat_special_food(), fix_object(), god_intervention(), is_magical(), kill_player(), perceive_self(), potion_type_apply(), 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 756 of file button.c.
References mapdef::buttons, obj::count, oblnk::id, oblinkpt::link, obj::map, oblnk::next, oblinkpt::next, oblnk::ob, and oblinkpt::value.
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 147 of file player.c.
References fatal(), client_spell::next, OUT_OF_MEMORY, client_spell::spell, and pl::spell_state.
Referenced by append_spell(), and esrv_update_spells().
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 214 of file dialog.c.
References struct_dialog_information::all_messages, struct_dialog_information::all_replies, obj::dialog_information, FLAG_DIALOG_PARSED, matches(), struct_dialog_reply::next, struct_dialog_message::next, parse_dialog_information(), and QUERY_FLAG.
Referenced by do_talk_npc().
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 884 of file map.c.
References allocate_map(), get_linked_map(), mapdef::height, mapdef::in_memory, MAP_SWAPPED, and mapdef::width.
Referenced by cfapi_map_get_map(), make_map_floor(), setup(), and START_TEST().
int get_face_fallback | ( | int | faceset, |
int | 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 614 of file image.c.
References get_face_fallback(), llevError, and LOG().
Referenced by esrv_send_face(), get_face_fallback(), process_map(), and send_image_sums().
recipelist* get_formulalist | ( | int | i | ) |
Gets a formula list by ingredients count.
i | number of ingredients. |
Definition at line 112 of file recipe.c.
References formulalist, and recipeliststruct::next.
Referenced by alchemy_failure_effect(), attempt_do_alchemy(), CREResourcesWindow::fillFormulae(), get_random_recipelist(), and make_formula_book().
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 272 of file region.c.
References add_string(), EXIT_PATH, EXIT_X, EXIT_Y, FLAG_DAMNED, get_object(), get_region_by_map(), regiondef::jailmap, regiondef::jailx, regiondef::jaily, llevDebug, llevError, LOG(), obj::map, regiondef::name, regiondef::parent, PLAYER, SET_FLAG, and obj::type.
Referenced by command_arrest().
int get_language | ( | object * | op | ) |
Returns the i18n language index associated with the given object. This only has a meaning for players.
op | The player object to get the language of |
Definition at line 59 of file languages.c.
References obj::contr, pl::language, and NUM_LANGUAGES.
Referenced by command_afk(), command_applymode(), command_body(), command_bowmode(), command_brace(), command_debug(), command_explore(), command_help(), command_kill_pets(), command_language(), command_listen(), command_output_count(), command_output_sync(), command_passwd(), command_peaceful(), command_petmode(), command_players(), command_quit(), command_resistances(), command_save(), command_showpets(), command_sound(), command_statistics(), command_title(), command_usekeys(), command_whereabouts(), command_wimpy(), command_wizcast(), command_wizpass(), current_map_info(), current_region_info(), help_topics(), list_players(), malloc_info(), map_info(), receive_player_password(), and show_commands().
void get_levelnumber | ( | int | i, |
char * | buf, | ||
size_t | size | ||
) |
Formats a level.
i | level to format. | |
[out] | buf | buffer which will contain the level. |
size | size of the buffer. |
Definition at line 444 of file item.c.
References levelnumbers, levelnumbers_10, numbers_10, and snprintf().
Referenced by examine(), and spellbook_type_apply().
mapstruct* get_linked_map | ( | void | ) |
Allocates, initialises, and returns a pointer to a mapstruct. Modified to no longer take a path option which was not being used anyways. MSW 2001-07-01
Definition at line 816 of file map.c.
References fatal(), first_map, mapdef::in_memory, mapdef::last_reset_time, MAP_ENTER_X, MAP_ENTER_Y, MAP_HEIGHT, MAP_RESET_TIMEOUT, MAP_SWAPPED, MAP_TIMEOUT, MAP_WIDTH, mapdef::next, and OUT_OF_MEMORY.
Referenced by get_empty_map(), load_original_map(), and read_map_log().
int get_map_flags | ( | mapstruct * | oldmap, |
mapstruct ** | newmap, | ||
sint16 | x, | ||
sint16 | y, | ||
sint16 * | nx, | ||
sint16 * | 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 330 of file map.c.
References MapSpace::flags, get_map_from_coord(), out_of_map(), P_NEW_MAP, P_OUT_OF_MAP, mapdef::spaces, and mapdef::width.
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(), communicate(), counterspell(), create_bomb(), dimension_door(), dispel_rune(), do_harvest(), do_skill_ident(), do_throw(), draw_client_map(), execute_word_of_recall(), expand_lighted_sight(), expand_sight(), find_dir(), find_multi_free_spot_within_radius(), find_nearest_living_creature(), find_target_for_friendly_spell(), find_traps(), fire_arch_from_position(), fire_bolt(), fire_bow(), fire_bullet(), forklightning(), get_pet_enemy(), get_pointed_target(), hideability(), hit_map(), magic_mapping_mark(), magic_mapping_mark_recursive(), magic_wall(), mood_change(), move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_golem(), move_missile(), move_ob(), move_player_mover(), move_swarm_spell(), npc_call_help(), ob_blocked(), ok_to_put_more(), path_to_player(), pet_move(), pick_arrow_target(), probe(), process_players1(), remove_adjacent_doors(), remove_trap(), roll_ob(), singing(), skill_attack(), spell_failure(), spell_find_dir(), stand_in_light(), 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 of calling out_of_map and then figuring out what the real map is
m | map we want to look at. |
x | |
y | coordinates, which will contain the real position that was checked. |
Definition at line 2366 of file map.c.
References get_map_from_coord(), mapdef::in_memory, load_and_link_tiled_map(), MAP_HEIGHT, MAP_IN_MEMORY, MAP_WIDTH, mapdef::tile_map, and mapdef::tile_path.
Referenced by cfapi_map_get_map(), draw_client_map2(), follow_owner(), get_map_flags(), get_map_from_coord(), insert_ob_in_map(), look_at(), monster_use_bow(), move_ob(), move_player_attack(), pet_move(), remove_ob(), and summon_object().
const char* get_month_name | ( | const int | index | ) |
give access to month names
Definition at line 120 of file time.c.
References month_name, and MONTHS_PER_YEAR.
Referenced by cfapi_get_month_name(), and START_TEST().
void get_multi_size | ( | 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 4066 of file object.c.
References obj::arch, archt::clone, obj::head, archt::more, obj::x, and obj::y.
Referenced by find_multi_free_spot_around(), find_multi_free_spot_within_radius(), process_map(), and update_transport_block().
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 103 of file region.c.
References regiondef::fallback, first_region, llevInfo, LOG(), regiondef::name, mapdef::name, regiondef::next, and mapdef::region.
Referenced by current_region_info(), get_region_by_map(), and get_who_escape_code_value().
void get_ob_diff | ( | StringBuffer * | sb, |
object * | op, | ||
object * | op2 | ||
) |
Referenced by add_one_item(), command_diff(), dump_object(), 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 3676 of file object.c.
References _key_value::key, obj::key_values, and _key_value::next.
Referenced by compare_ob_value_lists_one(), and set_ob_key_value_s().
const char* get_ob_key_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 3701 of file object.c.
References find_string(), _key_value::key, obj::key_values, _key_value::next, and _key_value::value.
Referenced by apply_special(), cfapi_object_get_key(), check_race_restrictions(), check_spell_expiry(), command_use(), do_harvest(), find_multi_free_spot_within_radius(), follower_remove_given_items(), generate_monster(), generate_monster_arch(), generate_monster_inv(), god_enchants_weapon(), handle_apply_yield(), kill_object(), query_cost(), set_object_face_main(), set_object_face_other(), transport_type_apply(), and turn_transport().
object* get_object | ( | 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 921 of file object.c.
References obj::active_next, obj::active_prev, clear_object(), obj::count, obj::discrete_damage, expand_objects(), FLAG_FREED, FLAG_REMOVED, free_objects, llevError, LOG(), obj::lore, obj::materialname, obj::msg, obj::name, obj::name_pl, obj::next, nroffreeobjects, ob_count, objects, obj::prev, QUERY_FLAG, obj::race, SET_FLAG, obj::skill, obj::slaying, obj::spell_tags, and obj::title.
Referenced by add_abilities(), arch_to_object(), artifact_msg(), cast_create_food(), cfapi_object_clone(), cfapi_object_create(), command_goto(), command_reset(), command_summon(), command_teleport(), copy_object_with_inv(), create_singularity(), do_harvest(), do_learn_spell(), enter_player_savebed(), explosion(), first_arch_pass(), forklightning(), generate_treasure(), get_jail_exit(), infect_object(), key_change_class(), load_objects(), magic_wall(), make_throw_ob(), move_bolt(), move_cone(), object_create_clone(), pay_from_container(), place_alchemy_objects(), place_fountain_with_specials(), place_special_exit(), polymorph_item(), sell_item(), setup(), START_TEST(), write_note(), write_rune(), and write_scroll().
objectlink* get_objectlink | ( | void | ) |
Allocates a new objectlink structure, initialises it, and returns a pointer to it.
Definition at line 45 of file links.c.
References CALLOC, fatal(), oblnk::id, oblnk::next, oblnk::ob, and OUT_OF_MEMORY.
Referenced by add_button_link(), add_friendly_object(), add_to_racelist(), and get_racelist().
oblinkpt* get_objectlinkpt | ( | void | ) |
Allocates a new oblinkpt structure, initialises it, and returns a pointer to it.
Definition at line 65 of file links.c.
References fatal(), oblinkpt::link, oblinkpt::next, OUT_OF_MEMORY, and oblinkpt::value.
Referenced by add_button_link().
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.
Changed 2004-02-12 - if the player is setting at the play again prompt, he is removed, and we don't want to treat him as an owner of anything, so check removed flag. I don't expect that this should break anything - once an object is removed, it is basically dead anyways.
op | item to search owner of. |
Definition at line 524 of file object.c.
References obj::count, FLAG_FREED, FLAG_REMOVED, llevError, LOG(), obj::owner, obj::ownercount, and QUERY_FLAG.
Referenced by adj_attackroll(), attack_message(), attack_ob_simple(), blind_living(), cast_spell(), cfapi_object_get_property(), command_kill_pets(), command_showpets(), copy_owner(), explode_bullet(), find_target_for_friendly_spell(), fire_arch_from_position(), fix_summon_pet(), friendly_fire(), get_pet_enemy(), get_real_owner(), hit_player(), hit_with_one_attacktype(), infect_object(), kill_object(), monster_cast_spell(), monster_use_bow(), monster_use_range(), monster_use_scroll(), monster_use_skill(), move_ball_spell(), move_golem(), move_missile(), move_monster(), move_player_attack(), move_swarm_spell(), peacemaker_type_process(), pet_move(), poison_living(), polymorph_living(), push_ob(), remove_all_pets(), scare_creature(), START_TEST(), steal(), summon_golem(), summon_object(), tailor_god_spell(), terminate_all_pets(), and use_oratory().
const char* get_periodofday | ( | const int | index | ) |
give access to weekday names
Definition at line 113 of file time.c.
References PERIODS_PER_DAY, and periodsofday.
Referenced by cfapi_get_periodofday_name().
Finds the player carrying an object.
op | item for which we want the carrier (player). |
Definition at line 356 of file object.c.
References obj::env, PLAYER, and obj::type.
Referenced by cfapi_object_find(), cfapi_object_set_property(), decrease_ob_nr(), drain_wand_charge(), identify(), increase_ob_nr(), insert_ob_in_ob(), lamp_type_apply(), lighter_type_apply(), pick_up_object(), remove_force(), remove_ob(), send_changed_object(), and START_TEST().
int get_power_from_ench | ( | int | ench | ) |
Definition at line 240 of file item.c.
Referenced by calc_item_power(), and fix_generated_item().
godlink* get_rand_god | ( | void | ) |
Returns a random god.
Definition at line 111 of file holy.c.
References first_god, glnk::id, llevError, LOG(), and glnk::next.
Referenced by god_info_msg().
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 1316 of file readable.c.
References obj::level, llevError, LOG(), mon, oblnk::next, nrofmon, and oblnk::ob.
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 697 of file recipe.c.
References recipestruct::chance, get_random_recipelist(), recipeliststruct::items, recipestruct::next, and recipeliststruct::total_chance.
Referenced by alchemy_failure_effect().
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. if the objects are not on maps, results are also likely to be unexpected
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 2504 of file map.c.
References adjacent_map(), rv_vector::direction, rv_vector::distance, rv_vector::distance_x, rv_vector::distance_y, find_dir_2(), isqrt(), obj::map, obj::more, rv_vector::part, obj::x, and obj::y.
Referenced by can_detect_enemy(), can_hit(), find_enemy(), flee_player(), get_pet_enemy(), monster_cast_spell(), monster_use_bow(), monster_use_scroll(), move_monster(), path_to_player(), player_can_view(), process_players1(), and spring_trap().
void get_rangevector_from_mapcoord | ( | const mapstruct * | m, |
int | x, | ||
int | y, | ||
const object * | op2, | ||
rv_vector * | retval, | ||
int | flags | ||
) |
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. flags has no meaning for this function at this time - I kept it in to be more consistant with the above function and also in case they are needed for something in the future. Also, 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. |
flags | unused. |
Definition at line 2573 of file map.c.
References adjacent_map(), rv_vector::direction, rv_vector::distance, rv_vector::distance_x, rv_vector::distance_y, find_dir_2(), isqrt(), obj::map, rv_vector::part, obj::x, and obj::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 2181 of file readable.c.
References last_readable_subtype, and obj::subtype.
Referenced by apply_sign(), and book_type_apply().
Gets a region from a map.
m | map we want the region of. |
Definition at line 85 of file region.c.
References get_name_of_region_for_map(), and get_region_by_name().
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(), and process_map().
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 57 of file region.c.
References regiondef::fallback, first_region, llevDebug, llevInfo, LOG(), regiondef::name, and regiondef::next.
Referenced by assign_region_parents(), current_region_info(), get_region_by_map(), and load_map_header().
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. Can be NULL. |
Definition at line 132 of file region.c.
References first_region, regiondef::longname, regiondef::name, regiondef::next, regiondef::parent, and strcasecmp().
Referenced by command_who().
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 229 of file region.c.
References get_region_longname(), llevDebug, LOG(), regiondef::longname, regiondef::name, and regiondef::parent.
Referenced by command_whereabouts(), current_map_info(), current_region_info(), get_region_longname(), get_who_escape_code_value(), write_map_page(), write_region_index(), and write_region_page().
const char* get_region_msg | ( | const region * | r | ) |
Gets a message for a region.
r | region. Can't be NULL. |
Definition at line 250 of file region.c.
References get_region_msg(), llevDebug, LOG(), regiondef::msg, regiondef::name, and regiondef::parent.
Referenced by current_region_info(), get_region_msg(), and write_region_page().
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 336 of file region.c.
References CALLOC, fatal(), and OUT_OF_MEMORY.
Referenced by main(), and parse_regions().
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 3283 of file object.c.
References permute(), SIZEOFFREE, SIZEOFFREE1, and SIZEOFFREE2.
Referenced by find_nearest_living_creature(), and get_pet_enemy().
const char* get_season_name | ( | const int | index | ) |
give access to season names
Definition at line 134 of file time.c.
References season_name, and SEASONS_PER_YEAR.
Referenced by cfapi_get_season_name(), and START_TEST().
get_split_ob(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 2313 of file object.c.
References decrease_ob_nr(), llevDebug, LOG(), obj::name, obj::nrof, object_create_clone(), and snprintf().
Referenced by animate_weapon(), apply_container(), apply_special(), cfapi_object_split(), do_throw(), drop_object(), fire_bow(), improve_armour(), lamp_type_apply(), lighter_type_apply(), loot_object(), pick_up_object(), put_object_in_sack(), and START_TEST().
void get_tod | ( | timeofday_t * | tod | ) |
const typedata* get_typedata | ( | int | itemtype | ) |
itemtype | item type for which to return typedata. |
Definition at line 352 of file item.c.
References item_types_size.
Referenced by CREResourcesWindow::fillArtifacts(), parse_shop_string(), query_cost(), query_cost_string(), and CREFacePanel::setFace().
const typedata* get_typedata_by_name | ( | const char * | name | ) |
name | item name for which to return typedata. Singular form is preferred. |
Definition at line 372 of file item.c.
References item_types_size, llevInfo, and LOG().
Referenced by parse_shop_string().
const char* get_weekday | ( | const int | index | ) |
give access to weekday names
Definition at line 127 of file time.c.
References DAYS_PER_WEEK, and weekdays.
Referenced by cfapi_get_weekday_name(), and START_TEST().
Fixes the given object, giving it the abilities and titles it should have due to the second artifact-template.
Definition at line 1884 of file treasure.c.
References add_abilities(), add_string(), free_string(), MAX_BUF, obj::name, snprintf(), and obj::title.
Referenced by cast_create_missile(), command_create(), generate_artifact(), and make_item_from_recipe().
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 1689 of file living.c.
References arch_to_object(), CLEAR_FLAG, obj::contr, liv::exp, FLAG_CAN_USE_SKILL, get_archetype_by_skill_name(), insert_ob_in_ob(), pl::last_skill_exp, pl::last_skill_ob, obj::level, llevError, LOG(), SKILL, obj::stats, and obj::subtype.
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 151 of file exp.c.
References obj::below, FALSE, obj::inv, SPELL, SPELLBOOK, TRUE, and obj::type.
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 87 of file map.c.
References first_map, mapdef::next, and mapdef::path.
Referenced by cfapi_map_has_been_loaded(), command_reset(), is_legal_2ways_exit(), 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 322 of file los.c.
References obj::glow_radius.
Referenced by can_see_enemy(), and hideability().
void i18n_init | ( | void | ) |
Initializes the i18n subsystem.
Definition at line 108 of file languages.c.
References convert_newline(), Settings::datadir, HUGE_BUF, i18n_strings, language_codes, llevDebug, llevError, LOG(), MAX_BUF, NUM_LANGUAGES, settings, snprintf(), and strerror_local().
Referenced by init_library().
const char* i18n_translate | ( | int | language, |
int | id | ||
) |
Translates a given i18n string into the provided language.
language | The language numerical code to translate the string to |
id | The i18n string identifier |
Definition at line 73 of file languages.c.
References i18n_strings, NUM_I18N_STRINGS, and NUM_LANGUAGES.
Referenced by command_afk(), command_applymode(), command_body(), command_bowmode(), command_brace(), command_debug(), command_explore(), command_help(), command_kill_pets(), command_language(), command_listen(), command_output_count(), command_output_sync(), command_passwd(), command_peaceful(), command_petmode(), command_players(), command_quit(), command_resistances(), command_save(), command_showpets(), command_sound(), command_statistics(), command_title(), command_usekeys(), command_whereabouts(), command_wimpy(), command_wizcast(), command_wizpass(), current_map_info(), current_region_info(), help_topics(), list_players(), malloc_info(), map_info(), receive_player_password(), and show_commands().
void identify | ( | object * | op | ) |
Identifies an item. Supposed to fix face-values as well here, but later.
op | item to identify. Can be already identified without ill effects. |
Definition at line 1447 of file item.c.
References add_refcount(), obj::arch, CLEAR_FLAG, archt::clone, obj::env, esrv_update_item(), FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_KNOWN_BLESSED, FLAG_KNOWN_CURSED, FLAG_KNOWN_MAGICAL, FLAG_NO_SKILL_IDENT, free_string(), get_player_container(), obj::inv, obj::map, obj::name, obj::name_pl, PLAYER, POTION, present(), QUERY_FLAG, obj::randomitems, SET_FLAG, obj::title, obj::type, UP_OBJ_FACE, UPD_ALL, UPD_FACE, UPD_NAME, update_object(), obj::x, and obj::y.
Referenced by auto_apply(), cast_identify(), cfapi_object_identify(), do_skill_ident2(), identify_altar_type_move_on(), potion_type_apply(), scroll_type_apply(), sell_item(), and spellbook_type_apply().
void init_anim | ( | void | ) |
Loads the lib/animations file. Can be called multiple times without ill effects.
Definition at line 55 of file anim.c.
References add_string(), animations, animations_allocated, Settings::datadir, animations_struct::faces, animations_struct::facings, find_face(), llevDebug, llevError, LOG(), MAX_ANIMATIONS, MAX_BUF, animations_struct::name, animations_struct::num, animations_struct::num_animations, num_animations, settings, snprintf(), and strerror_local().
Referenced by cctk_init_std_archetypes(), and init_library().
void init_archetype_pointers | ( | void | ) |
Initialize global archtype pointers:
Definition at line 66 of file treasure.c.
References amulet_arch, crown_arch, find_archetype(), ring_arch, staff_arch, and warn_archetypes.
Referenced by init_beforeplay().
void init_archetypes | ( | void | ) |
Initialises the internal linked list of archetypes (read from file). Then the global empty_archetype pointer is initialised. Can be called multiple times, will just return.
Definition at line 195 of file arch.c.
References arch_init, empty_archetype, find_archetype(), first_archetype, and load_archetypes().
Referenced by cctk_init_std_archetypes(), init_beforeplay(), init_library(), main(), and START_TEST().
void init_artifacts | ( | void | ) |
Builds up the lists of artifacts from the file in the libdir. Can be called multiple times without ill effects.
Definition at line 1539 of file treasure.c.
References add_string(), artifactstruct::allowed, obj::arch, artifact_init, artifactstruct::chance, close_and_delete(), Settings::datadir, artifactstruct::difficulty, find_artifactlist(), first_artifactlist, get_empty_artifact(), get_empty_artifactlist(), HUGE_BUF, artifactstruct::item, artifactliststruct::items, llevDebug, llevError, LO_LINEMODE, load_object(), LOG(), MAX_BUF, linked_char::name, obj::name, artifactstruct::next, artifactliststruct::next, linked_char::next, nrofallowedstr, nrofartifacts, open_and_uncompress(), reset_object(), settings, snprintf(), artifactliststruct::total_chance, artifactliststruct::type, and obj::type.
Referenced by init_beforeplay(), and main().
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 102 of file los.c.
References FABS, blstr::index, MAP_CLIENT_X, MAP_CLIENT_Y, set_block(), and SPACE_BLOCK.
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 170 of file exp.c.
References close_and_delete(), Settings::confdir, levels, llevDebug, llevError, LOG(), MAX_BUF, Settings::max_level, open_and_uncompress(), settings, snprintf(), and strncasecmp().
Referenced by init_library().
void init_formulae | ( | void | ) |
Builds up the lists of formula from the file in the libdir. -b.t.
Definition at line 159 of file recipe.c.
References add_string(), recipestruct::arch_name, recipestruct::arch_names, build_stringlist(), recipestruct::cauldron, recipestruct::chance, check_formulae(), check_recipe(), close_and_delete(), Settings::datadir, recipestruct::diff, recipestruct::exp, formulalist, get_empty_formula(), recipestruct::index, recipestruct::ingred, init_recipelist(), recipeliststruct::items, recipestruct::keycode, llevDebug, llevError, LOG(), MAX_BUF, linked_char::name, recipestruct::next, recipeliststruct::next, linked_char::next, numb_ingred(), recipeliststruct::number, open_and_uncompress(), settings, recipestruct::skill, snprintf(), strtoint(), recipestruct::title, recipeliststruct::total_chance, recipestruct::transmute, and recipestruct::yield.
Referenced by init_beforeplay(), and main().
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 263 of file init.c.
References add_string(), amulet_arch, animations, animations_allocated, exiting, first_archetype, first_artifactlist, first_friendly_object, first_map, first_map_ext_path, first_player, first_treasurelist, init_defaults(), logfile, Settings::logfilename, nrofallowedstr, nrofartifacts, nroftreasures, num_animations, ring_arch, staff_arch, statistics, trying_emergency_save, undead_name, and warn_archetypes.
Referenced by cctk_init_std_archetypes(), init_library(), 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 63 of file holy.c.
References add_god_to_list(), archt::clone, first_archetype, GOD, llevDebug, LOG(), archt::next, and obj::type.
Referenced by init_beforeplay(), main(), and setup().
void init_hash_table | ( | void | ) |
Initialises the hash-table used by the shared string library.
Definition at line 47 of file shstr.c.
References hash_table, and TABLESIZE.
Referenced by cctk_init_std_archetypes(), init_library(), 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() and init_function_pointers(). Good idea to also call init_vars and init_hash_table if you are doing any object loading.
Definition at line 201 of file init.c.
References i18n_init(), init_anim(), init_archetypes(), init_attackmess(), init_block(), init_clocks(), init_dynamic(), init_emergency_mappath(), init_environ(), init_experience(), init_globals(), init_hash_table(), init_objects(), init_vars(), read_bmap_names(), and read_smooth().
Referenced by init(), and main().
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 49 of file ob_types.c.
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 66 of file ob_types.c.
References init_ob_method_struct(), and OBJECT_TYPE_MAX.
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 347 of file init.c.
References active_objects, FLAG_FREED, FLAG_REMOVED, free_objects, obj::next, objarray, objects, obj::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 952 of file readable.c.
References init_book_archive(), init_mon_info(), init_msgfile(), llevDebug, and LOG().
Referenced by init_beforeplay(), and main().
void init_regions | ( | void | ) |
Initialises regions from the regions file.
Definition at line 301 of file region.c.
References assign_region_parents(), close_and_delete(), Settings::datadir, first_region, llevDebug, llevError, LOG(), Settings::mapdir, MAX_BUF, open_and_uncompress(), parse_regions(), Settings::regions, settings, and snprintf().
Referenced by init_beforeplay(), and main().
void init_vars | ( | void | ) |
Referenced by cctk_init_std_archetypes(), and init_library().
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 1992 of file object.c.
References obj::above, obj::below, can_merge(), check_move_on(), CLEAR_FLAG, obj::contr, pl::do_los, dump_object(), FLAG_ALIVE, FLAG_APPLIED, FLAG_FREED, FLAG_INV_LOCKED, FLAG_IS_FLOOR, FLAG_NO_PICK, FLAG_NO_STEAL, FLAG_OVERLAY_FLOOR, FLAG_REMOVED, free_object(), get_map_from_coord(), GET_MAP_OB, GET_MAP_TOP, obj::glow_radius, obj::head, pl::hidden, INS_ABOVE_FLOOR_ONLY, INS_BELOW_ORIGINATOR, INS_MAP_LOAD, INS_NO_MERGE, INS_NO_WALK_ON, insert_ob_in_map(), LAMP, llevError, LOG(), obj::map, MAP_DARKNESS, merge_spell(), obj::more, MOVE_FLY_HIGH, MOVE_FLY_LOW, obj::move_type, obj::nrof, obj::other_arch, out_of_map(), OUT_OF_REAL_MAP, obj::ox, obj::oy, PLAYER, mapdef::players, QUERY_FLAG, obj::range, remove_ob(), SET_MAP_OB, SET_MAP_TOP, pl::socket, obj::speed, obj::speed_left, SPELL_EFFECT, stringbuffer_finish(), stringbuffer_new(), pl::transport, obj::type, UP_OBJ_INSERT, update_all_los(), socket_struct::update_look, update_object(), obj::x, and obj::y.
Referenced by alchemy_failure_effect(), animate_bomb(), animate_weapon(), auto_apply(), cast_cause_disease(), cast_cone(), cast_consecrate(), cast_create_obj(), cast_create_town_portal(), cast_destruction(), cast_detection(), cast_light(), cast_magic_storm(), cast_polymorph(), cast_raise_dead_spell(), cast_smite_spell(), cfapi_object_insert(), change_object(), charge_mana_effect(), command_create(), command_reset(), common_process_projectile(), cone_drop(), converter_type_move_on(), create_bomb(), dimension_door(), do_harvest(), do_throw(), drop_object(), enter_map(), explode_bullet(), explosion(), fire_arch_from_position(), fire_bolt(), fire_bow(), fire_bullet(), fire_swarm(), fix_multipart_object(), fix_stopped_item(), follow_owner(), forklightning(), free_object2(), gate_type_process(), generate_monster_arch(), handle_apply_yield(), hit_player(), hit_with_arrow(), insert_multisquare_ob_in_map(), insert_ob_in_map(), insert_ob_in_map_at(), key_change_class(), keyplace(), kill_object(), kill_player(), load_objects(), lock_and_hide_doors(), loot_object(), magic_wall(), make_map_floor(), make_map_walls(), mood_change(), move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_cone(), move_missile(), move_ob(), move_symptom(), pick_up(), place_alchemy_objects(), place_chest(), place_exits(), place_fountain_with_specials(), place_special_exit(), polymorph_item(), polymorph_living(), potion_type_apply(), push_ob(), put_a_monster(), put_decor(), put_doors(), put_floor(), put_treasure(), recharge(), remove_door(), remove_force(), remove_locked_door(), remove_unpaid_objects(), replace_insert_ob_in_map(), 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(), summon_golem(), summon_object(), surround_by_doors(), teleport(), transfer_ob(), transport_type_apply(), trap_show(), treasure_type_apply(), turn_one_transport(), write_mark(), and write_rune().
object* insert_ob_in_map_at | ( | object * | op, |
mapstruct * | m, | ||
object * | originator, | ||
int | flag, | ||
int | x, | ||
int | y | ||
) |
Same as insert_ob_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 1761 of file object.c.
References obj::arch, archt::clone, obj::head, insert_ob_in_map(), obj::map, obj::more, obj::x, and obj::y.
Referenced by apply_builder_floor(), apply_builder_item(), apply_builder_wall(), apply_builder_window(), apply_container(), cfapi_object_insert(), cfapi_object_teleport(), cfapi_object_transfer(), command_create(), convert_item(), fix_walls(), generate_monster_inv(), move_creator(), process_players1(), put_object_in_sack(), START_TEST(), and turn_one_transport().
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 2510 of file object.c.
References obj::above, add_weight(), obj::below, can_merge(), obj::carrying, CLEAR_FLAG, CONTAINER, obj::contr, obj::count, dump_object(), obj::env, esrv_send_item(), fix_object(), FLAG_APPLIED, FLAG_NO_FIX_PLAYER, FLAG_OBJ_ORIGINAL, FLAG_REMOVED, free_object(), get_player_container(), obj::glow_radius, obj::head, increase_ob_nr(), obj::inv, llevDebug, llevError, LOG(), obj::map, MAP_DARKNESS, obj::more, obj::name, obj::nrof, obj::ox, obj::oy, P_NEED_UPDATE, QUERY_FLAG, SET_FLAG, SET_MAP_FLAGS, SKILL, stringbuffer_finish(), stringbuffer_new(), obj::type, update_all_los(), update_position(), obj::weight, obj::x, and obj::y.
Referenced by add_abilities(), alchemy_failure_effect(), animate_weapon(), apply_container(), apply_special(), attempt_recipe(), auto_apply(), blind_living(), cast_bless(), cast_change_ability(), cast_create_town_portal(), cast_curse(), cast_word_of_recall(), cfapi_object_insert(), change_luck(), change_object(), command_create(), command_insert_into(), command_use(), confuse_living(), copy_object_with_inv(), create_aura(), do_harvest(), do_learn_spell(), do_symptoms(), do_throw(), do_turn(), dragon_ability_gain(), drain_specific_stat(), eat_special_food(), find_or_create_connection_for_map(), fix_container(), fix_generated_item(), give_skill_by_name(), god_gives_present(), grant_immunity(), handle_apply_yield(), hit_with_arrow(), improve_armour(), infect_object(), insert_objects(), keyplace(), kill_player(), lamp_type_apply(), lighter_type_apply(), local_check_loaded_object(), magic_wall(), make_object_glow(), make_throw_ob(), monster_check_pickup(), move_aura(), move_marker(), object_create_clone(), pick_up_object(), place_chest(), poison_living(), potion_type_apply(), put_object_in_sack(), put_treasure(), remove_force(), save_throw_object(), second_arch_pass(), sell_item(), slow_living(), START_TEST(), stick_arrow(), swap_random_stats(), transmute_item_to_flower(), transport_type_apply(), write_note(), write_rune(), and write_scroll().
int is_dragon_pl | ( | const object * | op | ) |
Checks if player is a dragon.
op | player to check. Can be NULL. |
Definition at line 125 of file player.c.
References obj::arch, archt::clone, PLAYER, obj::race, and obj::type.
Referenced by check_login(), command_resistances(), command_title(), describe_item(), describe_monster(), dragon_eat_flesh(), find_best_player_hth_skill(), food_type_apply(), 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 Lauwenmark - 31/07/05
op | item to check |
Definition at line 157 of file friend.c.
References first_friendly_object, oblnk::next, and oblnk::ob.
Referenced by add_friendly_object(), cfapi_object_get_property(), and cfapi_object_set_property().
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 1312 of file item.c.
References liv::ac, AMULET, ARMOUR, ATNR_PHYSICAL, BOOTS, liv::dam, liv::exp, FLAG_ALIVE, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_STEALTH, FLAG_XRAYS, liv::food, get_attr_value(), GIRDLE, GLOVES, HELMET, liv::hp, liv::luck, obj::magic, obj::move_type, NROFATTACKS, NUM_STATS, POTION, POWER_CRYSTAL, QUERY_FLAG, obj::resist, RING, ROD, SCROLL, SHIELD, liv::sp, SPELLBOOK, obj::stats, obj::title, obj::type, WAND, and liv::wc.
Referenced by cast_detection(), cfapi_object_get_property(), do_skill_detect_magic(), 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 192 of file player.c.
References obj::arch, obj::below, obj::inv, is_wraith_pl(), obj::name, PLAYER, and obj::type.
Referenced by food_type_apply().
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.c.
References obj::arch, obj::below, obj::inv, obj::name, PLAYER, and obj::type.
Referenced by eat_special_food(), food_type_apply(), hit_with_one_attacktype(), and is_old_wraith_pl().
int isqrt | ( | int | n | ) |
Computes the square root. Based on (n+1)^2 = n^2 + 2n + 1 given that 1^2 = 1, then 2^2 = 1 + (2 + 1) = 1 + 3 = 4 3^2 = 4 + (4 + 1) = 4 + 5 = 1 + 3 + 5 = 9 4^2 = 9 + (6 + 1) = 9 + 7 = 1 + 3 + 5 + 7 = 16 ... In other words, a square number can be express as the sum of the series n^2 = 1 + 3 + ... + (2n-1)
n | number of which to compute the root. |
Definition at line 573 of file porting.c.
Referenced by expand_lighted_sight(), find_ingred_cost(), fix_flesh_item(), get_rangevector(), get_rangevector_from_mapcoord(), play_sound_map(), roguelike_place_room(), spell_failure(), stand_in_light(), and value_limit().
This is a subset of the parse_id command. Basically, name can be a string seperated 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 3901 of file object.c.
References obj::contr, pl::count, obj::custom_name, FLAG_CURSED, FLAG_DAMNED, FLAG_INV_LOCKED, FLAG_KNOWN_CURSED, FLAG_UNPAID, HUGE_BUF, MAX_BUF, obj::name, obj::name_pl, PLAYER, query_base_name(), QUERY_FLAG, query_name(), query_short_name(), strcasecmp(), strncasecmp(), and obj::type.
Referenced by check_pick(), command_drop(), command_take(), find_best_apply_object_match(), START_TEST(), and write_rune().
Checks if op can be combined with art.
Definition at line 1849 of file treasure.c.
References artifactstruct::allowed, obj::arch, llevDebug, LOG(), linked_char::name, obj::name, archt::name, and linked_char::next.
Referenced by generate_artifact(), and locate_recipe_artifact().
sint64 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 1788 of file living.c.
References levels, Settings::max_level, and settings.
Referenced by calculate_difficulty(), command_statistics(), place_monsters(), player_lvl_adj(), and show_skills().
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 | ||
) |
Referenced by check_login(), first_arch_pass(), init_artifacts(), load_objects(), load_unique_objects(), and second_arch_pass().
mapstruct* load_original_map | ( | const char * | filename, |
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
filename | map path. |
flags | how to interpret the path, and misc information (can be combined):
|
Definition at line 1226 of file map.c.
References allocate_map(), calculate_difficulty(), close_and_delete(), mapdef::compressed, create_overlay_pathname(), create_pathname(), delete_map(), EVENT_MAPLOAD, execute_global_event(), get_linked_map(), mapdef::in_memory, llevDebug, llevError, load_map_header(), load_objects(), LOG(), MAP_BLOCK, MAP_DIFFICULTY, MAP_IN_MEMORY, MAP_LOADING, MAP_OVERLAY, MAP_PLAYER_UNIQUE, MAP_STYLE, MAX_BUF, open_and_uncompress(), mapdef::path, set_map_reset_time(), snprintf(), strerror_local(), and update_buttons().
Referenced by enter_fixed_template_map(), enter_unique_map(), load_overlay_map(), load_style_map(), load_temporary_map(), and ready_map_name().
Finds an artifact for a recipe.
rp | recipe |
idx | index of ingredient in recipe. |
Definition at line 637 of file recipe.c.
References recipestruct::arch_name, create_archetype(), find_artifactlist(), free_object(), artifactstruct::item, artifactliststruct::items, legal_artifact_combination(), obj::name, artifactstruct::next, recipestruct::title, and obj::type.
Referenced by check_recipe(), dump_alchemy(), dump_alchemy_costs(), and make_item_from_recipe().
void LOG | ( | LogLevel | logLevel, |
const char * | format, | ||
... | |||
) |
Logs a message to stderr, or to file. Or discards the message if it is of no importance, and none have asked to hear messages of that logLevel.
See include/logger.h for possible logLevels. Messages with llevInfo and llevError are always printed, regardless of debug mode.
logLevel | level of the message |
format | message to log. Works like printf() and such |
Definition at line 63 of file logger.c.
References clean_tmp_files(), Settings::debug, emergency_save(), exiting, llevError, llevInfo, LOG(), Settings::log_timestamp, Settings::log_timestamp_format, logfile, Settings::logfilename, loglevel_names, MAX_ERRORS, nroferrors, reopen_logfile, settings, TRUE, trying_emergency_save, and vsnprintf.
Referenced by add_abilities(), add_book(), add_book_to_list(), add_button_link(), add_friendly_object(), add_god_to_list(), add_score(), add_to_buffer(), adj_attackroll(), alchemy_failure_effect(), allocate_map(), animate_object(), animate_weapon(), CREUtils::animationNode(), append_spell(), apply_builder_remove(), apply_cmd(), apply_container(), apply_map_builder(), apply_special(), arch_to_object(), arrow_type_process(), artifact_msg(), assign_region_parents(), attempt_do_alchemy(), attempt_recipe(), block_until_new_connection(), blocked_link(), calc_alch_danger(), calc_skill_exp(), can_detect_enemy(), can_pay(), cast_cone(), cast_consecrate(), cast_create_missile(), cast_create_town_portal(), cast_dust(), cast_light(), cast_spell(), cast_wonder(), cast_word_of_recall(), cfapi_log(), cfapi_object_delete(), cfapi_object_insert(), cfapi_object_remove(), change_attr_value(), change_book(), change_exp(), change_luck(), change_object(), check_altar_sacrifice(), check_faceset_fallback(), check_formulae(), check_login(), check_recipe(), check_special_prayers(), check_spells(), check_treasurelist(), check_trigger(), check_weapon_power(), checkbanned(), checkdm(), choose_cult_monster(), clean_friendly_list(), clean_tmp_files(), cleanup(), command_arrest(), command_banish(), command_create(), command_help(), command_loadplugin(), command_pickup(), command_reset(), command_unloadplugin(), command_use(), command_whereabouts(), common_ob_move_on(), common_pre_ob_move_on(), common_process_projectile(), communicate(), compile_info(), content_recipe_value(), convert_item(), copy_file(), create_one_treasure(), create_treasure(), dead_player(), deathstrike_living(), deep_swamp_type_process(), delete_map(), determine_holy_arch(), die_roll(), display_high_score(), display_who_entry(), do_forget_spell(), do_harvest(), do_learn_spell(), do_server(), do_skill(), do_skill_attack(), do_throw(), dragon_ability_gain(), drain_specific_stat(), draw_client_map(), draw_ext_info(), draw_magic_map(), dump_alchemy(), dump_alchemy_costs(), dump_all_archetypes(), dump_all_objects(), dump_friendly_objects(), dump_map(), emergency_save(), enter_exit(), enter_fixed_template_map(), enter_map(), enter_player_savebed(), enter_unique_map(), esrv_add_spells(), esrv_draw_look(), esrv_move_object(), esrv_remove_spell(), esrv_send_animation(), esrv_send_face(), esrv_update_item(), esrv_update_stats(), examine_cmd(), execute_event(), execute_newserver_command(), expand_lighted_sight(), explode_bullet(), find_animation(), find_archetype(), find_color(), find_doors_in_room_recursive(), find_mon_throw_ob(), find_nearest_living_creature(), find_recipe(), find_throw_ob(), find_title(), find_transmution_ob(), find_treasurelist(), fire_bow(), fire_misc_object(), fix_flesh_item(), fix_generated_item(), fix_multipart_object(), fix_object(), fix_weight(), flee_player(), flush_old_maps(), follow_owner(), follower_level_to_enchantments(), food_type_apply(), forbid_play(), free_all_archs(), free_all_god(), free_all_maps(), free_all_newserver(), free_all_object_data(), free_all_objects(), free_all_readable(), free_all_recipes(), free_map(), free_newsocket(), free_object2(), free_player(), free_races(), free_style_maps(), gate_type_process(), generate_artifact(), generate_monster_arch(), generate_monster_inv(), generate_treasure(), get_attack_mode(), get_face_fallback(), get_jail_exit(), get_name_of_region_for_map(), get_nearest_player(), get_object(), get_owner(), get_party_password(), get_player_archetype(), get_rand_god(), get_random_mon(), get_random_recipelist(), get_region_by_name(), get_region_longname(), get_region_msg(), get_split_ob(), get_titlelist(), get_typedata_by_name(), give_initial_items(), give_skill_by_name(), god_enchants_weapon(), god_info_msg(), god_intervention(), handle_client(), hit_map(), hit_player(), hit_with_one_attacktype(), i18n_init(), identify_altar_type_move_on(), improve_armour(), improve_weapon(), init_anim(), init_archetable(), init_artifacts(), init_attackmess(), init_book_archive(), init_clocks(), init_connection(), init_dynamic(), init_emergency_mappath(), init_experience(), init_formulae(), init_gods(), init_mon_info(), init_msgfile(), init_races(), init_readable(), init_regions(), init_server(), init_signals(), init_skills(), init_startup(), initPlugins(), inscribe_scroll_cmd(), insert_ob_in_map(), insert_ob_in_ob(), key_change_class(), key_roll_stat(), kill_object(), learn_skill(), leave(), legal_artifact_combination(), level_for_item(), link_player_skills(), load_archetypes(), load_map_header(), load_materials(), load_objects(), load_original_map(), load_overlay_map(), load_settings(), load_temporary_map(), load_treasure(), load_treasures(), load_unique_objects(), local_check_loaded_object(), lock_item_cmd(), LOG(), lookup_spell_by_name(), magic_from_difficulty(), magic_wall(), main(), make_formula_book(), make_item_from_recipe(), make_object_glow(), make_path_to_file(), make_throw_ob(), map2_add_ob(), mark_item_cmd(), merge_spell(), metaserver2_init(), metaserver2_writer(), metaserver_init(), metaserver_update(), mon_info_msg(), monster_cast_spell(), monster_check_apply(), monster_use_bow(), monster_use_range(), monster_use_skill(), move_cmd(), move_cone(), move_creator(), move_detector(), move_duplicator(), move_firewall(), move_golem(), move_monster(), move_ob(), move_player(), move_player_mover(), move_symptom(), move_teleporter(), msgfile_msg(), new_player_cmd(), numb_ob_inside(), open_and_uncompress_file(), operate_altar(), parse_dialog_information(), parse_regions(), parse_shop_string(), path_combine(), path_normalize(), pay_for_amount(), pay_for_item(), pay_from_container(), pet_move(), pick_up(), place_special_exit(), player_can_view(), player_changer_type_process(), plugins_init_plugin(), poison_living(), poison_type_apply(), poisoning_type_process(), polymorph_item(), potion_type_apply(), present(), present_arch(), process_events(), query_base_name(), query_cost(), query_money(), query_short_name(), random_roll(), random_roll64(), read_bmap_names(), read_client_images(), read_face_data(), read_map_log(), read_smooth(), ready_map_name(), rec_sigbus(), rec_sigint(), rec_sigpipe(), rec_sigquit(), rec_sigsegv(), rec_sigterm(), receive_player_password(), remove_all_pets(), remove_button_link(), remove_directory(), remove_friendly_object(), remove_ob(), remove_party(), reply_cmd(), resurrect_player(), save_life(), save_map(), save_objects(), save_player(), second_arch_pass(), sell_item(), send_exp_table(), send_image_sums(), send_news(), send_rules(), send_skill_info(), send_smooth(), send_spell_paths(), send_tick(), ServiceCtrlHandler(), set_block(), set_csport(), set_face_mode_cmd(), set_ob_key_value_s(), set_owner(), set_up_cmd(), shop_mat_type_move_on(), shop_specialisation_ratio(), should_arena_attack(), skill_ident(), slow_living(), SockList_ReadPacket(), SP_level_spellpoint_cost(), spellbook_type_apply(), spool(), ss_dump_table(), START_TEST(), summon_golem(), summon_object(), swap_below_max(), swap_map(), swap_stat(), tailor_god_spell(), tear_down_wall(), teleport(), tempnam_secure(), thrown_object_type_process(), transmute_materialname(), trigger_connected(), unapply_special(), update_button(), update_buttons(), update_ob_speed(), update_object(), update_position(), use_skill(), value_limit(), verify_button_links(), verify_player(), version_cmd(), write_book_archive(), write_map_log(), write_mark(), write_socket_buffer(), Write_To_Socket(), write_todclock(), and wrong_password().
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, seperated 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 485 of file utils.c.
References MAX_BUF.
Referenced by can_pay(), and describe_shop().
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 764 of file porting.c.
References llevDebug, llevError, LOG(), MAX_BUF, mkdir, S_ISDIR, SAVE_DIR_MODE, and strerror_local().
Referenced by create_destination(), key_change_class(), process_map(), save_map(), save_player(), and write_map_page().
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 667 of file los.c.
References pl::do_los, first_player, obj::map, socket_struct::mapx, socket_struct::mapy, pl::next, pl::ob, pl::socket, obj::x, and obj::y.
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 644 of file los.c.
References pl::blocked_los, first_player, obj::map, socket_struct::mapx, socket_struct::mapy, pl::next, pl::ob, pl::socket, obj::x, and obj::y.
Referenced by process_object().
void map_remove_unique_files | ( | const mapstruct * | map | ) |
Remove files containing the map's unique items.
map |
Definition at line 2619 of file map.c.
References create_items_path(), HUGE_BUF, mapdef::path, snprintf(), mapdef::unique, and unlink.
Referenced by command_reset().
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 1724 of file object.c.
References obj::above, obj::below, can_merge(), free_object(), increase_ob_nr(), obj::nrof, remove_ob(), and obj::weight.
Referenced by cfapi_object_merge(), command_lock_item(), command_rename_item(), fix_stopped_item(), get_payment(), hit_with_arrow(), lock_item_cmd(), stop_projectile(), and unapply_special().
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 insert_ob_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 1792 of file object.c.
References obj::above, obj::attacktype, liv::dam, obj::direction, obj::duration, FREE_AND_CLEAR, free_object(), GET_MAP_OB, obj::level, llevError, LOG(), obj::map, MAX, liv::maxhp, OB_SPELL_TAG_HASH, OB_SPELL_TAG_MATCH, obj::other_arch, obj::owner, obj::ownercount, obj::range, remove_ob(), obj::speed, obj::speed_left, Statistics::spell_hash_full, Statistics::spell_merges, SPELL_TAG_SIZE, obj::spell_tags, statistics, obj::stats, obj::subtype, obj::type, and liv::wc.
Referenced by explosion(), and insert_ob_in_map().
materialtype_t* name_to_material | ( | const char * | name | ) |
Convert materialname to materialtype_t
Definition at line 262 of file utils.c.
References materialt, _materialtype::name, and _materialtype::next.
Referenced by animate_weapon(), did_make_save_item(), query_base_name(), query_name(), and transmute_materialname().
int need_identify | ( | const object * | op | ) |
This function really should not exist - by default, any item not identified should need it.
op | item to check. |
Definition at line 1401 of file item.c.
References AMULET, ARMOUR, ARROW, BOOK, BOOTS, BOW, BRACERS, CLOAK, CLOSE_CON, CONTAINER, DRINK, FLESH, FOOD, GEM, GIRDLE, GLOVES, HELMET, HORN, INORGANIC, POISON, POTION, POWER_CRYSTAL, RING, ROD, SCROLL, SHIELD, SKILL, SKILL_TOOL, SKILLSCROLL, SPELLBOOK, obj::type, WAND, and WEAPON.
Referenced by cast_identify(), command_create(), describe_item(), do_skill_ident2(), examine(), give_initial_items(), identify_altar_type_move_on(), query_base_name(), query_cost(), and query_short_name().
sint64 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 104 of file exp.c.
References liv::ac, obj::attacktype, liv::Con, liv::dam, 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, liv::maxhp, liv::maxsp, MIN, NROFATTACKS, QUERY_FLAG, obj::resist, obj::speed, obj::stats, and liv::wc.
Referenced by print_monsters().
method_ret ob_apply | ( | object * | op, |
object * | applier, | ||
int | aflags | ||
) |
Applies an object.
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 59 of file ob_methods.c.
References ob_methods::apply, ob_methods::fallback, METHOD_UNHANDLED, obj::type, and type_methods.
Referenced by enter_exit(), manual_apply(), monster_use_scroll(), player_apply_below(), 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 seperate 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 525 of file map.c.
References AB_NO_PASS, obj::arch, archt::clone, get_map_flags(), GET_MAP_MOVE_BLOCK, obj::more, archt::more, MOVE_ALL, obj::move_type, OB_TYPE_MOVE_BLOCK, P_IS_ALIVE, P_OUT_OF_MAP, TRANSPORT, obj::type, obj::x, and obj::y.
Referenced by compute_path(), enter_map(), find_first_free_spot(), find_free_spot(), find_multi_free_spot_around(), find_multi_free_spot_within_radius(), move_creator(), summon_golem(), summon_object(), and turn_one_transport().
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 |
buf | Buffer that will contain the description |
size | Size of buf |
Definition at line 102 of file ob_methods.c.
References ob_methods::describe, ob_methods::fallback, obj::type, and type_methods.
Referenced by book_type_apply(), cast_identify(), do_skill_ident2(), examine(), and identify_altar_type_move_on().
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 122 of file ob_methods.c.
References ob_methods::fallback, METHOD_UNHANDLED, ob_methods::move_on, obj::type, and type_methods.
Referenced by check_move_on(), move_hole(), and remove_ob().
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 79 of file ob_methods.c.
References ob_methods::fallback, METHOD_UNHANDLED, ob_methods::process, obj::type, 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 144 of file ob_methods.c.
References ob_methods::fallback, METHOD_UNHANDLED, ob_methods::trigger, obj::type, and type_methods.
Referenced by trigger_connected().
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 741 of file arch.c.
References arch_to_object(), archt::clone, obj::head, obj::more, archt::more, obj::x, and obj::y.
Referenced by apply_map_builder(), cctk_create_game_object(), cfapi_object_create(), command_create(), command_use(), convert_item(), move_creator(), and START_TEST().
Create clone from object to another.
asrc | object to clone. |
Definition at line 3608 of file object.c.
References copy_object(), get_object(), obj::head, insert_ob_in_ob(), obj::more, and object_create_clone().
Referenced by cfapi_object_clone(), convert_item(), generate_monster_inv(), get_split_ob(), move_creator(), and object_create_clone().
Utility function.
op | object we want the environment of. Can't be NULL. |
Definition at line 339 of file object.c.
References obj::env.
Referenced by animate_bomb(), cfapi_object_set_property(), execute_event(), explode_bullet(), spring_trap(), and START_TEST().
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 2609 of file map.c.
References adjacent_map(), and obj::map.
Referenced by abort_attack(), adj_attackroll(), can_detect_enemy(), cfapi_object_on_same_map(), check_enemy(), find_enemy(), get_attack_mode(), get_pet_enemy(), move_ball_spell(), move_monster(), pet_move(), remove_all_pets(), and share_exp().
FILE* open_and_uncompress | ( | const char * | name, |
int | flag, | ||
int * | compressed | ||
) |
open_and_uncompress() first searches for the original filename. If it exist, then it opens it and returns the file-pointer.
If not, it does two things depending on the flag. If the flag is set, it tries to create the original file by appending a compression suffix to name and uncompressing it. If the flag is not set, it creates a pipe that is used for reading the file (NOTE - you can not use fseek on pipes).
The compressed pointer is set to nonzero if the file is compressed (and thus, fp is actually a pipe.) It returns 0 if it is a normal file.
name | the base file name without compression extension | |
flag | only used for compressed files:
| |
[out] | compressed | set to zero if the file was uncompressed |
Definition at line 724 of file porting.c.
References NROF_COMPRESS_METHODS, and open_and_uncompress_file().
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().
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 470 of file button.c.
References check_altar_sacrifice(), decrease_ob_nr(), ext_info_map(), llevError, LOG(), obj::map, obj::msg, MSG_TYPE_DIALOG, MSG_TYPE_DIALOG_ALTAR, NDI_BLACK, obj::slaying, and obj::value.
Referenced by altar_type_move_on(), check_trigger(), and identify_altar_type_move_on().
int out_of_map | ( | mapstruct * | m, |
int | x, | ||
int | y | ||
) |
this returns TRUE if the coordinates (x,y) are out of map m. This function also takes into account any tiling considerations, loading adjacant maps as needed. This is the function should always be used when it necessary to check for valid coordinates. This function will recursively call itself for the tiled maps.
m | map to consider. |
x | |
y | coordinates. |
Definition at line 2300 of file map.c.
References mapdef::in_memory, load_and_link_tiled_map(), MAP_HEIGHT, MAP_IN_MEMORY, MAP_WIDTH, out_of_map(), mapdef::tile_map, and mapdef::tile_path.
Referenced by animate_bomb(), attack_message(), cfapi_map_out_of_map(), cfapi_object_teleport(), command_create(), enter_map(), esrv_draw_look(), explode_bullet(), get_map_flags(), insert_ob_in_map(), look_at(), move_player_attack(), move_teleporter(), out_of_map(), pick_lock(), present(), and present_arch().
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 | ) |
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.
who | player |
op | what we are checking to gain the level (eg, skill) |
Definition at line 1731 of file living.c.
References obj::contr, die_roll(), dragon_level_gain(), draw_ext_info(), draw_ext_info_format(), esrv_update_spells(), liv::exp, obj::expmul, fix_object(), is_dragon_pl(), obj::level, level_exp(), pl::levgrace, pl::levhp, pl::levsp, MAX_BUF, Settings::max_level, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_LEVEL_GAIN, MSG_TYPE_ATTRIBUTE_LEVEL_LOSS, obj::name, NDI_RED, NDI_UNIQUE, PLAYER, player_lvl_adj(), PREFER_HIGH, settings, snprintf(), obj::stats, and obj::type.
Referenced by add_player_exp(), apply_death_exp_penalty(), command_addexp(), player_lvl_adj(), and subtract_player_exp().
Returns a pointer to the object We need to be VERY careful about using this, as we are returning a pointer to the CLONE object. -b.t.
godlnk | god to get object. |
Definition at line 133 of file holy.c.
References glnk::arch, and archt::clone.
Referenced by dump_gods(), find_god(), and god_info_msg().
Searches for any objects with a matching type variable at the given map and coordinates.
type | type to get. |
m | |
x | |
y | where to search. Must be valid position. |
Definition at line 2782 of file object.c.
References obj::above, GET_MAP_OB, llevError, LOG(), out_of_map(), and obj::type.
Referenced by identify(), remove_door(), and remove_locked_door().
Searches for any objects with a matching archetype at the given map and coordinates.
at | archetype to search for. |
m | |
x | |
y | where to search. Must be valid position. |
Definition at line 2755 of file object.c.
References obj::above, obj::arch, GET_MAP_OB, llevError, LOG(), and out_of_map().
Referenced by cast_create_town_portal(), cfapi_map_present_arch_by_name(), and save_throw_object().
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 2859 of file object.c.
References obj::arch, obj::below, and obj::inv.
Referenced by cast_heal(), cfapi_object_find_archetype_inside(), cfapi_object_get_property(), change_luck(), create_aura(), drain_specific_stat(), god_intervention(), kill_player(), perceive_self(), poison_living(), potion_type_apply(), slow_living(), and START_TEST().
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 2806 of file object.c.
References obj::below, obj::inv, and obj::type.
Referenced by blind_living(), cfapi_object_get_property(), 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 2840 of file object.c.
References obj::below, obj::inv, obj::name, and obj::type.
Referenced by become_follower(), cast_heal(), cfapi_object_get_property(), and confuse_living().
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 614 of file los.c.
References pl::blocked_los, obj::contr, draw_ext_info(), MAP_CLIENT_X, socket_struct::mapx, socket_struct::mapy, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DEBUG, NDI_UNIQUE, snprintf(), and pl::socket.
Referenced by command_printlos().
void print_monsters | ( | void | ) |
As dump_abilities(), but with an alternative way of output.
Definition at line 71 of file info.c.
References liv::ac, obj::arch, arch_to_object(), obj::attacktype, bitstostring(), liv::dam, liv::exp, first_archetype, FLAG_MONSTER, free_object(), liv::maxhp, archt::name, new_exp(), archt::next, NROFATTACKS, QUERY_FLAG, obj::resist, obj::stats, and liv::wc.
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 165 of file button.c.
References get_button_links(), trigger_connected(), and obj::value.
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 732 of file item.c.
References AMULET, obj::arch, archt::clone, _materialtype::description, FLAG_BEEN_APPLIED, FLAG_IDENTIFIED, obj::inv, IS_ARMOR, is_magical(), IS_WEAPON, obj::level, llevError, LOG(), M_SPECIAL, obj::magic, obj::material, obj::materialname, MAX_BUF, _materialtype::name, obj::name, obj::name_pl, name_to_material(), need_identify(), obj::nrof, QUERY_FLAG, RING, ring_desc(), ROD, safe_strcat(), SCROLL, SKILL, snprintf(), SPELLBOOK, obj::title, obj::type, WAND, and obj::weight.
Referenced by add_object_to_socklist(), add_shop_item(), cfapi_object_get_property(), change_spell(), command_rename_item(), esrv_update_item(), fire_misc_object(), item_matched_string(), matches_sacrifice(), 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 628 of file item.c.
References AMULET, ARMOUR, BOOTS, BOW, BRACERS, CLOAK, obj::container, CONTAINER, _materialtype::description, obj::env, FLAG_APPLIED, FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_INV_LOCKED, FLAG_KNOWN_BLESSED, FLAG_KNOWN_CURSED, FLAG_KNOWN_MAGICAL, FLAG_UNPAID, GIRDLE, GLOVES, HELMET, HORN, IS_ARMOR, IS_SHIELD, IS_WEAPON, obj::materialname, name_to_material(), QUERY_FLAG, query_short_name(), RING, ROD, safe_strcat(), SHIELD, SKILL, obj::type, WAND, and WEAPON.
Referenced by animate_weapon(), apply_builder_item(), apply_builder_remove(), apply_container(), apply_special(), attack_hth(), attempt_steal(), blind_living(), cast_smite_spell(), cast_spell(), cfapi_object_find_archetype_inside(), cfapi_object_forget_spell(), cfapi_object_get_property(), change_exp(), change_spell(), check_race_restrictions(), 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_mon_throw_ob(), find_player(), find_throw_ob(), get_payment(), god_examines_item(), hit_with_one_attacktype(), inventory(), item_matched_string(), kill_object(), leave(), legacy_ob_describe(), look_at(), make_formula_book(), mark_item_cmd(), npc_say(), pick_up_object(), player_apply(), polymorph_melt(), put_object_in_sack(), recharge(), recursive_roll(), sack_can_hold(), save_life(), sell_item(), singing(), skillscroll_type_apply(), spellbook_type_apply(), transport_type_apply(), treasure_type_apply(), unapply_for_ob(), unapply_special(), use_oratory(), and write_scroll().
int query_refcount | ( | sstring | str | ) |
This will return the refcount of the string str.
str | string which *must *have been returned from a previous add_string(). |
Definition at line 216 of file shstr.c.
Referenced by START_TEST().
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 551 of file item.c.
References AMULET, FLAG_BEEN_APPLIED, FLAG_IDENTIFIED, obj::inv, is_magical(), obj::level, llevError, LOG(), obj::magic, obj::name, obj::name_pl, need_identify(), obj::nrof, QUERY_FLAG, RING, ring_desc(), ROD, safe_strcat(), SCROLL, SKILL, snprintf(), SPELLBOOK, obj::title, obj::type, VERY_BIG_BUF, WAND, and obj::weight.
Referenced by cast_item_curse_or_curse(), cfapi_object_get_property(), command_lock_item(), dragon_ability_gain(), follower_remove_given_items(), god_gives_present(), item_matched_string(), player_attack_door(), query_name(), remove_force(), 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 424 of file item.c.
References obj::carrying, obj::nrof, snprintf(), and obj::weight.
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 51 of file utils.c.
References llevError, LOG(), liv::luck, MAX, MIN, PLAYER, obj::stats, and obj::type.
Referenced by alchemy_failure_effect(), apply_special(), 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_one_attacktype(), infect_object(), kill_player(), learn_skill(), mood_change(), potion_type_apply(), pray_at_altar(), push_ob(), recharge(), roll_ob(), scroll_failure(), singing(), spellbook_type_apply(), summon_object(), trap_disarm(), trap_see(), use_oratory(), and write_scroll().
sint64 random_roll64 | ( | sint64 | min, |
sint64 | 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 86 of file utils.c.
References llevError, LOG(), liv::luck, MAX, MIN, PLAYER, obj::stats, and obj::type.
Referenced by pray_at_altar().
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 70 of file re-cmp.c.
References Boolean, False, re_cmp(), re_cmp_step(), re_get_token(), re_init(), re_init_done, re_match_token(), re_substr, re_token_depth, rep_null_or_more, rep_null_or_once, rep_once, rep_once_or_more, and True.
Referenced by cfapi_system_re_cmp(), matches(), and re_cmp().
void read_bmap_names | ( | void | ) |
This reads the bmaps file to get all the bitmap names and stuff. It only needs to be done once, because it is player independent (ie, what display the person is on will not make a difference.)
Definition at line 198 of file image.c.
References BLANK_FACE_NAME, bmaps_checksum, compar(), Settings::datadir, EMPTY_FACE_NAME, FACE_FLOOR, find_color(), find_face(), llevDebug, llevError, LOG(), new_face_struct::magicmap, MAX_BUF, new_face_struct::name, bmappair::name, nroffiles, nrofpixmaps, new_face_struct::number, bmappair::number, read_face_data(), ROTATE_RIGHT, settings, SMOOTH_FACE_NAME, new_face_struct::smoothface, snprintf(), strdup_local(), strerror_local(), and new_face_struct::visibility.
Referenced by cctk_init_std_archetypes(), and init_library().
void read_client_images | ( | void | ) |
Loads all the image types into memory.
This way, we can easily send them to the client. We should really do something better than abort on any errors - on the other hand, these are all fatal to the server (can't work around them), but the abort just seems a bit messy (exit would probably be better.)
Couple of notes: We assume that the faces are in a continous block. This works fine for now, but this could perhaps change in the future
Function largely rewritten May 2000 to be more general purpose. The server itself does not care what the image data is - to the server, it is just data it needs to allocate. As such, the code is written to do such.
Definition at line 471 of file image.c.
References check_faceset_fallback(), face_info::checksum, close_and_delete(), face_sets::comment, face_info::data, Settings::datadir, face_info::datalen, face_sets::extension, face_sets::faces, face_sets::fallback, face_sets::fullname, HUGE_BUF, llevDebug, llevError, LOG(), MAX_FACE_SETS, MAX_IMAGE_SIZE, nrofpixmaps, open_and_uncompress(), face_sets::prefix, ROTATE_RIGHT, settings, face_sets::size, snprintf(), and strdup_local().
Referenced by init_server(), and main().
int read_smooth | ( | void | ) |
Reads the smooth file to know how to smooth datas. the smooth file if made of 2 elements lines. lines starting with # are comment the first element of line is face to smooth the next element is the 16x2 faces picture used for smoothing
Definition at line 348 of file image.c.
References Settings::datadir, find_face(), llevDebug, llevError, LOG(), MAX_BUF, settings, new_face_struct::smoothface, snprintf(), and strerror_local().
Referenced by cctk_init_std_archetypes(), and init_library().
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 1809 of file map.c.
References clean_tmp_map(), create_pathname(), decay_objects(), delete_map(), fix_auto_apply(), gettimeofday(), has_been_loaded(), mapdef::in_memory, mapdef::last_reset_time, llevDebug, load_original_map(), load_overlay_map(), load_temporary_map(), load_unique_objects(), LOG(), MAP_FLUSH, MAP_IN_MEMORY, MAP_LOADING, MAP_OVERLAY, MAP_PLAYER_UNIQUE, MAX_BUF, mapdef::outdoor, set_darkness_map(), and mapdef::tmpname.
Referenced by cast_create_town_portal(), cfapi_map_get_map(), enter_exit(), enter_fixed_template_map(), enter_random_template_map(), enter_unique_map(), init_dynamic(), is_legal_2ways_exit(), load_and_link_tiled_map(), place_exits(), process_map(), and START_TEST().
Checks if a region is a child of another.
child | region we want to test. |
r | potential parent. |
Definition at line 201 of file region.c.
References regiondef::name, regiondef::parent, and region_is_child_of_region().
Referenced by list_players(), and region_is_child_of_region().
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 79 of file ob_types.c.
References ob_methods::apply.
Referenced by init_type_armour_improver(), init_type_book(), init_type_cf_handle(), init_type_clock(), init_type_exit(), init_type_food(), init_type_lamp(), init_type_lighter(), 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 97 of file ob_types.c.
References ob_methods::describe.
Referenced by init_type_power_crystal().
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 106 of file ob_types.c.
References ob_methods::move_on.
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 88 of file ob_types.c.
References ob_methods::process.
Referenced by init_type_arrow(), init_type_blindness(), init_type_creator(), init_type_deep_swamp(), init_type_detector(), 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 115 of file ob_types.c.
References ob_methods::trigger.
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 700 of file button.c.
References mapdef::buttons, CLEAR_FLAG, FLAG_IS_LINKED, oblinkpt::link, llevError, LOG(), obj::map, oblnk::next, oblinkpt::next, oblnk::ob, and QUERY_FLAG.
Referenced by apply_builder_remove(), clean_object(), and delete_unique_items().
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 192 of file porting.c.
References closedir(), dirent::d_name, llevError, LOG(), MAX_BUF, opendir(), readdir(), remove_directory(), S_ISDIR, snprintf(), and unlink.
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 69 of file friend.c.
References CLEAR_FLAG, obj::count, first_friendly_object, FLAG_FRIENDLY, llevError, LOG(), obj::name, oblnk::next, and oblnk::ob.
Referenced by cfapi_object_set_property(), clear_object(), command_cast_spell(), command_kill_pets(), do_mood_floor(), enter_map(), free_object2(), get_nearest_player(), get_pet_enemy(), hit_player(), kill_object(), kill_player(), mood_change(), move_golem(), move_monster(), pet_move(), polymorph_living(), receive_play_again(), remove_all_pets(), terminate_all_pets(), and use_oratory().
void 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 update_ob_speed, which will do the right thing based on the speed of the object.
op | object to remove. |
Definition at line 1070 of file object.c.
References obj::active_next, and obj::active_prev.
Referenced by load_objects(), and START_TEST().
void remove_ob | ( | 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 1515 of file object.c.
References obj::above, obj::arch, obj::below, obj::carrying, CLEAR_FLAG, obj::container, CONTAINER, obj::contr, obj::count, dump_object(), obj::env, esrv_del_item(), fix_object(), FLAG_APPLIED, FLAG_BLOCKSVIEW, FLAG_NO_APPLY, FLAG_NO_FIX_PLAYER, FLAG_REMOVED, get_map_from_coord(), GET_MAP_OB, get_player_container(), obj::glow_radius, obj::head, pl::hidden, mapdef::in_memory, obj::inv, llevError, LOG(), LOOK_OBJ, obj::map, MAP_SAVING, obj::more, obj::move_block, obj::move_off, obj::move_type, obj::name, archt::name, obj::nrof, ob_move_on(), obj::ox, obj::oy, P_NEED_UPDATE, mapdef::path, PLAYER, mapdef::players, QUERY_FLAG, remove_ob(), SET_FLAG, SET_MAP_FLAGS, SET_MAP_OB, SET_MAP_TOP, pl::socket, stringbuffer_finish(), stringbuffer_new(), sub_weight(), obj::type, UP_OBJ_REMOVE, update_all_los(), socket_struct::update_look, update_object(), update_position(), was_destroyed, obj::weight, obj::x, and obj::y.
Referenced by add_abilities(), adjust_sign_msg(), alchemy_object(), animate_bomb(), animate_weapon(), apply_builder_floor(), apply_builder_item(), apply_builder_remove(), apply_builder_wall(), apply_builder_window(), apply_savebed(), arrow_type_process(), attempt_jump(), auto_apply(), become_follower(), blindness_type_process(), cast_consecrate(), cast_create_town_portal(), cast_dust(), cast_raise_dead_spell(), cfapi_object_insert(), cfapi_object_remove(), cfapi_object_teleport(), change_object(), check_altar_sacrifice(), check_bullet(), check_login(), check_special_prayers(), clean_object(), command_cast_spell(), command_free(), command_insert_into(), command_kick(), command_kill_pets(), command_remove(), command_reset(), common_process_projectile(), convert_item(), counterspell(), cure_disease(), decay_objects(), decrease_ob_nr(), delete_unique_items(), destroy_object(), dimension_door(), dispel_rune(), do_forget_spell(), do_harvest(), do_server(), do_throw(), do_turn(), drop(), drop_object(), enter_exit(), enter_map(), execute_event(), execute_word_of_recall(), explode_bullet(), explosion(), fire_bow(), fix_generated_item(), fix_stopped_arrow(), fix_walls(), follow_owner(), follower_remove_given_items(), free_all_objects(), free_no_drop(), free_object2(), free_player(), gate_type_process(), generate_treasure(), give_initial_items(), god_intervention(), hit_player(), hit_with_arrow(), insert_ob_in_map(), key_change_class(), key_confirm_quit(), kill_object(), kill_player(), lock_and_hide_doors(), loot_object(), merge_ob(), merge_spell(), monster_check_pickup(), monster_move_no_enemy(), move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_cone(), move_disease(), move_duplicator(), move_golem(), move_marker(), move_missile(), move_monster(), move_ob(), move_player_mover(), move_swarm_spell(), move_symptom(), move_teleporter(), nuke_map_region(), pay_from_container(), pet_move(), pick_up_object(), place_exits(), play_again(), player_apply(), poisoning_type_process(), polymorph_item(), polymorph_living(), polymorph_melt(), potion_type_apply(), process_object(), process_players1(), push_ob(), put_object_in_sack(), recharge(), remove_adjacent_doors(), remove_contents(), remove_door(), remove_force(), remove_locked_door(), remove_marking_runes(), remove_monsters(), remove_ob(), remove_symptoms(), remove_unpaid_objects(), replace_insert_ob_in_map(), 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(), summon_golem(), tear_down_wall(), teleport(), terminate_all_pets(), thrown_object_type_process(), transfer_ob(), transmute_item_to_flower(), transport_type_apply(), treasure_type_apply(), turn_one_transport(), and write_scroll().
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 840 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().
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 444 of file utils.c.
References snprintf().
Referenced by compilePython(), enter_fixed_template_map(), and enter_random_template_map().
void replace_insert_ob_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 2271 of file object.c.
References obj::above, obj::arch, arch_to_object(), find_archetype(), free_object(), GET_MAP_OB, INS_BELOW_ORIGINATOR, insert_ob_in_map(), obj::map, archt::name, remove_ob(), obj::x, and obj::y.
Referenced by save_throw_object(), 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 516 of file utils.c.
Referenced by command_party(), command_title(), and form_party().
void reset_object | ( | object * | op | ) |
Sets to 0 vital variables in an object.
op | object to reset. |
Definition at line 639 of file object.c.
References clear_object(), obj::lore, obj::materialname, obj::msg, obj::name, obj::name_pl, obj::race, obj::skill, obj::slaying, and obj::title.
Referenced by cfapi_object_reset(), check_login(), init_artifacts(), and START_TEST().
void reset_sleep | ( | void | ) |
Initialise all variables used in the timing routines.
Definition at line 141 of file time.c.
References GETTIMEOFDAY, last_time, PBUFLEN, process_max_utime, process_min_utime, process_tot_mtime, process_utime_save, psaveind, and pticks.
Referenced by block_until_new_connection(), 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 174 of file utils.c.
Referenced by 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(), convert_item(), counterspell(), decay_objects(), deep_swamp_type_process(), determine_god(), determine_holy_arch(), did_make_save_item(), do_harvest(), do_skill_ident2(), find_recipe(), fix_generated_item(), fix_stopped_arrow(), forklightning(), generate_monster(), generate_monster_arch(), generate_monster_inv(), hit_player(), hit_with_one_attacktype(), level_for_item(), move_ball_spell(), move_bolt(), move_creator(), move_firewall(), move_player_mover(), move_swarm_spell(), peacemaker_type_process(), pet_move(), polymorph(), polymorph_item(), polymorph_living(), reflwall(), resurrection_fails(), save_throw_object(), scroll_type_apply(), set_materialname(), shuffle_attack(), spell_find_dir(), spellbook_type_apply(), 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 1453 of file map.c.
References mapdef::background_music, mapdef::compressed, create_items_path(), create_overlay_pathname(), create_pathname(), mapdef::darkness, mapdef::difficulty, mapdef::enter_x, mapdef::enter_y, mapdef::fixed_resettime, free_all_objects(), mapdef::height, mapdef::in_memory, mapdef::is_template, mapdef::last_reset_time, llevDebug, llevError, LOG(), make_path_to_file(), MAP_IN_MEMORY, MAP_SAVING, mapdef::maplore, MAX_BUF, mapdef::msg, regiondef::name, mapdef::name, mapdef::nosmooth, mapdef::outdoor, mapdef::path, pclose, popen, print_shop_string(), mapdef::region, mapdef::reset_timeout, SAVE_ERROR_CLOSE, SAVE_ERROR_NO_PATH, SAVE_ERROR_OK, SAVE_ERROR_RCREATION, SAVE_ERROR_RRENAME, SAVE_ERROR_UCREATION, SAVE_ERROR_URENAME, SAVE_FLAG_NO_REMOVE, SAVE_MODE, SAVE_MODE_NORMAL, SAVE_MODE_OVERLAY, save_objects(), settings, mapdef::shopgreed, mapdef::shopitems, mapdef::shopmax, mapdef::shopmin, mapdef::shoprace, snprintf(), strerror_local(), mapdef::swap_time, TEMP_EXT, tempnam_local(), mapdef::tile_path, Settings::tmpdir, mapdef::tmpname, uncomp, mapdef::unique, unlink, and mapdef::width.
Referenced by clean_tmp_files(), command_overlay_save(), main(), START_TEST(), and swap_map().
int save_object | ( | FILE * | fp, |
object * | op, | ||
int | flag | ||
) |
long seconds | ( | void | ) |
Gets the seconds.
Definition at line 417 of file time.c.
References GETTIMEOFDAY.
Referenced by cftimer_create(), cftimer_process_timers(), flush_old_maps(), map_info(), read_map_log(), set_map_reset_time(), and swap_map().
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.
op | object we're modifying. |
magic | magic modifier. |
Definition at line 844 of file treasure.c.
References obj::arch, ARMOUR, ARMOUR_SPEED, archt::clone, obj::magic, obj::type, and obj::weight.
Referenced by add_abilities(), command_create(), and set_magic().
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 296 of file living.c.
References CHA, liv::Cha, CON, liv::Con, DEX, liv::Dex, INT, liv::Int, POW, liv::Pow, STR, liv::Str, WIS, and liv::Wis.
Referenced by apply_changes_to_player(), cast_change_ability(), change_abil(), check_stat_bounds(), eat_special_food(), fix_object(), set_ring_bonus(), swap_random_stats(), and swap_stat().
void set_cheat | ( | object * | op | ) |
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 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 2913 of file object.c.
References flag_inv(), FLAG_WAS_WIZ, and SET_FLAG.
Referenced by cfapi_object_set_property().
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 1566 of file living.c.
References atnr_is_dragon_enabled(), attacks, obj::contr, liv::exp, NROFATTACKS, pl::own_title, obj::resist, snprintf(), obj::stats, and pl::title.
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 2239 of file map.c.
References MAP_DEFAULTRESET, MAP_MAXRESET, MAP_RESET_TIMEOUT, MAP_WHEN_RESET, and seconds().
Referenced by load_original_map(), and swap_map().
void set_materialname | ( | object * | op, |
int | difficulty, | ||
materialtype_t * | nmt | ||
) |
Set the materialname and type for an item
Definition at line 314 of file utils.c.
References _materialtype::ac, liv::ac, add_string(), BOW, _materialtype::chance, CLOAK, liv::dam, _materialtype::damage, _materialtype::difficulty, GIRDLE, GLOVES, IS_ARMOR, IS_SHIELD, IS_WEAPON, _materialtype::magic, obj::magic, _materialtype::material, obj::material, obj::materialname, materialt, _materialtype::mod, _materialtype::name, _materialtype::next, NROFATTACKS, obj::resist, rndm(), _materialtype::sp, liv::sp, obj::stats, obj::type, _materialtype::value, obj::value, _materialtype::wc, liv::wc, _materialtype::weight, and obj::weight.
Referenced by fix_generated_item(), and local_check_loaded_object().
void set_max_time | ( | long | t | ) |
Sets the max speed. Can be called by a DM through the speed command.
t | new speed. |
Definition at line 256 of file time.c.
References max_time.
Referenced by command_speed().
int set_ob_key_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 3826 of file object.c.
References add_string(), FALSE, find_string(), free_string(), set_ob_key_value_s(), and TRUE.
Referenced by cfapi_object_set_key(), do_harvest(), generate_monster(), generate_monster_arch(), generate_monster_inv(), god_enchants_weapon(), god_gives_present(), set_object_face_other(), and store_spell_expiry().
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 clear_owner(op) |
Definition at line 564 of file object.c.
References clear_owner(), obj::count, llevError, LOG(), obj::owner, and obj::ownercount.
Referenced by animate_weapon(), cast_cause_disease(), cast_cone(), cast_smite_spell(), cfapi_object_set_property(), cone_drop(), copy_owner(), create_aura(), create_bomb(), do_mood_floor(), do_symptoms(), do_throw(), fire_arch_from_position(), fire_bolt(), fire_bow(), fire_bullet(), fire_swarm(), fix_summon_pet(), hit_player(), infect_object(), magic_wall(), mood_change(), polymorph_living(), START_TEST(), summon_golem(), summon_object(), use_oratory(), and write_rune().
int set_variable | ( | object * | op, |
char * | buf | ||
) |
void share_exp | ( | object * | op, |
sint64 | 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 2150 of file living.c.
References change_exp(), obj::contr, first_player, obj::level, pl::next, pl::ob, on_same_map(), pl::party, PLAYER, SK_EXP_TOTAL, and obj::type.
Referenced by kill_object(), and mood_change().
void sleep_delta | ( | void | ) |
sleep_delta checks how much time has elapsed since last tick. If it is less than max_time, the remaining time is slept with select().
Definition at line 195 of file time.c.
References GETTIMEOFDAY, last_time, log_time(), max_time, and process_utime_long_count.
Referenced by server_main().
void ss_dump_statistics | ( | char * | buf, |
size_t | size | ||
) |
A call to this function will cause the statistics to be dumped into specified buffer.
The routines will gather statistics if SS_STATISTICS is defined.
buf | buffer which will contain dumped information. |
size | buf's size. |
Definition at line 315 of file shstr.c.
References snprintf().
Referenced by command_strings().
char* ss_dump_table | ( | int | what, |
char * | buf, | ||
size_t | size | ||
) |
Dump the contents of the share string tables.
what | combination of flags:
|
buf | buffer that will contain total information if (what & SS_DUMP_TABLE). Left untouched else. |
size | buffer's size |
Definition at line 346 of file shstr.c.
References llevDebug, LOG(), _shared_string::next, _shared_string::refcount, snprintf(), SS_DUMP_TABLE, SS_DUMP_TOTALS, _shared_string::string, TABLESIZE, and TOPBIT.
Referenced by command_ssdumptable(), and command_strings().
const char* strcasestr_local | ( | const char * | s, |
const char * | find | ||
) |
Finds a substring in a string, in a case-insensitive manner.
s | string we're searching into. |
find | string we're searching for. |
Definition at line 461 of file porting.c.
References strncasecmp(), and tolower.
Referenced by display_high_score(), write_mark(), and write_note().
char* strdup_local | ( | const char * | str | ) |
A replacement of strdup(), since it's not defined at some unix variants.
str | string to duplicate. |
Definition at line 310 of file porting.c.
Referenced by add_shop_item(), build_stringlist(), cast_spell(), cfapi_system_strdup_local(), check_login(), draw_ext_info(), fire_bow(), form_party(), generate_random_map(), init_attackmess(), init_connection(), init_emergency_mappath(), load_dir(), load_map_header(), load_settings(), metaserver2_init(), parse_regions(), parse_shop_string(), push(), read_bmap_names(), read_client_images(), and read_map_log().
char* strerror_local | ( | int | errnum, |
char * | buf, | ||
size_t | size | ||
) |
This takes an err number and returns a string with a description of the error.
errnum | error we want the description of. |
buf | buffer to contain the description. |
size | buf's length. |
Definition at line 525 of file porting.c.
References snprintf().
Referenced by add_score(), command_help(), compile_info(), dead_player(), display_high_score(), do_server(), i18n_init(), init_anim(), init_races(), init_server(), load_original_map(), load_temporary_map(), make_path_to_file(), read_bmap_names(), read_face_data(), read_smooth(), save_map(), SockList_ReadPacket(), write_socket_buffer(), and Write_To_Socket().
void stringbuffer_append_printf | ( | StringBuffer * | sb, |
const char * | format, | ||
... | |||
) |
Definition at line 106 of file stringbuffer.c.
void stringbuffer_append_string | ( | StringBuffer * | sb, |
const char * | str | ||
) |
Definition at line 97 of file stringbuffer.c.
void stringbuffer_append_stringbuffer | ( | StringBuffer * | sb, |
const StringBuffer * | sb2 | ||
) |
Definition at line 133 of file stringbuffer.c.
char* stringbuffer_finish | ( | StringBuffer * | sb | ) |
Definition at line 78 of file stringbuffer.c.
sstring stringbuffer_finish_shared | ( | StringBuffer * | sb | ) |
Definition at line 87 of file stringbuffer.c.
void stringbuffer_finish_socklist | ( | StringBuffer * | sb, |
SockList * | sl | ||
) |
StringBuffer* stringbuffer_new | ( | void | ) |
Definition at line 64 of file stringbuffer.c.
void strip_endline | ( | char * | buf | ) |
Removes endline from buffer (modified in place).
Definition at line 431 of file utils.c.
References EOL_SIZE.
Referenced by parse_shop_string(), and send_news().
void strip_media_tag | ( | char * | message | ) |
Strip out the media tags from a String. Warning the input string will contain the result string
Definition at line 388 of file utils.c.
Referenced by draw_ext_info().
const char* strrstr | ( | const char * | haystack, |
const char * | needle | ||
) |
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 616 of file recipe.c.
References ingred_name(), numb_ingred(), and tolower.
Referenced by add_book_to_list(), calc_alch_danger(), content_recipe_value(), dump_alchemy(), find_title(), and init_formulae().
void 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 1489 of file object.c.
References obj::carrying, CONTAINER, obj::env, obj::stats, liv::Str, and obj::type.
Referenced by decrease_ob_nr(), make_item_from_recipe(), remove_ob(), and START_TEST().
signed long sum_weight | ( | object * | op | ) |
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 317 of file object.c.
References obj::below, obj::carrying, CONTAINER, obj::inv, obj::nrof, obj::stats, liv::Str, sum_weight(), obj::type, and obj::weight.
Referenced by cfapi_object_set_property(), check_login(), command_fix_me(), fix_container(), fix_weight(), load_objects(), START_TEST(), sum_weight(), and transport_type_apply().
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 2010 of file readable.c.
References add_string(), artifact_msg(), BOOK, BOOK_BUF, BOOKSIZE, change_book(), free_string(), god_info_msg(), obj::level, make_formula_book(), mon_info_msg(), obj::msg, msgfile_msg(), MSGTYPE_ALCHEMY, MSGTYPE_ARTIFACT, MSGTYPE_GODS, MSGTYPE_LIB, MSGTYPE_MONSTER, MSGTYPE_SPELLPATH, spellpath_msg(), and obj::type.
Referenced by fix_generated_item().
char* tempnam_local | ( | const char * | dir, |
const char * | pfx | ||
) |
A replacement for the tempnam() function since it's not defined at some unix variants. Do not use this function for new code, use tempnam_secure() instead.
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. |
Definition at line 87 of file porting.c.
References curtmp, F_OK, getpid, MAXPATHLEN, and snprintf().
Referenced by save_map(), and tempnam_secure().
FILE* tempnam_secure | ( | const char * | dir, |
const char * | pfx, | ||
char ** | filename | ||
) |
A replacement for the tempnam_local() function since that one is not very secure. This one will open the file in an atomic way on platforms where it is possible.
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 143 of file porting.c.
References llevError, LOG(), MAXTMPRETRY, S_IRUSR, S_IWUSR, and tempnam_local().
Referenced by save_player().
void time_info | ( | object * | op | ) |
Players wants to know the time. Called through the 'time' command.
op | player who requested time. |
Definition at line 353 of file time.c.
References draw_ext_info(), draw_ext_info_format(), FLAG_WIZ, max_time, MIN, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DEBUG, NDI_UNIQUE, PBUFLEN, print_tod(), process_max_utime, process_min_utime, process_tot_mtime, process_utime_long_count, process_utime_save, pticks, and QUERY_FLAG.
Referenced by command_time().
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 281 of file utils.c.
References obj::arch, CLOAK, GIRDLE, GLOVES, IS_ARMOR, IS_SHIELD, llevError, LOG(), obj::materialname, _materialtype::mod, obj::name, archt::name, name_to_material(), NROFATTACKS, obj::resist, and obj::type.
Referenced by cfapi_object_transmute(), and make_item_from_recipe().
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 52 of file button.c.
References ALTAR, animate_turning(), obj::arch, BUTTON, CF_HANDLE, archt::clone, obj::count, DIRECTOR, EVENT_TRIGGER, execute_event(), ext_info_map(), FIREWALL, FLAG_ACTIVATE_ON_PUSH, FLAG_ACTIVATE_ON_RELEASE, FLAG_ANIMATE, FLAG_FREED, liv::food, GATE, obj::head, HOLE, liv::hp, oblnk::id, obj::last_eat, llevError, LOG(), obj::map, liv::maxhp, liv::maxsp, obj::more, move_firewall(), obj::msg, MSG_SUBTYPE_NONE, MSG_TYPE_SIGN, obj::name, NDI_NAVY, NDI_UNIQUE, oblnk::next, oblnk::ob, ob_trigger(), PEDESTAL, QUERY_FLAG, SCRIPT_FIX_ALL, SET_ANIMATION, SIGN, liv::sp, obj::speed, obj::stats, TIMED_GATE, obj::type, UP_OBJ_FACE, update_ob_speed(), update_object(), and obj::value.
Referenced by cfapi_map_trigger_connected(), and push_button().
int try_find_animation | ( | const char * | name | ) |
Tries to find the animation id that matches name, don't LOG() an error if not found.
name | the animation's name. |
Definition at line 161 of file anim.c.
References anim_compare(), animations, animations_struct::name, animations_struct::num, and num_animations.
Referenced by apply_anim_suffix(), apply_changes_to_player(), and find_animation().
archetype* try_find_archetype | ( | const char * | name | ) |
Finds, using the hashtable, which archetype matches the given name. Will not LOG() if not found.
Definition at line 671 of file arch.c.
References arch_cmp, arch_search, ARCHTABLE, hasharch(), and archt::name.
Referenced by cfapi_map_present_arch_by_name(), cfapi_object_create(), cfapi_object_find_archetype_inside(), find_archetype(), pick_joined_wall(), retrofit_joined_wall(), send_race_info(), and CREArtifactPanel::setArtifact().
void unflag_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 2894 of file object.c.
References obj::below, CLEAR_FLAG, obj::inv, and unflag_inv().
Referenced by convert_item(), generate_monster_inv(), move_creator(), and unflag_inv().
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 544 of file los.c.
References pl::do_los, first_player, obj::map, MAP_HEIGHT, MAP_WIDTH, socket_struct::mapx, socket_struct::mapy, pl::next, pl::ob, pl::socket, mapdef::tile_map, obj::x, and obj::y.
Referenced by cfapi_object_set_property(), do_turn(), gate_type_process(), insert_ob_in_map(), insert_ob_in_ob(), kill_object(), magic_wall(), remove_ob(), 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 516 of file los.c.
References pl::do_los, first_player, obj::map, pl::next, and pl::ob.
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 178 of file button.c.
References obj::above, BUTTON, obj::carrying, obj::count, get_button_links(), obj::head, oblnk::id, llevDebug, LOG(), obj::move_on, obj::move_type, obj::name, oblnk::next, obj::nrof, oblnk::ob, PEDESTAL, PLAYER, push_button(), obj::race, SET_ANIMATION, obj::slaying, SPECIAL_KEY, obj::type, UP_OBJ_FACE, update_object(), obj::value, and obj::weight.
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 241 of file button.c.
References BUTTON, mapdef::buttons, obj::count, oblnk::id, oblinkpt::link, llevError, LOG(), obj::name, oblnk::next, oblinkpt::next, oblnk::ob, PEDESTAL, obj::type, update_button(), oblinkpt::value, obj::x, and obj::y.
Referenced by load_original_map().
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 467 of file los.c.
References blinded_sight(), pl::blocked_los, check_wall(), clear_los(), obj::contr, expand_sight(), FLAG_BLIND, FLAG_REMOVED, FLAG_WIZ, FLAG_XRAYS, MAP_CLIENT_X, MAP_CLIENT_Y, socket_struct::mapx, socket_struct::mapy, QUERY_FLAG, and pl::socket.
Referenced by command_nowiz(), and draw_client_map().
void update_ob_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 1008 of file object.c.
References obj::active_next, active_objects, obj::active_prev, arch_init, FABS, FLAG_FREED, llevError, LOG(), MIN_ACTIVE_SPEED, obj::name, QUERY_FLAG, and obj::speed.
Referenced by add_abilities(), animate_weapon(), apply_savebed(), cast_word_of_recall(), cfapi_object_set_property(), check_login(), check_trigger(), command_remove(), copy_object(), do_auto_apply(), do_throw(), drain_wand_charge(), eat_special_food(), find_or_create_connection_for_map(), fire_bow(), fix_auto_apply(), fix_object(), fix_stopped_arrow(), free_object2(), gate_type_process(), kill_object(), local_check_loaded_object(), move_cone(), move_detector(), move_hole(), move_marker(), 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(), and trigger_move().
void update_object | ( | object * | op, |
int | action | ||
) |
update_object() 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 update_object() 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 1112 of file object.c.
References obj::contr, obj::env, esrv_update_item(), FLAG_ALIVE, FLAG_BLOCKSVIEW, FLAG_CLIENT_ANIM_RANDOM, FLAG_CLIENT_ANIM_SYNC, FLAG_DAMNED, FLAG_NO_MAGIC, flags, GET_MAP_FLAGS, GET_MAP_MOVE_BLOCK, GET_MAP_MOVE_OFF, GET_MAP_MOVE_ON, GET_MAP_MOVE_SLOW, GET_MAP_PLAYER, mapdef::in_memory, llevDebug, llevError, LOG(), obj::map, MAP_HEIGHT, MAP_SAVING, MAP_WIDTH, obj::more, obj::move_allow, obj::move_block, obj::move_off, obj::move_on, obj::move_slow, 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, pl::socket, obj::type, UP_OBJ_CHANGE, UP_OBJ_FACE, UP_OBJ_INSERT, UP_OBJ_REMOVE, UPD_FACE, socket_struct::update_look, update_object(), update_position(), obj::x, and obj::y.
Referenced by animate_object(), animate_trigger(), animate_turning(), 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(), insert_ob_in_map(), key_change_class(), make_visible(), move_golem(), move_hole(), remove_ob(), tear_down_wall(), trapdoor_type_move_on(), trigger_connected(), trigger_type_process(), unblock_exits(), update_button(), update_object(), and update_turn_face().
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 2124 of file map.c.
References obj::above, add_face_layer(), blank_face, obj::contr, obj::face, FLAG_ALIVE, FLAG_BLOCKSVIEW, FLAG_DAMNED, FLAG_IS_FLOOR, FLAG_MONSTER, FLAG_NO_MAGIC, FLAG_NO_PICK, FLAG_WIZ, flags, GET_MAP_FACE_OBJS, GET_MAP_FLAGS, GET_MAP_OB, obj::glow_radius, pl::hidden, Map_Layer_Info::high_layer, Map_Layer_Info::honor_visibility, obj::invisible, llevDebug, llevError, LOG(), obj::map_layer, MAP_LAYER_FLOOR, MAP_LAYER_FLY1, MAP_LAYER_FLY2, MAP_LAYER_ITEM1, MAP_LAYER_ITEM3, MAP_LAYER_LIVING1, MAP_LAYER_LIVING2, MAP_LAYER_NO_PICK1, MAP_LAYER_NO_PICK2, MAP_LAYERS, obj::move_allow, obj::move_block, MOVE_FLYING, obj::move_off, obj::move_on, obj::move_slow, obj::move_type, P_BLOCKSVIEW, P_IS_ALIVE, P_NEED_UPDATE, P_NO_CLERIC, P_NO_ERROR, P_NO_MAGIC, P_PLAYER, mapdef::path, 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, and obj::type.
Referenced by cfapi_map_update_position(), cfapi_object_set_property(), do_turn(), draw_client_map(), insert_ob_in_ob(), remove_ob(), and update_object().
void 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 990 of file object.c.
References obj::arch, obj::direction, FLAG_IS_TURNABLE, QUERY_FLAG, SET_ANIMATION, UP_OBJ_FACE, and update_object().
Referenced by director_type_move_on(), forklightning(), move_bolt(), move_bullet(), spinner_type_move_on(), and START_TEST().
void use_trigger | ( | object * | op | ) |
Toggles the state of specified button.
op | object to toggle. |
Definition at line 268 of file button.c.
References push_button(), and obj::value.
Referenced by check_inv(), do_talk_npc(), spring_trap(), and trigger_move().
void verify_button_links | ( | const mapstruct * | map | ) |
This does a minimal check of the button link consistency for object map. All it really does it much sure the object id link that is set matches what the object has.
Will log to error level.
map | map to check. |
Definition at line 853 of file button.c.
References mapdef::buttons, obj::count, oblnk::id, oblinkpt::link, llevError, LOG(), obj::name, oblnk::next, oblinkpt::next, and oblnk::ob.
void write_book_archive | ( | void | ) |
Write out the updated book archive to bookarch file.
Definition at line 2127 of file readable.c.
References titlestruct::archname, titlestruct::authour, titleliststruct::first_book, get_titlelist(), titlestruct::level, llevDebug, llevError, Settings::localdir, LOG(), MAX_BUF, titlestruct::msg_index, titlestruct::name, need_to_write_bookarchive, titlestruct::next, titleliststruct::next, SAVE_MODE, settings, titlestruct::size, and snprintf().
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 424 of file init.c.
References llevError, Settings::localdir, LOG(), MAX_BUF, snprintf(), and todtick.
Referenced by clean_tmp_files(), init_clocks(), and tick_the_clock().
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 | ) |