Crossfire Server, Trunk  R20513
Functions
libproto.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int absdir (int d)
 Computes an absolute direction. More...
 
void add_abilities (object *op, const object *change)
 Used in artifact generation. More...
 
void add_button_link (object *button, mapstruct *map, int connected)
 Links specified object in the map. More...
 
void add_friendly_object (object *op)
 Add a new friendly object to the linked list of friendly objects. More...
 
sstring add_refcount (sstring str)
 This will increase the refcount of the string str. More...
 
void add_statbonus (object *op)
 Adds stat-bonuses given by the class which the player has chosen. More...
 
sstring add_string (const char *str)
 This will add 'str' to the hash table. More...
 
int adjust_dir (int dir, int destination_dir)
 Adjusts a given direction by +/-1 towards a destination direction. More...
 
int allowed_class (const object *op)
 Returns true if the given player is a legal class. More...
 
void animate_object (object *op, int dir)
 Updates the face-variable of an object. More...
 
void animate_turning (object *op)
 Animates one step of object. More...
 
void apply_anim_suffix (object *who, sstring suffix)
 Applies a compound animation to an object. More...
 
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. More...
 
void arch_info (object *op)
 Stores debug-information about how efficient the hashtable used for archetypes has been in the static errmsg array. More...
 
objectarch_present_in_ob (const archetype *at, const object *op)
 Searches for any objects with a matching archetype in the inventory of the given object. More...
 
objectarch_to_object (archetype *at)
 Creates and returns a new object which is a copy of the given archetype. More...
 
unsigned artifact_get_face (const artifact *art)
 Get a suitable face number for representing an artifact. More...
 
int atnr_is_dragon_enabled (int attacknr)
 Determine if the attacktype represented by the specified attack-number is enabled for dragon players. More...
 
int blocked_link (object *ob, mapstruct *m, int sx, int sy)
 Returns true if the given coordinate is blocked except by the object passed is not blocking. More...
 
int book_overflow (const char *buf1, const char *buf2, size_t booksize)
 Checks if buf1 and buf2 can be combined. More...
 
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! More...
 
int calc_item_power (const object *op)
 This takes an object 'op' and figures out what its item_power rating should be. More...
 
void calc_perm_exp (object *op)
 Ensure that the permanent experience requirements in an exp object are met. More...
 
int calculate_difficulty (mapstruct *m)
 This routine is supposed to find out the difficulty of the map. More...
 
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. More...
 
int change_abil (object *op, object *tmp)
 Permanently alters an object's stats/flags based on another object. More...
 
void change_attr_value (living *stats, int attr, int8_t value)
 Like set_attr_value(), but instead the value (which can be negative) is added to the specified stat. More...
 
void change_exp (object *op, int64_t exp, const char *skill_name, int flag)
 Changes experience to a player/monster. More...
 
void change_luck (object *op, int value)
 Alter the object's luck. More...
 
int change_map_light (mapstruct *m, int change)
 Used to change map light level (darkness) up or down. More...
 
int check_altar_sacrifice (const object *altar, const object *sacrifice, int remove_others, int *toremove)
 Checks whether the altar has enough to sacrifice. More...
 
int64_t check_exp_adjust (const object *op, int64_t exp)
 Returns the maximum experience the object can gain or lose. More...
 
int64_t check_exp_loss (const object *op, int64_t exp)
 This function checks to make sure that object 'op' can lose 'exp' experience. More...
 
void check_generators (void)
 Check all generators have the other_arch set or something in inventory. More...
 
void check_inv (object *op, object *trig)
 Function to search the inventory, of a player and then based on a set of conditions, the square will activate connected items. More...
 
objectcheck_inv_recursive (object *op, const object *trig)
 Checks object and its inventory for specific item. More...
 
int check_path (const char *name, int prepend_dir)
 This function checks if a file with the given path exists. More...
 
void check_stat_bounds (living *stats, int8_t min_stat, int8_t max_stat)
 Ensures that all stats (str/dex/con/wis/cha/int) are within the passed in range of min_stat and max_stat. More...
 
void check_summoned (void)
 This checks all summonable items for move_type and other things. More...
 
int check_trigger (object *op, object *cause)
 
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) More...
 
void clean_object (object *op)
 Remove and free all objects in the inventory of the given object. More...
 
void clean_tmp_map (mapstruct *m)
 Removse the temporary file used by the map. More...
 
void clear_archetable (void)
 Initialise the hashtable used by the archetypes. More...
 
void clear_los (object *op)
 Clears/initialises the los-array associated to the player controlling the object. More...
 
void clear_player (player *pl)
 Clears data in player structure. More...
 
objectcreate_archetype (const char *name)
 Finds which archetype matches the given name, and returns a new object containing a copy of the archetype. More...
 
objectcreate_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"). More...
 
void create_overlay_pathname (const char *name, char *buf, size_t size)
 Same as create_pathname(), but for the overlay maps. More...
 
char * create_pathname (const char *name, char *buf, size_t size)
 Get the full path to a map file. More...
 
objectcreate_singularity (const char *name)
 Creates a dummy object. More...
 
void create_template_pathname (const char *name, char *buf, size_t size)
 same as create_pathname(), but for the template maps. More...
 
void create_treasure (treasurelist *t, object *op, int flag, int difficulty, int tries)
 This calls the appropriate treasure creation function. More...
 
void decay_objects (mapstruct *m)
 Decay and destroy persihable items in a map. More...
 
void delete_map (mapstruct *m)
 Frees the map, including the mapstruct. More...
 
StringBufferdescribe_attacktype (const char *attack, int value, StringBuffer *buf)
 Describe the specified attack type. More...
 
int describe_god (const object *god, int what, StringBuffer *buf, size_t maxlen)
 Describe a god. More...
 
StringBufferdescribe_item (const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
 Describes an item, in all its details. More...
 
StringBufferdescribe_monster (const object *op, int use_media_tags, StringBuffer *buf)
 Describes a monster. More...
 
StringBufferdescribe_resistance (const object *op, int newline, int use_media_tags, StringBuffer *buf)
 Generates the visible naming for resistances. More...
 
StringBufferdescribe_spellpath_attenuation (const char *attenuation, int value, StringBuffer *buf)
 Describe the specified path attenuation. More...
 
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. More...
 
int die_roll (int num, int size, const object *op, int goodbad)
 Roll a number of dice (2d3, 4d6). More...
 
int dirdiff (int dir1, int dir2)
 Computes a direction difference. More...
 
void drain_specific_stat (object *op, int deplete_stats)
 Drain a specified stat from op. More...
 
void drain_stat (object *op)
 Drains a random stat from op. More...
 
void dump_abilities (void)
 Dump to standard out the abilities of all monsters. More...
 
void dump_alchemy (void)
 Dumps alchemy recipes to output. More...
 
void dump_alchemy_costs (void)
 Dumps to output all costs of recipes. More...
 
void dump_all_archetypes (void)
 Dumps all archetypes to debug-level output. More...
 
void dump_all_maps (void)
 Prints out debug-information about all maps. More...
 
void dump_animations (void)
 Dump all animations to stderr, for debugging purposes. More...
 
void dump_arch (archetype *at, StringBuffer *sb)
 Dumps an archetype to buffer. More...
 
void dump_artifacts (void)
 For debugging purposes. More...
 
void dump_experience (void)
 Dump the experience table, then calls exit() - useful in terms of debugging to make sure the format of the exp_table is correct. More...
 
void dump_friendly_objects (void)
 Dumps all friendly objects. More...
 
void dump_gods (void)
 Prints all gods to stderr. More...
 
void dump_map (const mapstruct *m)
 Prints out debug-information about a map. More...
 
void dump_monster_treasure (const char *name)
 For debugging purposes. More...
 
void fatal (enum fatal_error err)
 fatal() is meant to be called whenever a fatal signal is intercepted. More...
 
int find_animation (const char *name)
 Finds the animation id that matches name. More...
 
archetypefind_archetype (const char *name)
 Finds, using the hashtable, which archetype matches the given name. More...
 
archetypefind_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"). More...
 
archetypefind_archetype_by_object_type_name (int type, const char *name)
 This function retrieves an archetype by type and name that appears during the game. More...
 
const artifactfind_artifact (const object *op, const char *name)
 Searches and returns a specific artifact, NULL if not found. More...
 
const artifactlistfind_artifactlist (int type)
 Searches the artifact lists and returns one that has the same type of objects on it. More...
 
int find_dir_2 (int x, int y)
 Computes a direction which you should travel to move of x and y. More...
 
unsigned find_face (const char *name, unsigned error)
 This returns an the face number of face 'name'. More...
 
recipefind_recipe_for_tool (const char *tool, recipe *from)
 Find a recipe for a specified tool. More...
 
int find_smooth (uint16_t face, uint16_t *smoothed)
 Find the smooth face for a given face. More...
 
sstring find_string (const char *str)
 Searches a string in the shared strings. More...
 
archetypefind_treasure_by_name (const treasure *t, const char *name, int depth)
 Find a treasure with a matching name. More...
 
treasurelistfind_treasurelist (const char *name)
 Searches for the given treasurelist in the globally linked list of treasurelists which has been built by load_treasures(). More...
 
void fix_container (object *container)
 When the map is loaded, load_object() does not actually insert objects into inventory, but just links them. More...
 
void fix_generated_item (object *op, object *creator, int difficulty, int max_magic, int flags)
 fix_generated_item(): This is called after an item is generated, in order to set it up right. More...
 
void fix_object (object *op)
 Updates all abilities given by applied objects in the inventory of the given object. More...
 
void free_all_anim (void)
 Clears all animation-related memory. More...
 
void free_all_archs (void)
 Frees all memory allocated to archetypes. More...
 
void free_all_artifacts (void)
 Free all artifact-related information. More...
 
void free_all_god (void)
 Frees all god information. More...
 
void free_all_images (void)
 Deallocates memory allocated by read_bmap_names() and read_smooth(). More...
 
void free_all_maps (void)
 Frees all allocated maps. More...
 
void free_all_readable (void)
 Free all readable-related information. More...
 
void free_all_recipes (void)
 Frees all memory allocated to recipes and recipes lists. More...
 
void free_all_treasures (void)
 Free all treasure-related memory. More...
 
void free_arch (archetype *at)
 Frees archetype. More...
 
void free_dialog_information (object *op)
 Frees obj::dialog_information. More...
 
void free_experience (void)
 Frees experience-related memory. More...
 
void free_globals (void)
 Cleans all memory allocated for global variables. More...
 
void free_loader (void)
 
void free_map (mapstruct *m)
 Frees everything allocated by the given mapstructure. More...
 
void free_objectlink (objectlink *ol)
 Recursively frees all objectlinks. More...
 
void free_objectlinkpt (oblinkpt *obp)
 Recursively frees all linked list of objectlink pointers. More...
 
void free_player (player *pl)
 Clears player structure, including pointed object (through object_free_drop_inventory()). More...
 
void free_socket_images (void)
 Frees all faceset information. More...
 
void free_string (sstring str)
 This will reduce the refcount, and if it has reached 0, str will be freed. More...
 
void generate_artifact (object *op, int difficulty)
 Decides randomly which artifact the object should be turned into. More...
 
objectgenerate_treasure (treasurelist *t, int difficulty)
 Generate a treasure from a list generating a single item. More...
 
archetypeget_archetype_by_skill_name (const char *skill, int type)
 Retrieves an archetype by skill name and type. More...
 
archetypeget_archetype_by_type_subtype (int type, int subtype)
 Retrieves an archetype by type and subtype. More...
 
archetypeget_archetype_struct (void)
 Allocates, initialises and returns the pointer to an archetype structure. More...
 
int8_t get_attr_value (const living *stats, int attr)
 Gets the value of a stat. More...
 
int get_button_value (const object *button)
 Returns the first value linked to this button. More...
 
int get_cha_bonus (int stat)
 
int get_cleric_chance (int stat)
 
client_spellget_client_spell_state (player *pl, object *spell)
 Gets the (client-side) spell state for specified spell. More...
 
int get_dam_bonus (int stat)
 
int get_dex_bonus (int stat)
 
int get_dialog_message (object *op, const char *text, struct_dialog_message **message, struct_dialog_reply **reply)
 Tries to find a message matching the said text. More...
 
mapstructget_empty_map (int sizex, int sizey)
 Creates and returns a map of the specific size. More...
 
int get_face_fallback (int faceset, int imageno)
 This returns the set we will actually use when sending a face. More...
 
int get_fear_bonus (int stat)
 
recipelistget_formulalist (int i)
 Gets a formula list by ingredients count. More...
 
objectget_jail_exit (object *op)
 Returns an object which is an exit through which the player represented by op should be sent in order to be imprisoned. More...
 
int get_language (object *op)
 Returns the i18n language index associated with the given object. More...
 
int get_learn_spell (int stat)
 
void get_levelnumber (int i, char *buf, size_t size)
 Formats a level. More...
 
mapstructget_linked_map (void)
 Allocates, initialises, and returns a pointer to a mapstruct. More...
 
int get_map_flags (mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
 This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_. More...
 
mapstructget_map_from_coord (mapstruct *m, int16_t *x, int16_t *y)
 This is basically the same as out_of_map above(), but instead we return NULL if no map is valid (coordinates out of bounds and no tiled map), otherwise it returns the map as that the coordinates are really on, and updates x and y to be the localized coordinates. More...
 
sstring get_message_body (const GeneralMessage *message)
 Get a message's body. More...
 
unsigned int get_message_face (const GeneralMessage *message)
 Get a message's face. More...
 
const GeneralMessageget_message_from_identifier (const char *identifier)
 Find the message from its identifier. More...
 
sstring get_message_title (const GeneralMessage *message)
 Get a message's title. More...
 
const char * get_month_name (const int index)
 give access to month names More...
 
const char * get_name_of_region_for_map (const mapstruct *m)
 Gets the name of a region for a map. More...
 
void get_ob_diff (StringBuffer *sb, const object *op, const object *op2)
 Returns a pointer to a static string which contains all variables which are different in the two given objects. More...
 
objectlinkget_objectlink (void)
 Allocates a new objectlink structure, initialises it, and returns a pointer to it. More...
 
oblinkptget_objectlinkpt (void)
 Allocates a new oblinkpt structure, initialises it, and returns a pointer to it. More...
 
const char * get_periodofday (const int index)
 give access to weekday names More...
 
int get_power_from_ench (int ench)
 
godlinkget_rand_god (void)
 Returns a random god. More...
 
int get_random_dir (void)
 Returns a random direction (1..8). More...
 
objectget_random_mon (int level)
 Returns a random monster selected from linked list of all monsters in the current game. More...
 
recipeget_random_recipe (recipelist *rpl)
 Gets a random recipe from a list, based on chance. More...
 
int get_randomized_dir (int dir)
 Returns a random direction (1..8) similar to a given direction. More...
 
int get_rangevector (object *op1, const object *op2, rv_vector *retval, int flags)
 From map.c This is used by get_player to determine where the other creature is. More...
 
int 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. More...
 
const readable_message_typeget_readable_message_type (object *readable)
 Get the readable type for an object (hopefully book). More...
 
regionget_region_by_map (mapstruct *m)
 Gets a region from a map. More...
 
regionget_region_by_name (const char *region_name)
 Gets a region by name. More...
 
regionget_region_from_string (const char *name)
 Tries to find a region that 'name' corresponds to. More...
 
const char * get_region_longname (const region *r)
 Gets the longname of a region. More...
 
const char * get_region_msg (const region *r)
 Gets a message for a region. More...
 
regionget_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.... More...
 
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. More...
 
const char * get_season_name (const int index)
 give access to season names More...
 
float get_speed_bonus (int stat)
 
int get_thaco_bonus (int stat)
 
void get_tod (timeofday_t *tod)
 Computes the ingame time of the day. More...
 
int get_turn_bonus (int stat)
 
const typedataget_typedata (int itemtype)
 
const typedataget_typedata_by_name (const char *name)
 
const char * get_weekday (const int index)
 give access to weekday names More...
 
uint32_t get_weight_limit (int stat)
 
void give_artifact_abilities (object *op, const object *artifact)
 Fixes the given object, giving it the abilities and titles it should have due to the second artifact-template. More...
 
objectgive_skill_by_name (object *op, const char *skill_name)
 Given the skill name skill_name, we find the skill archetype/object, set appropriate values, and insert it into the object (op) that is passed. More...
 
int has_ability (const object *ob)
 Checks whether object has innate abilities (spell/spellbook in inventory). More...
 
mapstructhas_been_loaded (const char *name)
 Checks whether map has been loaded. More...
 
int has_carried_lights (const object *op)
 Checks if op has a light source. More...
 
const char * i18n (const object *who, const char *code)
 Translate a message in the appropriate language. More...
 
int i18n_find_language_by_code (const char *code)
 Attenmpt to find the identifier of a language from its code. More...
 
void i18n_free (void)
 Clears all i18n-related data. More...
 
int i18n_get_language_by_code (const char *code)
 Find the identifier of a language from its code. More...
 
sstring i18n_get_language_code (int language)
 Return the code of a specified language. More...
 
void i18n_init (void)
 Initializes the i18n subsystem. More...
 
void i18n_list_languages (object *who)
 List all languages for who. More...
 
objectidentify (object *op)
 Identifies an item. More...
 
void init_anim (void)
 Loads the lib/animations file. More...
 
void init_archetype_pointers (void)
 Initialize global archtype pointers: More...
 
void init_archetypes (void)
 Initialises the internal linked list of archetypes (read from file). More...
 
void init_artifacts (void)
 Builds up the lists of artifacts from the file in the libdir. More...
 
void init_block (void)
 initialises the array used by the LOS routines. More...
 
void init_experience (void)
 This loads the experience table from the exp_table file. More...
 
void init_formulae (void)
 Builds up the lists of formula from the file in the libdir. More...
 
void init_globals (void)
 Initialises all global variables. More...
 
void init_gods (void)
 This takes a look at all of the archetypes to find the objects which correspond to the GODS (type GOD) More...
 
void init_hash_table (void)
 Initialises the hash-table used by the shared string library. More...
 
void init_library (void)
 It is vital that init_library() is called by any functions using this library. More...
 
void init_ob_method_struct (ob_methods *methods, ob_methods *fallback)
 Initializes a ob_methods struct. More...
 
void init_ob_types (ob_methods *base_type)
 Initializes the object system. More...
 
void init_objects (void)
 Sets up and initialises the linked list of free and used objects. More...
 
void init_readable (void)
 Initialize linked lists utilized by message functions in tailor_readable_ob() More...
 
int init_regions (void)
 Initialises regions from the regions file. More...
 
void init_stats (int reload)
 This loads statistic bonus/penalties from the stat_bonus file. More...
 
int is_dragon_pl (const object *op)
 Checks if player is a dragon. More...
 
int is_friendly (const object *op)
 Checks if the given object is already in the friendly list or not Lauwenmark - 31/07/05. More...
 
int is_magical (const object *op)
 Checks whether object is magical. More...
 
int is_old_wraith_pl (object *op)
 Checks if player is a wraith without the 'wraith feed' skill. More...
 
int is_type_valid (uint8_t type)
 Checks if the specified type is a valid one for a Crossfire object. More...
 
int is_valid_faceset (int fsn)
 Checks specified faceset is valid. More...
 
int is_wraith_pl (object *op)
 Tests if a player is a wraith. More...
 
int isqrt (int n)
 Compute the square root. More...
 
int legal_artifact_combination (const object *op, const artifact *art)
 Checks if op can be combined with art. More...
 
int64_t level_exp (int level, double expmul)
 Returns how much experience is needed for a player to become the given level. More...
 
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)
 
void load_treasures (void)
 Opens LIBDIR/treasure and reads all treasure-declarations from it. More...
 
const artifactlocate_recipe_artifact (const recipe *rp, size_t idx)
 Finds an artifact for a recipe. More...
 
void LOG (LogLevel logLevel, const char *format,...)
 Logs a message to stderr, or to file. More...
 
void make_list_like (char *input)
 Taking a string as an argument, mutate it into a string that looks like a list. More...
 
void make_path_to_file (const char *filename)
 Checks if any directories in the given path doesn't exist, and creates if necessary. More...
 
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. More...
 
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. More...
 
objectmap_find_by_archetype (mapstruct *m, int x, int y, const archetype *at)
 Searches for any objects with a matching archetype at the given map and coordinates. More...
 
objectmap_find_by_flag (mapstruct *map, int x, int y, int flag)
 Finds an object in a map tile by flag number. More...
 
objectmap_find_by_type (mapstruct *m, int x, int y, uint8_t type)
 Searches for any objects with a matching type variable at the given map and coordinates. More...
 
int map_find_dir (mapstruct *m, int x, int y, object *exclude)
 Search some close squares in the given map at the given coordinates for live objects. More...
 
const char * map_get_path (const object *item)
 Return the map path on which the specified item is. More...
 
void map_remove_unique_files (const mapstruct *map)
 Remove files containing the map's unique items. More...
 
mapstructmapfile_load (const char *map, int flags)
 Opens the file "filename" and reads information about the map from the given file, and stores it in a newly allocated mapstruct. More...
 
materialtype_tname_to_material (const char *name)
 Convert materialname to materialtype_t. More...
 
int need_identify (const object *op)
 This function really should not exist - by default, any item not identified should need it. More...
 
int64_t new_exp (const object *ob)
 Alternative way to calculate experience based on the ability of a monster. More...
 
int nstrtok (const char *buf1, const char *buf2)
 Simple routine to return the number of list items in buf1 as separated by the value of buf2. More...
 
method_ret ob_apply (object *op, object *applier, int aflags)
 Applies an object. More...
 
int ob_blocked (const object *ob, mapstruct *m, int16_t x, int16_t y)
 Returns true if the given object can't fit in the given spot. More...
 
char * ob_describe (const object *op, const object *observer, char *buf, size_t size)
 Returns the description of an object, as seen by the given observer. More...
 
method_ret ob_move_on (object *op, object *victim, object *originator)
 Makes an object move on top of another one. More...
 
method_ret ob_process (object *op)
 Processes an object, giving it the opportunity to move or react. More...
 
method_ret ob_trigger (object *op, object *cause, int state)
 An object is triggered by another one. More...
 
void object_add_weight (object *op, signed long weight)
 object_add_weight(object, weight) adds the specified weight to an object, and also updates how much the environment(s) is/are carrying. More...
 
int object_can_merge (object *ob1, object *ob2)
 Examines the 2 objects given to it, and returns true if they can be merged together, including inventory. More...
 
int object_can_pick (const object *who, const object *item)
 Finds out if an object can be picked up. More...
 
int object_check_move_on (object *op, object *originator)
 Checks if any objects has a move_type that matches objects that effect this object on this space. More...
 
void object_clear (object *op)
 Frees everything allocated by an object, and also clears all variables and flags to default settings. More...
 
void object_clear_owner (object *op)
 Clears the owner of specified object. More...
 
void object_copy (const object *src_ob, object *dest_ob)
 Copy object first frees everything allocated by the second object, and then copies the contents of the first object into the second object, allocating what needs to be allocated. More...
 
void object_copy_owner (object *op, object *clone)
 Set the owner to clone's current owner and set the skill and experience objects to clone's objects (typically those objects that where the owner's current skill and experience objects at the time when clone's owner was set - not the owner's current skill and experience objects). More...
 
void object_copy_with_inv (const object *src_ob, object *dest_ob)
 copy an object with an inventory... More...
 
int object_count_active (void)
 Objects statistics. More...
 
int object_count_free (void)
 Objects statistics. More...
 
int object_count_used (void)
 Object statistics. More...
 
objectobject_create_arch (archetype *at)
 Create a full object using the given archetype. More...
 
objectobject_create_clone (object *asrc)
 Create clone from object to another. More...
 
objectobject_decrease_nrof (object *op, uint32_t i)
 Decreases a specified number from the amount of an object. More...
 
int object_distance (const object *ob1, const object *ob2)
 Return the square of the distance between the two given objects. More...
 
void object_dump (const object *op, StringBuffer *sb)
 Dumps an object. More...
 
void object_dump_all (void)
 Dumps all objects to console. More...
 
objectobject_find_by_arch_name (const object *who, const char *name)
 Find object in inventory by archetype name. More...
 
objectobject_find_by_flag (const object *who, int flag)
 Find object in inventory by flag. More...
 
objectobject_find_by_flag_applied (const object *who, int flag)
 Find applied object in inventory by flag. More...
 
objectobject_find_by_name (const object *who, const char *name)
 Finds an object in inventory name. More...
 
objectobject_find_by_name_global (const char *str)
 Finds an object by name. More...
 
objectobject_find_by_tag (const object *who, tag_t tag)
 Find object in inventory. More...
 
objectobject_find_by_tag_global (tag_t i)
 Returns the object which has the count-variable equal to the argument. More...
 
objectobject_find_by_type (const object *who, int type)
 Find object in inventory. More...
 
objectobject_find_by_type2 (const object *who, int type1, int type2)
 Find object in inventory. More...
 
objectobject_find_by_type_and_arch_name (const object *who, int type, const char *name)
 Find object in inventory by type and archetype name. More...
 
objectobject_find_by_type_and_name (const object *who, int type, const char *name)
 Find object in inventory by type and name. More...
 
objectobject_find_by_type_and_race (const object *who, int type, const char *race)
 Find object in inventory by type and race. More...
 
objectobject_find_by_type_and_skill (const object *who, int type, const char *skill)
 Find object in inventory by type and skill. More...
 
objectobject_find_by_type_and_slaying (const object *who, int type, const char *slaying)
 Find object in inventory by type and slaying. More...
 
objectobject_find_by_type_applied (const object *who, int type)
 Find applied object in inventory. More...
 
objectobject_find_by_type_subtype (const object *who, int type, int subtype)
 Find object in inventory. More...
 
int object_find_first_free_spot (const object *ob, mapstruct *m, int x, int y)
 object_find_first_free_spot(archetype, mapstruct, x, y) works like object_find_free_spot(), but it will search max number of squares. More...
 
int object_find_free_spot (const object *ob, mapstruct *m, int x, int y, int start, int stop)
 object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coordinates which will be able to contain the given object. More...
 
int object_find_multi_free_spot_around (const object *ob, const object *gen, int *hx, int *hy)
 Sets hx and hy to the coords to insert a possibly multi-tile ob at, around gen. More...
 
int object_find_multi_free_spot_within_radius (const object *ob, const object *gen, int *hx, int *hy)
 Sets hx and hy to the coords to insert a possibly multi-tile ob at, within radius of generator, which is stored in key_value "generator_radius". More...
 
void object_fix_multipart (object *tmp)
 Ensures specified object has its more parts correctly inserted in map. More...
 
void object_free2 (object *ob, int flags)
 Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects. More...
 
void object_free_all_data (void)
 Destroys all allocated objects. More...
 
void object_free_drop_inventory (object *ob)
 Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects. More...
 
void object_free_key_values (object *op)
 Zero the key_values on op, decrementing the shared-string refcounts and freeing the links. More...
 
objectobject_get_env_recursive (object *op)
 Utility function. More...
 
key_valueobject_get_key_value (const object *ob, const char *key)
 Search for a field by key. More...
 
void object_get_multi_size (const object *ob, int *sx, int *sy, int *hx, int *hy)
 Computes the size of a multitile object. More...
 
objectobject_get_owner (object *op)
 Returns the object which this object marks as being the owner. More...
 
objectobject_get_player_container (object *op)
 Finds the player carrying an object. More...
 
const char * object_get_value (const object *op, const char *const key)
 Get an extra value by key. More...
 
void object_give_identified_properties (object *op)
 Ensure op has all its "identified" properties set. More...
 
objectobject_insert_in_map (object *op, mapstruct *m, object *originator, int flag)
 This function inserts the object in the two-way linked list which represents what is on a map. More...
 
objectobject_insert_in_map_at (object *op, mapstruct *m, object *originator, int flag, int x, int y)
 Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing multi-part monsters. More...
 
objectobject_insert_in_ob (object *op, object *where)
 This function inserts the object op in the linked list inside the object environment. More...
 
void object_insert_to_free_spot_or_free (object *op, mapstruct *map, int x, int y, int start, int stop, object *originator)
 Inserts an object into its map. More...
 
int object_matches_string (object *pl, object *op, const char *name)
 This is a subset of the parse_id command. More...
 
objectobject_merge (object *op, object *top)
 This function goes through all objects below and including top, and merges op to the first matching object. More...
 
void object_merge_spell (object *op, int16_t x, int16_t y)
 This sees if there are any objects on the space that can merge with op. More...
 
objectobject_new (void)
 Grabs an object from the list of unused objects, makes sure it is initialised, and returns it. More...
 
objectobject_present_in_ob (uint8_t type, const object *op)
 Searches for any objects with a matching type variable in the inventory of the given object. More...
 
objectobject_present_in_ob_by_name (int type, const char *str, const object *op)
 Searches for any objects with a matching type & name variable in the inventory of the given object. More...
 
void object_remove (object *op)
 This function removes the object op from the linked list of objects which it is currently tied to. More...
 
void object_remove_from_active_list (object *op)
 This function removes object 'op' from the list of active objects. More...
 
void object_replace_insert_in_map (const char *arch_string, object *op)
 This function inserts an object of a specified archetype in the map, but if it finds objects of its own type, it'll remove them first. More...
 
void object_reset (object *op)
 Sets to 0 vital variables in an object. More...
 
void object_set_cheat (object *op)
 object_set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in all it's inventory (recursively). More...
 
void object_set_enemy (object *op, object *enemy)
 Sets the enemy of an object. More...
 
void object_set_flag_inv (object *op, int flag)
 Activate recursively a flag on an object's inventory. More...
 
void object_set_msg (object *op, const char *msg)
 Set the message field of an object. More...
 
void object_set_owner (object *op, object *owner)
 Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects. More...
 
int object_set_value (object *op, const char *key, const char *value, int add_key)
 Updates the key in op to value. More...
 
objectobject_split (object *orig_ob, uint32_t nr, char *err, size_t size)
 object_split(ob,nr) splits up ob into two parts. More...
 
void object_sub_weight (object *op, signed long weight)
 Recursively (outwards) subtracts a number from the weight of an object (and what is carried by it's environment(s)). More...
 
signed long object_sum_weight (object *op)
 object_sum_weight() is a recursive function which calculates the weight an object is carrying. More...
 
void object_unset_flag_inv (object *op, int flag)
 Desactivate recursively a flag on an object inventory. More...
 
void object_update (object *op, int action)
 object_update() updates the array which represents the map. More...
 
void object_update_speed (object *op)
 Updates the speed of an object. More...
 
void object_update_turn_face (object *op)
 If an object with the IS_TURNABLE() flag needs to be turned due to the closest player being on the other side, this function can be called to update the face variable, and how it looks on the map. More...
 
int on_same_map (const object *op1, const object *op2)
 Checks whether 2 objects are on the same map or not. More...
 
int operate_altar (object *altar, object **sacrifice)
 Checks if sacrifice was accepted and removes sacrificed objects. More...
 
int out_of_map (mapstruct *m, int x, int y)
 this returns TRUE if the coordinates (x,y) are out of map m. More...
 
char * path_combine (const char *src, const char *dst, char *path, size_t size)
 Combines 2 paths, which can be relative. More...
 
char * path_combine_and_normalize (const char *src, const char *dst, char *path, size_t size)
 Combines the 2 paths. More...
 
void path_normalize (char *path)
 Cleans specified path. More...
 
const char * player_get_own_title (const struct pl *pl)
 Returns the player's own title. More...
 
void player_get_title (const struct pl *pl, char *buf, size_t bufsize)
 Returns the player's title. More...
 
int player_has_own_title (const struct pl *pl)
 Returns whether the player has a custom title. More...
 
void player_lvl_adj (object *who, object *op)
 For the new exp system. More...
 
void player_set_dragon_title (struct pl *pl, int level, const char *attack, int skin_resist)
 Updates the title of a dragon player to reflect the current level, attack type, and resistances. More...
 
void player_set_own_title (struct pl *pl, const char *title)
 Sets the custom title. More...
 
const objectpntr_to_god_obj (godlink *godlnk)
 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. More...
 
void print_los (object *op)
 Debug-routine which dumps the array which specifies the visible area of a player. More...
 
void print_monsters (void)
 As dump_abilities(), but with an alternative way of output. More...
 
void push_button (object *op)
 Push the specified object. More...
 
void query_base_name (const object *op, int plural, char *buf, size_t size)
 Query a short name for the item. More...
 
void query_name (const object *op, char *buf, size_t size)
 Describes an item. More...
 
int query_refcount (sstring str)
 This will return the refcount of the string str. More...
 
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.) More...
 
void query_weight (const object *op, char *buf, size_t size)
 Formats the item's weight. More...
 
int random_roll (int min, int max, const object *op, int goodbad)
 Roll a random number between min and max. More...
 
int64_t random_roll64 (int64_t min, int64_t max, const object *op, int goodbad)
 This is a 64 bit version of random_roll() above. More...
 
const char * re_cmp (const char *str, const char *regexp)
 re-cmp - get regular expression match. More...
 
void read_bmap_names (void)
 This reads the bmaps file to get all the bitmap names and stuff. More...
 
void read_client_images (void)
 Loads all the image types into memory. More...
 
int read_smooth (void)
 Reads the smooth file to know how to smooth datas. More...
 
mapstructready_map_name (const char *name, int flags)
 Makes sure the given map is loaded and swapped in. More...
 
int region_is_child_of_region (const region *child, const region *r)
 Checks if a region is a child of another. More...
 
void register_apply (int ob_type, apply_func method)
 Registers the apply method for the given type. More...
 
void register_describe (int ob_type, describe_func method)
 Registers the describe method for the given type. More...
 
void register_move_on (int ob_type, move_on_func method)
 Registers the move_on method for the given type. More...
 
void register_process (int ob_type, process_func method)
 Registers the process method for the given type. More...
 
void register_trigger (int ob_type, trigger_func method)
 Registers the trigger method for the given type. More...
 
void remove_button_link (object *op)
 Remove the object from the linked lists of buttons in the map. More...
 
int remove_depletion (object *op, int level)
 Remove depletion from op, if present, and warn player of such restorations. More...
 
void remove_directory (const char *path)
 This function removes everything in the directory, and the directory itself. More...
 
void remove_friendly_object (object *op)
 Removes the specified object from the linked list of friendly objects. More...
 
void remove_statbonus (object *op)
 Subtracts stat-bonuses given by the class which the player has chosen. More...
 
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. More...
 
void replace_unprintable_chars (char *buf)
 Replaces any unprintable character in the given buffer with a space. More...
 
void reset_sleep (void)
 Initialise all variables used in the timing routines. More...
 
int rndm (int min, int max)
 Returns a number between min and max. More...
 
int save_map (mapstruct *m, int flag)
 Saves a map to file. More...
 
int save_object (FILE *fp, object *op, int flag)
 Dumps all variables in an object to a file. More...
 
long seconds (void)
 Return wall clock time in seconds. More...
 
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. More...
 
void set_attr_value (living *stats, int attr, int8_t value)
 Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW). More...
 
void set_dragon_name (object *pl, const object *abil, const object *skin)
 Set the new dragon name after gaining levels or changing ability focus (later this can be extended to eventually change the player's face and animation) More...
 
void set_map_reset_time (mapstruct *map)
 Updates the map's timeout. More...
 
void set_materialname (object *op)
 Set the material name and type for an item, if not set. More...
 
void set_max_time (long t)
 Sets the max speed. More...
 
int set_variable (object *op, const char *buf)
 
void share_exp (object *op, int64_t exp, const char *skill, int flag)
 Gives experience to a player/monster, sharing it with party if applicable. More...
 
void sleep_delta (void)
 Sleep until the next tick. More...
 
size_t split_string (char *str, char *array[], size_t array_size, char sep)
 Splits a string delimited by passed in sep value into characters into an array of strings. More...
 
void ss_dump_statistics (char *buf, size_t size)
 A call to this function will cause the statistics to be dumped into specified buffer. More...
 
char * ss_dump_table (int what, char *buf, size_t size)
 Dump the contents of the share string tables. More...
 
void stringbuffer_append_printf (StringBuffer *sb, const char *format,...)
 
void stringbuffer_append_string (StringBuffer *sb, const char *str)
 
void stringbuffer_append_stringbuffer (StringBuffer *sb, const StringBuffer *sb2)
 
void stringbuffer_delete (StringBuffer *sb)
 
char * stringbuffer_finish (StringBuffer *sb)
 
sstring stringbuffer_finish_shared (StringBuffer *sb)
 
size_t stringbuffer_length (StringBuffer *sb)
 
StringBufferstringbuffer_new (void)
 
void strip_endline (char *buf)
 Removes endline from buffer (modified in place). More...
 
const char * strrstr (const char *haystack, const char *needle)
 Finds a string in a string. More...
 
int strtoint (const char *buf)
 Convert buf into an integer equal to the coadded sum of the (lowercase) character. More...
 
char * strtoktolin (const char *buf1, const char *buf2, char *retbuf, size_t size)
 Takes a string in buf1 and separates it into a list of strings delimited by buf2. More...
 
void tailor_readable_ob (object *book, int msg_type)
 The main routine. More...
 
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. More...
 
const char * time_format_time (const timeofday_t *tod, char *buf, size_t bufsize)
 Formats a timestamp in Crossfire time. More...
 
void time_info (object *op)
 Players wants to know the time. More...
 
void transmute_materialname (object *op, const object *change)
 When doing transmutation of objects, we have to recheck the resistances, as some that did not apply previously, may apply now. More...
 
objectlinktreasurelist_find_matching_type (const treasurelist *randomitems, int type, int traverse)
 This function looks at the passed in treasurelist and returns all objects on it, or on treasurelists it references, of matching type. More...
 
void trigger_connected (objectlink *ol, object *cause, const int state)
 Trigger every object in an objectlink. More...
 
int try_find_animation (const char *name)
 Tries to find the animation id that matches name, don't LOG() an error if not found. More...
 
archetypetry_find_archetype (const char *name)
 Finds, using the hashtable, which archetype matches the given name. More...
 
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. More...
 
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. More...
 
void update_button (object *op)
 Updates everything connected with the button op. More...
 
void update_buttons (mapstruct *m)
 Updates every button on the map (by calling update_button() for them). More...
 
void update_los (object *op)
 Recalculates the array which specifies what is visible for the given player-object. More...
 
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) More...
 
void use_trigger (object *op)
 Toggles the state of specified button. More...
 
long usec_elapsed (struct timespec first, struct timespec second)
 Return the number of microseconds between two timespec structures. More...
 
void verify_button_links (const mapstruct *map)
 This does a minimal check of the button link consistency for object map. More...
 
void write_book_archive (void)
 Write out the updated book archive to bookarch file. More...
 
void write_todclock (void)
 Write out the current time to the file so time does not reset every time the server reboots. More...
 
void yyfree (void *ptr)
 
int yyget_debug (void)
 
FILE * yyget_in (void)
 
int yyget_lineno (void)
 
FILE * yyget_out (void)
 
char * yyget_text (void)
 
int yylex_destroy (void)
 
void yypop_buffer_state (void)
 
void yyrestart (FILE *input_file)
 
void yyset_debug (int bdebug)
 
void yyset_in (FILE *in_str)
 
void yyset_lineno (int line_number)
 
void yyset_out (FILE *out_str)
 

Function Documentation

int absdir ( int  d)

Computes an absolute direction.

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

Definition at line 3637 of file object.c.

Referenced by adjust_dir(), check_spell_knockback(), common_process_projectile(), fire_arch_from_position(), fire_bolt(), flee_player(), forklightning(), get_randomized_dir(), monster_compute_path(), monster_dist_att(), monster_disthit_att(), monster_hitrun_att(), monster_move(), monster_run_att(), monster_wait_att(), monster_wait_att2(), move_ball_spell(), move_bolt(), move_bullet(), move_cone(), move_swarm_spell(), path_to_player(), pets_move(), pets_summon_object(), player_fire_bow(), pray_at_altar(), spinner_type_move_on(), and turn_transport().

Here is the caller graph for this function:

void add_abilities ( object op,
const object change 
)

Used in artifact generation.

The bonuses of the first object is modified by the bonuses of the second object.

Definition at line 284 of file artifact.c.

References liv::ac, add_refcount(), obj::anim_speed, obj::animation_id, animations, obj::arch, arch_to_object(), obj::attacktype, blank_face, change_attr_value(), CLEAR_FLAG, compute_face_name(), liv::dam, liv::exp, obj::face, find_face(), FLAG_ALIVE, FLAG_ANIMATE, FLAG_BLIND, FLAG_CLIENT_ANIM_RANDOM, FLAG_CURSED, FLAG_DAMNED, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_NO_SAVE, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STAND_STILL, FLAG_STEALTH, FLAG_XRAYS, liv::food, FOR_INV_FINISH, FOR_INV_PREPARE, free_string(), obj::gen_sp_armour, get_attr_value(), liv::hp, obj::inv, obj::item_power, obj::last_sp, obj::level, llevDebug, LOG(), liv::luck, obj::magic, obj::material, obj::materialname, MAX_BUF, liv::maxhp, liv::maxsp, obj::move_type, obj::msg, new_face_struct::name, animations_struct::name, new_faces, obj::nrof, NROFATTACKS, NUM_STATS, new_face_struct::number, object_copy(), object_free_drop_inventory(), object_get_value(), object_insert_in_ob(), object_new(), object_remove(), object_set_msg(), object_set_value(), object_update_speed(), obj::other_arch, obj::path_attuned, obj::path_denied, obj::path_repelled, POTION, QUERY_FLAG, obj::race, RANDOM, obj::resist, ROD, set_abs_magic(), SET_FLAG, obj::slaying, snprintf, liv::sp, obj::speed, obj::stats, try_find_animation(), obj::type, obj::value, liv::wc, and obj::weight.

Referenced by artifact_describe(), and give_artifact_abilities().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Links specified object in the map.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
opobject to add to the list.

Definition at line 30 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(), change_object(), do_mood_floor(), fix_summon_pet(), mood_change(), pets_summon_golem(), pets_summon_object(), polymorph_living(), receive_play_again(), and use_oratory().

Here is the call graph for this function:

Here is the caller graph for this function:

sstring add_refcount ( sstring  str)
void add_statbonus ( object op)

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

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

Definition at line 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 apply_race_and_class(), key_change_class(), and key_roll_stat().

Here is the caller graph for this function:

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.

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

Definition at line 124 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 account_char_add(), account_char_load(), account_play_cmd(), add_author(), add_book_to_list(), add_god_to_list(), add_to_racelist(), adjust_sign_msg(), alchemy_failure_effect(), animate_weapon(), apply_race_and_class(), 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_login(), command_follow(), command_goto(), command_reset(), command_summon(), command_teleport(), command_unarmed_skill(), confuse_living(), create_singularity(), determine_god(), do_throw(), enter_player_savebed(), enter_random_map(), examine_monster(), find_archetype_by_object_name(), find_or_create_connection_for_map(), fire_bow(), fix_container_multipart(), fix_generated_item(), fix_stopped_arrow(), get_jail_exit(), get_player(), give_artifact_abilities(), god_enchants_weapon(), grant_immunity(), i18n(), i18n_init(), init_anim(), init_artifacts(), init_book_archive(), init_formulae(), init_globals(), init_msgfile(), init_races(), init_skills(), key_change_class(), keyplace(), kill_player(), knowledge_add(), knowledge_read_player_data(), load_materials(), load_quests_from_file(), load_treasure(), load_treasures(), local_check_loaded_object(), lock_and_hide_doors(), monster_do_talk_npc(), move_marker(), new_text_name(), object_find_by_name(), object_find_by_name_global(), object_fix_multipart(), object_set_msg(), object_set_value(), object_set_value_s(), pets_summon_golem(), place_chest(), place_exits(), place_special_exit(), potion_type_apply(), process_object(), quest_read_player_data(), receive_play_again(), set_materialname(), START_TEST(), stringbuffer_finish_shared(), tailor_god_spell(), and write_mark().

Here is the call graph for this function:

int adjust_dir ( int  dir,
int  destination_dir 
)

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

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

Definition at line 452 of file utils.c.

References absdir(), and rndm().

Referenced by move_ball_spell(), and move_missile().

Here is the call graph for this function:

Here is the caller graph for this function:

int allowed_class ( const object op)

Returns true if the given player is a legal class.

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

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

Definition at line 1602 of file living.c.

References liv::Cha, liv::Con, liv::Dex, liv::Int, liv::Pow, obj::stats, liv::Str, and liv::Wis.

Referenced by apply_race_and_class(), and key_change_class().

Here is the caller graph for this function:

void animate_object ( object op,
int  dir 
)

Updates the face-variable of an object.

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

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

Definition at line 186 of file anim.c.

References animate_object(), obj::animation_id, obj::arch, blank_face, CLEAR_FLAG, archt::clone, obj::direction, obj::face, FLAG_ALIVE, FLAG_IS_TURNABLE, obj::head, obj::invisible, llevError, LOG(), obj::more, NUM_ANIMATIONS, NUM_FACINGS, new_face_struct::number, object_dump(), object_update(), PLAYER, QUERY_FLAG, SET_ANIMATION, SET_FLAG, obj::state, stringbuffer_finish(), stringbuffer_new(), obj::temp_animation_id, obj::type, and UP_OBJ_FACE.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void animate_turning ( object op)

Animates one step of object.

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

Definition at line 275 of file button.c.

References obj::direction, FIREWALL, NUM_ANIMATIONS, object_update(), SET_ANIMATION, liv::sp, obj::state, obj::stats, obj::type, and UP_OBJ_FACE.

Referenced by legacy_ob_process(), and trigger_connected().

Here is the call graph for this function:

Here is the caller graph for this function:

void apply_anim_suffix ( object who,
sstring  suffix 
)

Applies a compound animation to an object.

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

Definition at line 292 of file anim.c.

References animate_object(), obj::animation_id, animations, obj::facing, animations_struct::facings, 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, and try_find_animation().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void apply_death_exp_penalty ( object op)

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

Parameters
opvictim of the penalty. Must not be NULL.

Definition at line 2126 of file living.c.

References check_exp_loss(), Settings::death_penalty_level, Settings::death_penalty_ratio, liv::exp, FOR_INV_FINISH, FOR_INV_PREPARE, obj::level, levels, MAX, MIN, player_lvl_adj(), settings, SKILL, and obj::stats.

Referenced by kill_player_not_permadeath().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

object* arch_present_in_ob ( const archetype at,
const object op 
)

Searches for any objects with a matching archetype in the inventory of the given object.

Parameters
atarchetype to search for.
opwhere to search.
Returns
first matching object, or NULL if none matches.
Note
present_arch_in_ob() has been renamed to arch_present_in_ob()

Definition at line 3061 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(), kill_player_not_permadeath(), perceive_self(), poison_living(), remove_depletion(), slow_living(), and START_TEST().

Here is the caller graph for this function:

object* arch_to_object ( archetype at)

Creates and returns a new object which is a copy of the given archetype.

This function returns NULL if given a NULL pointer, else an object.

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

Definition at line 571 of file arch.c.

References obj::arch, archt::clone, llevError, LOG(), object_copy_with_inv(), object_new(), and warn_archetypes.

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

Here is the call graph for this function:

unsigned artifact_get_face ( const artifact art)

Get a suitable face number for representing an artifact.

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

Definition at line 692 of file artifact.c.

References artifactstruct::allowed, artifactstruct::allowed_size, blank_face, archt::clone, obj::face, find_archetype(), first_archetype, artifactstruct::item, linked_char::name, archt::name, linked_char::next, archt::next, new_face_struct::number, and obj::type.

Here is the call graph for this function:

int atnr_is_dragon_enabled ( int  attacknr)

Determine if the attacktype represented by the specified attack-number is enabled for dragon players.

A dragon player (quetzal) can gain resistances for all enabled attacktypes.

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

Definition at line 95 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(), perceive_self(), and set_dragon_name().

Here is the caller graph for this function:

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

Returns true if the given coordinate is blocked except by the object passed is not blocking.

This is used with multipart monsters - if we want to see if a 2x2 monster can move 1 space to the left, we don't want its own area to block it from moving there.

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

Definition at line 346 of file map.c.

References CHECK_INV, check_inv_recursive(), DOOR, draw_ext_info(), FLAG_ALIVE, FLAG_WIZ, MapSpace::flags, FOR_MAP_FINISH, FOR_MAP_PREPARE, GET_MAP_MOVE_BLOCK, HEAD, llevError, LOG(), obj::move_type, 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Checks if buf1 and buf2 can be combined.

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

Definition at line 710 of file readable.c.

References BOOK_BUF, and buf_overflow().

Referenced by write_note().

Here is the call graph for this function:

Here is the caller graph for this function:

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!

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

Definition at line 398 of file shstr.c.

Referenced by book_overflow(), init_msgfile(), and START_TEST().

Here is the caller graph for this function:

int calc_item_power ( const object op)

This takes an object 'op' and figures out what its item_power rating should be.

This should only really be used by the treasure generation code, and when loading legacy objects. It returns the item_power it calculates.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void calc_perm_exp ( object op)

Ensure that the permanent experience requirements in an exp object are met.

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

Parameters
opobject to check.

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

Here is the caller graph for this function:

int calculate_difficulty ( mapstruct m)

This routine is supposed to find out the difficulty of the map.

Difficulty does not have a lot to do with character level, but does have a lot to do with treasure on the map.

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

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

Definition at line 1913 of file map.c.

References archt::clone, liv::exp, FLAG_GENERATOR, FLAG_MONSTER, FOR_MAP_FINISH, FOR_MAP_PREPARE, GENERATE_TYPE, get_archetype_by_type_subtype(), level_exp(), MAP_DIFFICULTY, MAP_HEIGHT, MAP_WIDTH, QUERY_FLAG, and obj::stats.

Referenced by cfapi_map_get_map_property(), generate_random_map(), and mapfile_load().

Here is the call graph for this function:

Here is the caller graph for this function:

int can_see_monsterP ( mapstruct m,
int  x,
int  y,
int  dir 
)

Recursive routine to see if we can find a path to a certain point.

Modified to be map tile aware -.MSW

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

Definition at line 3745 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(), monster_find_nearest_living_creature(), and spell_find_dir().

Here is the call graph for this function:

Here is the caller graph for this function:

int change_abil ( object op,
object tmp 
)

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

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

Definition at line 394 of file living.c.

References liv::ac, add_string(), obj::arch, AT_CONFUSION, ATNR_PHYSICAL, obj::attacktype, BOW, change_attr_value(), change_resist_msg, check_stat_bounds(), CLEAR_FLAG, archt::clone, obj::contr, DIFF_MSG, pl::do_los, draw_ext_info(), draw_ext_info_format(), liv::exp, 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, Settings::max_stat, MIN_STAT, 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, object_check_move_on(), 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, settings, SKILL, liv::sp, obj::stats, obj::type, and liv::wc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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

Definition at line 264 of file living.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Changes experience to a player/monster.

This does bounds checking to make sure we don't overflow the max exp.

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

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

Definition at line 2076 of file living.c.

References add_player_exp(), liv::exp, FABS, FLAG_ALIVE, llevError, LOG(), MAX_EXPERIENCE, PLAYER, QUERY_FLAG, 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(), examine(), 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().

Here is the call graph for this function:

Here is the caller graph for this function:

void change_luck ( object op,
int  value 
)

Alter the object's luck.

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

Definition at line 791 of file living.c.

References arch_present_in_ob(), arch_to_object(), FABS, find_archetype(), FLAG_APPLIED, liv::luck, object_insert_in_ob(), RANDOM, SET_FLAG, and obj::stats.

Referenced by fix_luck(), and kill_object().

Here is the call graph for this function:

Here is the caller graph for this function:

int change_map_light ( mapstruct m,
int  change 
)

Used to change map light level (darkness) up or down.

It should now be possible to change a value by more than 1.

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

Will inform players on the map.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Checks whether the altar has enough to sacrifice.

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

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

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

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

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

Definition at line 352 of file button.c.

References ARCH_SACRIFICE, FLAG_UNPAID, FOR_ABOVE_FINISH, FOR_ABOVE_PREPARE, llevError, LOG(), obj::map, matches_sacrifice(), obj::nrof, NROF_SACRIFICE, object_decrease_nrof(), object_remove(), mapdef::path, QUERY_FLAG, and obj::value.

Referenced by identify_altar_type_move_on(), and operate_altar().

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t check_exp_adjust ( const object op,
int64_t  exp 
)

Returns the maximum experience the object can gain or lose.

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

Definition at line 1999 of file living.c.

References check_exp_loss(), liv::exp, MAX_EXPERIENCE, MIN, and obj::stats.

Referenced by command_addexp().

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t check_exp_loss ( const object op,
int64_t  exp 
)

This function checks to make sure that object 'op' can lose 'exp' experience.

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

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

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

Here is the caller graph for this function:

void check_generators ( void  )

Check all generators have the other_arch set or something in inventory.

Definition at line 467 of file arch.c.

References archt::clone, fatal(), first_archetype, FLAG_CONTENT_ON_GEN, FLAG_GENERATOR, obj::inv, llevError, LOG(), archt::name, archt::next, obj::other_arch, QUERY_FLAG, and SEE_LAST_ERROR.

Referenced by load_archetypes().

Here is the call graph for this function:

Here is the caller graph for this function:

void check_inv ( object op,
object trig 
)

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

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

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

Definition at line 826 of file button.c.

References check_inv_recursive(), obj::last_heal, obj::last_sp, object_decrease_nrof_by_one, PLAYER, obj::type, and use_trigger().

Referenced by check_inv_type_move_on().

Here is the call graph for this function:

Here is the caller graph for this function:

object* check_inv_recursive ( object op,
const object trig 
)

Checks object and its inventory for specific item.

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

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

Definition at line 786 of file button.c.

References obj::arch, check_inv_recursive(), FOR_INV_FINISH, FOR_INV_PREPARE, liv::hp, archt::name, obj::race, obj::slaying, obj::stats, obj::title, and obj::type.

Referenced by blocked_link(), cast_create_town_portal(), check_inv(), and check_inv_recursive().

Here is the call graph for this function:

Here is the caller graph for this function:

int check_path ( const char *  name,
int  prepend_dir 
)

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

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

Definition at line 203 of file map.c.

References create_pathname(), MAX_BUF, S_IRGRP, S_IROTH, S_IRUSR, S_ISREG, S_IWGRP, S_IWOTH, S_IWUSR, and snprintf.

Referenced by cfapi_system_check_path(), check_login(), and load_map_header().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Ensures that all stats (str/dex/con/wis/cha/int) are within the passed in range of min_stat and max_stat.

Often, the caller will pass in MIN_STAT and MAX_STAT, but in case of force objects or temporary calculations, we want things outside the range (force objects may have negative stats, but we don't want them too negative)

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

Definition at line 354 of file living.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void check_summoned ( void  )

This checks all summonable items for move_type and other things.

Will call fatal() if an error is found.

Definition at line 495 of file arch.c.

References archt::clone, fatal(), first_archetype, llevError, LOG(), obj::move_type, obj::name, archt::name, archt::next, obj::other_arch, SEE_LAST_ERROR, SP_SUMMON_GOLEM, SPELL, obj::subtype, and obj::type.

Referenced by load_archetypes().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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

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

TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0.

Definition at line 523 of file button.c.

References liv::ac, FOR_ABOVE_FINISH, FOR_ABOVE_PREPARE, obj::last_sp, llevDebug, LOG(), obj::move_on, obj::move_type, obj::name, NUM_ANIMATIONS, object_update(), object_update_speed(), 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, obj::value, liv::wc, and obj::weight.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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 111 of file friend.c.

References first_friendly_object, FLAG_FREED, FLAG_FRIENDLY, llevDebug, LOG(), oblnk::next, and QUERY_FLAG.

Referenced by do_specials().

Here is the call graph for this function:

Here is the caller graph for this function:

void clean_object ( object op)

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

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

Definition at line 1631 of file map.c.

References clean_object(), FLAG_IS_LINKED, FOR_INV_FINISH, FOR_INV_PREPARE, object_free_drop_inventory(), object_remove(), QUERY_FLAG, and remove_button_link().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void clean_tmp_map ( mapstruct m)

Removse the temporary file used by the map.

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

Definition at line 1954 of file map.c.

References mapdef::tmpname, and unlink.

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

Here is the caller graph for this function:

void clear_archetable ( void  )

Initialise the hashtable used by the archetypes.

Definition at line 205 of file arch.c.

References ARCHTABLE.

Referenced by free_all_archs(), load_archetypes(), and START_TEST().

Here is the caller graph for this function:

void clear_los ( object op)

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

Parameters
opplayer's object.
Todo:
use player *instead of object *to show it must be a player?

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

Here is the caller graph for this function:

void clear_player ( player pl)

Clears data in player structure.

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

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

Definition at line 33 of file player.c.

References FREE_AND_CLEAR_STR, client_spell::next, pl::spell_state, pl::stack_items, pl::stack_position, and pl::unarmed_skill.

Referenced by free_player(), and get_player().

Here is the caller graph for this function:

object* create_archetype ( const char *  name)