![]() |
Crossfire Server, Trunk
1.75.0
|
#include "bufferreader.h"
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) |
Apply artifact properties to an object. 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 list of friendly objects. More... | |
void | add_statbonus (object *op) |
Adds stat-bonuses given by the class which the player has chosen. 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 | animation_load_block (FILE *file, const char *full_path, const char *animation_name) |
void | apply_anim_suffix (object *who, const char *suffix) |
Applies a compound animation to an object. 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... | |
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. More... | |
object * | arch_to_object (archetype *at) |
Creates and returns a new object which is a copy of the given archetype. More... | |
void | artifact_compute_chance_for_item (const object *op, const artifact *art, int *numerator, int *denominator) |
Compute the chance for a specified item to become the specified artifact. More... | |
uint16_t | 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, int16_t sx, int16_t 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 | 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... | |
bool | check_formulae (void) |
Check if formula don't have the same index. 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... | |
object * | check_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... | |
bool | check_recipes () |
Ensure that all recipes have a valid artifact, and that archetypes are correct. 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... | |
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_friendly_list (void) |
Totally clear the friendly list. More... | |
void | clear_los (player *pl) |
Clears/initialises the los-array associated to the player controlling the object. More... | |
void | clear_player (player *pl) |
Clears data in player structure. More... | |
object * | create_archetype (const char *name) |
Finds which archetype matches the given name, and returns a new object containing a copy of the archetype. More... | |
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"). 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... | |
object * | create_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... | |
StringBuffer * | describe_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... | |
StringBuffer * | describe_item (const object *op, const object *owner, int use_media_tags, StringBuffer *buf) |
Describes an item, in all its details. More... | |
StringBuffer * | describe_monster (const object *op, int use_media_tags, StringBuffer *buf) |
Describes a monster. More... | |
StringBuffer * | describe_resistance (const object *op, int newline, int use_media_tags, StringBuffer *buf) |
Generates the visible naming for resistances. More... | |
StringBuffer * | describe_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_faces (void) |
Dump all faces to stderr, for debugging purposes. 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 | dump_stat_bonuses () |
int | exp_level (int64_t exp) |
Returns the level for a given exp. More... | |
void | fatal (enum fatal_error err) __attribute__((noreturn)) |
fatal() is meant to be called whenever a fatal signal is intercepted. More... | |
Animations * | find_animation (const char *name) |
archetype * | find_archetype (const char *name) |
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"). More... | |
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. More... | |
const artifact * | find_artifact (const object *op, const char *name) |
Searches and returns a specific artifact compatible with an object, NULL if not found. More... | |
artifactlist * | find_artifactlist (int type) |
Finds the artifact list for a certain item type. More... | |
uint8_t | find_color (const char *name) |
Finds a color by name. More... | |
int | find_dir_2 (int x, int y) |
Computes a direction which you should travel to move of x and y. More... | |
const Face * | find_face (const char *name) |
const object * | find_god (const char *name) |
Returns a god's object from its name. More... | |
recipe * | find_recipe_for_tool (const char *tool, recipe *from) |
Find a recipe for a specified tool. More... | |
int | find_smooth (const Face *face, const Face **smoothed) |
Find the smooth face for a given face. More... | |
archetype * | find_treasure_by_name (const treasure *t, const char *name, int depth) |
Find a treasure with a matching name. More... | |
treasurelist * | find_treasurelist (const char *name) |
Search for the given treasurelist by name. More... | |
void | first_arch_pass (FILE *fp, const char *filename) |
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_artifacts (void) |
Free all artifact-related information. More... | |
void | free_all_god (void) |
Frees all god information. 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_arch (archetype *at) |
Frees archetype. More... | |
void | free_charlinks (linked_char *lc) |
Frees a link structure and its next items. 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) |
Frees all memory allocated by the loader. More... | |
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) |
Frees player structure, including pointed object (through object_free_drop_inventory()). More... | |
void | generate_artifact (object *op, int difficulty) |
Decides randomly which artifact the object should be turned into. More... | |
object * | generate_treasure (treasurelist *t, int difficulty) |
Generate a treasure from a list generating a single item. More... | |
archetype * | get_archetype_by_skill_name (const char *skill, int type) |
Retrieves an archetype by skill name and type. More... | |
archetype * | get_archetype_by_type_subtype (int type, int subtype) |
Retrieves an archetype by type and subtype. More... | |
archetype * | get_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_spell * | get_client_spell_state (player *pl, object *spell) |
Gets the (client-side) spell state for specified spell. More... | |
const char * | get_colorname (uint8_t index) |
int | get_dam_bonus (int stat) |
int | get_dex_bonus (int stat) |
int | get_dialog_message (object *op, const char *text, struct_dialog_message **message, struct_dialog_reply **reply) |
Tries to find a message matching the said text. More... | |
artifact * | get_empty_artifact (void) |
Allocate and return the pointer to an empty artifact structure. More... | |
artifactlist * | get_empty_artifactlist (void) |
Allocate and return the pointer to an empty artifactlist structure. More... | |
mapstruct * | get_empty_map (int sizex, int sizey) |
Creates and returns a map of the specific size. More... | |
treasure * | get_empty_treasure () |
Allocate and return the pointer to an empty treasure structure. More... | |
const Face * | get_face_by_id (uint16_t id) |
Get a face from its unique identifier. More... | |
int | get_face_fallback (int faceset, uint16_t imageno) |
This returns the set we will actually use when sending a face. More... | |
size_t | get_faces_count (void) |
int | get_fear_bonus (int stat) |
recipelist * | get_formulalist (int i) |
Gets a formula list by ingredients count. More... | |
objectlink * | get_friends_of (const object *owner) |
Get a list of friendly objects for the specified owner. More... | |
const char * | get_god_for_race (const char *race) |
Returns a string that is the name of the god that should be natively worshipped by a creature of who has race *race if we can't find a god that is appropriate, we return NULL. More... | |
object * | get_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_learn_spell (int stat) |
void | get_levelnumber (int i, char *buf, size_t size) |
mapstruct * | get_linked_map (void) |
Allocates, initialises, and returns a pointer to a mapstruct, linked through first_map. 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... | |
mapstruct * | get_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... | |
const Face * | get_message_face (const GeneralMessage *message) |
Get a message's face. More... | |
const GeneralMessage * | get_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... | |
archetype * | get_next_archetype (archetype *current) |
object * | get_next_friend (object *current) |
Get the next object on the friendly list. 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... | |
objectlink * | get_objectlink (void) |
Allocates a new objectlink structure, initialises it, and returns a pointer to it. More... | |
oblinkpt * | get_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) |
const object * | get_rand_god (void) |
Returns a random god. More... | |
int | get_random_dir (void) |
Returns a random direction (1..8). More... | |
object * | get_random_mon (int level) |
Returns a random monster selected from linked list of all monsters in the current game. More... | |
recipe * | get_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) |
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_type * | get_readable_message_type (object *readable) |
Get the readable type for an object (hopefully book). More... | |
region * | get_region_by_map (mapstruct *m) |
Gets a region from a map. More... | |
region * | get_region_by_name (const char *region_name) |
Gets a region by name. More... | |
region * | get_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... | |
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.... 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... | |
long | get_sleep_remaining (void) |
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 typedata * | get_typedata (int itemtype) |
const typedata * | get_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... | |
object * | give_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... | |
mapstruct * | has_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... | |
language_t | i18n_find_language_by_code (const char *code) |
Attempt to find the identifier of a language from its code. More... | |
void | i18n_free (void) |
Clears all i18n-related data. More... | |
language_t | i18n_get_language_by_code (const char *code) |
Find the identifier of a language from its code. More... | |
sstring | i18n_get_language_code (language_t 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... | |
object * | identify (object *op) |
Identifies an item. More... | |
int | ihypot (int a, int b) |
Rough estimate of hypot(a, b). More... | |
void | init_archetype_pointers (void) |
Initialize global archtype pointers: More... | |
void | init_attackmess (BufferReader *reader, const char *filename) |
Initializes the attack messages. More... | |
void 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 (BufferReader *reader, const char *filename) |
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_library (void) |
It is vital that init_library() is called by any functions using this library. More... | |
void | init_msgfile (FILE *file, const char *filename) |
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... | |
void | init_regions (BufferReader *reader, const char *filename) |
Reads/parses the region file, and copies into a linked list of region structs. More... | |
void | init_stats () |
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. More... | |
int | is_identifiable_type (const object *op) |
Return true if this item's type is one that cares about whether or not it's been identified – e.g. More... | |
int | is_identified (const object *op) |
Return true if the item is identified, either because it is of a type that doesn't ever need identification (e.g. 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... | |
void | jump_time (void) |
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... | |
void | link_player_skills (object *op) |
This function goes through the player inventory and sets up the last_skills[] array in the player object. More... | |
int | load_face_file (FILE *file, const char *full_path) |
void | load_image_info (FILE *file, const char *filename) |
int | load_object (FILE *fp, object *op, int bufstate, int map_flags, bool artifact_init) |
Loads an object from the given file-pointer. More... | |
int | load_object_from_reader (BufferReader *reader, object *op, int map_flags, bool arch_init, bool artifact_init) |
Load an object from the specified reader, stopping when the object is complete. More... | |
int | load_png_file (FILE *file, const char *full_path) |
void | load_treasures (void) |
const artifact * | locate_recipe_artifact (const recipe *rp, size_t idx) |
Finds an artifact for a recipe. More... | |
void | LOG (LogLevel logLevel, const char *format,...) PRINTF_ARGS(2 |
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... | |
object * | map_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... | |
object * | map_find_by_flag (mapstruct *map, int x, int y, int flag) |
Finds an object in a map tile by flag number. More... | |
object * | map_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... | |
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... | |
mapstruct * | mapfile_load (const char *map, int flags) |
Opens the file "filename" and reads information about the map from the given file, and stores it in a newly allocated mapstruct. More... | |
materialtype_t * | name_to_material (const char *name) |
Convert materialname to materialtype_t. 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) |
Apply an object by running an event hook or an object method. 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, int use_media_tags, 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_no_speed (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, bool update_speed) |
Copy an object with an inventory, duplicate the inv too. 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... | |
object * | object_create_arch (archetype *at) |
Create a full object using the given archetype. More... | |
object * | object_create_clone (object *asrc) |
Create clone from object to another. More... | |
object * | object_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... | |
object * | object_find_by_arch_name (const object *who, const char *name) |
Find object in inventory by archetype name. More... | |
object * | object_find_by_flag (const object *who, int flag) |
Find object in inventory by flag. More... | |
object * | object_find_by_flag_applied (const object *who, int flag) |
Find applied object in inventory by flag. More... | |
object * | object_find_by_name (const object *who, const char *name) |
Finds an object in inventory name. More... | |
object * | object_find_by_name_global (const char *str) |
Finds an object by name. More... | |
object * | object_find_by_tag (const object *who, tag_t tag) |
Find object in inventory. More... | |
object * | object_find_by_tag_global (tag_t i) |
Returns the object which has the count-variable equal to the argument. More... | |
object * | object_find_by_type (const object *who, int type) |
Find object in inventory. More... | |
object * | object_find_by_type2 (const object *who, int type1, int type2) |
Find object in inventory. More... | |
object * | object_find_by_type_and_arch_name (const object *who, int type, const char *name) |
Find object in inventory by type and archetype name. More... | |
object * | object_find_by_type_and_name (const object *who, int type, const char *name) |
Find object in inventory by type and name. More... | |
object * | object_find_by_type_and_race (const object *who, int type, const char *race) |
Find object in inventory by type and race. More... | |
object * | object_find_by_type_and_skill (const object *who, int type, const char *skill) |
Find object in inventory by type and skill. More... | |
object * | object_find_by_type_and_slaying (const object *who, int type, const char *slaying) |
Find object in inventory by type and slaying. More... | |
object * | object_find_by_type_applied (const object *who, int type) |
Find applied object in inventory. More... | |
object * | object_find_by_type_subtype (const object *who, int type, int subtype) |
Find object in inventory. More... | |
object * | object_find_by_type_without_flags (const object *who, int type, int *flags, int num_flags) |
Find an object in inventory that does not have any of the provided flags set. 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, int16_t *hx, int16_t *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_free (object *ob, int flags) |
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects. 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_inventory (object *ob) |
Frees the inventory of an object, without any callback. More... | |
void | object_free_key_values (object *op) |
Zero the key_values on op, decrementing the shared-string refcounts and freeing the links. More... | |
object * | object_get_env_recursive (object *op) |
Utility function. More... | |
key_value * | object_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... | |
object * | object_get_owner (object *op) |
Returns the object which this object marks as being the owner. More... | |
object * | object_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... | |
void | object_handle_death_animation (object *op) |
object * | object_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... | |
object * | object_insert_in_map_at (object *op, mapstruct *m, object *originator, int flag, int x, int y) |
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing multi-part monsters. More... | |
object * | object_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_pickup_mode (const object *item, int mode) |
Checks if an item matches a specific pickup mode. More... | |
int | object_matches_string (object *pl, object *op, const char *name) |
This is a subset of the parse_id command. More... | |
object * | object_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... | |
object * | object_new (void) |
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it. More... | |
object * | object_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... | |
object * | object_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) |
Totally resets the specified object, without freeing associated memory. 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... | |
object * | object_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... | |
bool | object_value_set (const object *op, const char *const key) |
Determine if an extra value is set. More... | |
bool | object_value_set_shared (const object *op, sstring key) |
Determine if an extra value is set to a non empty or 0 value. 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) |
Return 1 if coordinates X and Y are out of the map M, taking into account tiling. 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 player *pl) |
Returns the player's own title. More... | |
void | player_get_title (const struct player *pl, char *buf, size_t bufsize) |
int | player_has_own_title (const struct player *pl) |
Returns whether the player has a custom title. More... | |
void | player_lvl_adj (object *who, object *op) |
For the new exp system. More... | |
void | player_set_dragon_title (struct player *pl, int level, const char *attack, int skin_resist) |
Updates the title of a dragon player to reflect the current level, attack type, and resistances. More... | |
void | player_set_own_title (struct player *pl, const char *title) |
Sets the custom title. 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... | |
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... | |
mapstruct * | ready_map_name (const char *name, int flags) |
Makes sure the given map is loaded and swapped in. More... | |
const char * | recipe_get_difficulty_string (int difficulty) |
A method to produce a difficulty adjective to describe alchemy projects. More... | |
const Face * | recipe_get_face (const recipe *rp) |
Return the best face associated with a recipe. 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... | |
void | save_object_in_sb (StringBuffer *sb, object *op, const int flag) |
Store a string representation of op in sb. 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_tick_duration (long t) |
Sets the tick duration. More... | |
int | set_variable (object *op, const char *buf) |
This takes a buffer, scans it for variables, and sets those variables as appropriate in op. More... | |
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... | |
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 | stringbuffer_append_multiline_block (StringBuffer *sb, const char *start, const char *content, const char *end) |
void | stringbuffer_append_printf (StringBuffer *sb, const char *format,...) |
void | stringbuffer_append_string (StringBuffer *sb, const char *str) |
void | stringbuffer_append_stringbuffer (StringBuffer *sb, const StringBuffer *sb2) |
void | stringbuffer_delete (StringBuffer *sb) |
char * | stringbuffer_finish (StringBuffer *sb) |
sstring | stringbuffer_finish_shared (StringBuffer *sb) |
size_t | stringbuffer_length (StringBuffer *sb) |
StringBuffer * | stringbuffer_new (void) |
void | strip_endline (char *buf) |
Removes endline from buffer (modified in place). 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... | |
void | tick_game_time (void) |
unsigned int | tick_length (float seconds) |
Calculate the number of ticks that correspond to real time. More... | |
float | ticks_to_seconds (int ticks) |
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... | |
long | timespec_diff (struct timespec *end, struct timespec *start) |
Return the difference between two timespec's in microseconds. 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... | |
void | treasure_free (treasure *t) |
Frees a treasure, including its yes, no and next items. More... | |
treasure * | treasure_insert (treasurelist *list, int position) |
Insert a new treasure in the treasure list, at a specific position in the children list. More... | |
void | treasure_remove_item (treasurelist *list, int position) |
Remove the treasure at the specified position from the list. More... | |
void | trigger_connected (objectlink *ol, object *cause, const int state) |
Trigger every object in an objectlink. More... | |
Animations * | try_find_animation (const char *name) |
archetype * | try_find_archetype (const char *name) |
const Face * | try_find_face (const char *name, const Face *error) |
void | update_all_los (const mapstruct *map, int x, int y) |
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 | 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) |
Get the input stream. More... | |
int | yyget_lineno (void) |
Get the current line number. More... | |
FILE * | yyget_out (void) |
Get the output stream. More... | |
char * | yyget_text (void) |
Get the current token. More... | |
int | yylex_destroy (void) |
void | yypop_buffer_state (void) |
Removes and deletes the top of the stack, if present. More... | |
void | yyrestart (FILE *input_file) |
Immediately switch to a different input stream. More... | |
void | yyset_debug (int bdebug) |
void | yyset_in (FILE *in_str) |
Set the input stream. More... | |
void | yyset_lineno (int line_number) |
Set the current line number. More... | |
void | yyset_out (FILE *out_str) |
int absdir | ( | int | d | ) |
Computes an absolute direction.
d | direction to convert. |
Definition at line 3714 of file object.cpp.
References d.
Referenced by adjust_dir(), check_spell_knockback(), common_process_projectile(), fire_arch_from_position(), fire_bolt(), flee_player(), forklightning(), get_randomized_dir(), monster_compute_path(), monster_dist_att(), monster_disthit_att(), monster_hitrun_att(), monster_move(), monster_run_att(), monster_wait_att(), monster_wait_att2(), move_ball_spell(), move_bolt(), move_bullet(), move_cone(), move_swarm_spell(), path_to_player(), pets_move(), pets_summon_object(), player_fire_bow(), pray_at_altar(), spinner_type_move_on(), and turn_transport().
Apply artifact properties to an object.
op | object to apply changes to. |
change | changes to apply, with fields handled as described in the artifacts file. |
For items that do not need identifying, use their identified face/animation immediately. This should make seas of generated creatures look more interesting.
Neila Hawkins 2018-01-07
Add query flags to perform the same treatment for identified items or artifacts that come identified. Also make sure we have op->arch. Otherwise it segfaults when we don't.
2018-01-08
Definition at line 320 of file artifact.cpp.
References living::ac, add_refcount(), object::anim_speed, object::animation, object::arch, arch_to_object(), object::attacktype, blank_face, buf, change_attr_value(), CLEAR_FLAG, compute_face_name(), living::dam, living::exp, face(), object::face, FLAG_ALIVE, FLAG_ANIMATE, FLAG_BLIND, FLAG_CLIENT_ANIM_RANDOM, FLAG_CONFUSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_NO_SAVE, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_REFLECTING, FLAG_SEE_IN_DARK, FLAG_STAND_STILL, FLAG_STEALTH, FLAG_XRAYS, living::food, FOR_INV_FINISH, FOR_INV_PREPARE, free_string(), object::gen_sp_armour, get_attr_value(), living::grace, living::hp, object::inv, is_identified(), object::item_power, key_value::key, KEY_ANIMATION_SUFFIX, KEY_FACE_SUFFIX, object::key_values, object::last_sp, object::level, llevDebug, LOG(), living::luck, object::magic, object::material, object::materialname, MAX_BUF, living::maxgrace, living::maxhp, living::maxsp, object::move_type, object::msg, Face::name, Animations::name, treasurelist::name, object::name, key_value::next, object::nrof, NROFATTACKS, NUM_STATS, Face::number, object_copy(), object_free_drop_inventory(), object_get_value(), object_give_identified_properties(), object_insert_in_ob(), object_new(), object_remove(), object_set_msg(), object_set_value(), object_update_speed(), object::other_arch, object::path_attuned, object::path_denied, object::path_repelled, POTION, QUERY_FLAG, object::race, object::resist, ROD, set_abs_magic(), SET_FLAG, object::slaying, living::sp, object::speed, sstring, object::stats, try_find_animation(), try_find_face(), object::type, key_value::value, object::value, living::wc, and object::weight.
Referenced by artifact_describe(), 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 656 of file button.cpp.
References mapstruct::buttons, object::count, FLAG_IS_LINKED, free_objectlink(), get_objectlink(), get_objectlinkpt(), objectlink::id, oblinkpt::link, llevError, LOG(), objectlink::next, oblinkpt::next, objectlink::ob, SET_FLAG, and oblinkpt::value.
Referenced by apply_builder_item(), include_map_in_map(), and while().
void add_friendly_object | ( | object * | op | ) |
Add a new friendly object to the list of friendly objects.
Will log an error if the object is already on that list.
op | object to add to the list. |
Definition at line 32 of file friend.cpp.
References object::count, friends, is_friendly(), llevError, LOG(), and object::name.
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(), use_oratory(), and while().
void add_statbonus | ( | object * | op | ) |
Adds stat-bonuses given by the class which the player has chosen.
op | object which must be a player with contr not NULL. |
Definition at line 868 of file living.cpp.
References object::arch, living::Cha, archetype::clone, living::Con, object::contr, living::Dex, living::Int, player::orig_stats, living::Pow, object::stats, living::Str, and living::Wis.
Referenced by apply_race_and_class(), key_change_class(), and key_roll_stat().
int adjust_dir | ( | int | dir, |
int | destination_dir | ||
) |
Adjusts a given direction by +/-1 towards a destination direction.
dir | the direction to adjust |
destination_dir | the destination direction to adjust towards |
Definition at line 426 of file utils.cpp.
References absdir(), destination_dir, and rndm().
Referenced by move_ball_spell(), and move_missile().
int allowed_class | ( | const object * | op | ) |
Returns true if the given player is a legal class.
The function to add and remove class-bonuses to the stats doesn't check if the stat becomes negative, thus this function merely checks that all stats are 1 or more, and returns false otherwise.
op | object to check. |
Definition at line 1661 of file living.cpp.
References living::Cha, living::Con, living::Dex, living::Int, living::Pow, object::stats, living::Str, and living::Wis.
Referenced by apply_race_and_class(), and key_change_class().
void animate_object | ( | object * | op, |
int | dir | ||
) |
Updates the face-variable of an object.
If the object is the head of a multi-object, all objects are animated. The object's state is not changed, but merely updated if needed (out of bounds of new animation, reached end of animation, ...). This function correctly handles FLAG_IS_TURNABLE too.
op | is the object to animate. |
dir | is the direction the object is facing. This is generally same as op->direction, but in some cases, op->facing is used instead - the caller has a better idea which one it really wants to be using, so let it pass along the right one. This parameter is ignored if the object has a head or is turnable. |
Definition at line 44 of file anim.cpp.
References animate_object(), object::animation, object::arch, blank_face, CLEAR_FLAG, archetype::clone, object::direction, object::face, FLAG_ALIVE, FLAG_IS_TURNABLE, Animations::has_blank, object::head, object::invisible, llevError, LOG(), object::more, NUM_ANIMATIONS, NUM_FACINGS, Face::number, object_dump(), object_update(), PLAYER, QUERY_FLAG, SET_ANIMATION, SET_FLAG, object::state, stringbuffer_finish(), stringbuffer_new(), object::temp_animation, object::type, and UP_OBJ_FACE.
Referenced by animate_object(), apply_anim_suffix(), apply_changes_to_player(), dragon_ability_gain(), face_player(), fix_stopped_arrow(), monster_move(), monster_use_scroll(), move_aura(), move_hole(), move_player(), move_to(), object_give_identified_properties(), object_update_turn_face(), process_events(), process_object(), turn_one_transport(), and turn_transport().
void animate_turning | ( | object * | op | ) |
Animates one step of object.
op | object to animate. |
Definition at line 270 of file button.cpp.
References object::direction, FIREWALL, NUM_ANIMATIONS, object_update(), SET_ANIMATION, living::sp, object::state, object::stats, object::type, and UP_OBJ_FACE.
Referenced by director_process(), legacy_ob_process(), and trigger_connected().
void animation_load_block | ( | FILE * | file, |
const char * | full_path, | ||
const char * | animation_name | ||
) |
void apply_anim_suffix | ( | object * | who, |
const char * | suffix | ||
) |
Applies a compound animation to an object.
who | object to apply the animation to. Must not be NULL. |
suffix | animation suffix to apply. Must not be NULL. |
Definition at line 150 of file anim.cpp.
References animate_object(), object::animation, buf, object::facing, Animations::facings, HEAD, object::last_anim, MAX_BUF, object::more, Animations::name, Animations::num_animations, object::state, object::temp_anim_speed, object::temp_animation, and try_find_animation().
Referenced by apply_by_living(), attack_ob_simple(), cast_spell(), do_skill(), fire_bow(), and god_intervention().
void apply_death_exp_penalty | ( | object * | op | ) |
Applies a death penalty experience, the size of this is defined by the settings death_penalty_percentage and death_penalty_levels, and by the amount of permenent experience, whichever gives the lowest loss.
op | victim of the penalty. Must not be NULL. |
Definition at line 2244 of file living.cpp.
References check_exp_loss(), Settings::death_penalty_level, Settings::death_penalty_ratio, living::exp, FOR_INV_FINISH, FOR_INV_PREPARE, object::level, levels, MAX, MIN, player_lvl_adj(), settings, SKILL, and object::stats.
Referenced by kill_player_not_permadeath().
Searches for any objects with a matching archetype in the inventory of the given object.
at | archetype to search for. |
op | where to search. |
Definition at line 3222 of file object.cpp.
References object::arch, object::below, and object::inv.
Referenced by cast_heal(), cfapi_object_find_archetype_inside(), cfapi_object_get_property(), change_luck(), create_aura(), drain_specific_stat(), kill_player_not_permadeath(), perceive_self(), poison_living(), remove_depletion(), restore_player(), and slow_living_by().
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 227 of file arch.cpp.
References object::arch, archetype::clone, llevError, LOG(), object_copy_with_inv(), and object_new().
Referenced by add_abilities(), add_one_item(), animate_bomb(), animate_weapon(), apply_builder_floor(), apply_builder_window(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_cone(), cast_consecrate(), cast_curse(), cast_destruction(), cast_detection(), cast_heal(), cast_light(), cast_polymorph(), cast_raise_dead_spell(), cast_smite_spell(), change_luck(), change_object(), command_create(), cone_drop(), create_archetype(), create_archetype_by_object_name(), create_aura(), create_bomb(), create_player_cmd(), do_single_item(), do_turn(), dragon_ability_gain(), drain_specific_stat(), eat_special_food(), explode_bullet(), fire_arch_from_position(), fire_bolt(), fire_swarm(), fix_container_multipart(), fix_summon_pet(), fix_walls(), get_npc(), get_player(), get_spell_by_name(), give_skill_by_name(), god_gives_present(), kill_player(), kill_player_not_permadeath(), kill_player_permadeath(), magic_wall(), make_map_floor(), make_map_walls(), mood_change(), move_aura(), move_ball_spell(), move_symptom(), object_create_arch(), object_fix_multipart(), object_replace_insert_in_map(), pets_summon_object(), pick_joined_wall(), place_exits(), poison_living(), potion_type_apply(), print_monsters(), put_a_monster(), put_decor(), put_doors(), put_floor(), put_in_icecube(), recipe_get_face(), remove_door(), remove_locked_door(), retrofit_joined_wall(), save_object_in_sb(), slow_living_by(), spell_effect(), spring_trap(), town_portal_find_force(), write_mark(), and write_rune().
void artifact_compute_chance_for_item | ( | const object * | op, |
const artifact * | art, | ||
int * | numerator, | ||
int * | denominator | ||
) |
Compute the chance for a specified item to become the specified artifact.
This does not take into account the 10% chance of an item being made an artifact.
op | item to consider. |
art | artifact to compute the chance of. |
numerator | chance in denominator for the artifact to be generated. |
denominator | denominator, will never be 0. |
Definition at line 133 of file artifact.cpp.
References artifact::chance, find_artifactlist(), legal_artifact_combination(), list, and object::type.
uint16_t artifact_get_face | ( | const artifact * | art | ) |
Get a suitable face number for representing an artifact.
art | what to get the face of. |
Definition at line 638 of file artifact.cpp.
References artifact::allowed, blank_face, archetype::clone, object::face, find_archetype_by_object_name(), get_next_archetype(), archetype::head, artifact::item, name, Face::number, try_find_archetype(), and object::type.
int atnr_is_dragon_enabled | ( | int | attacknr | ) |
Determine if the attacktype represented by the specified attack-number is enabled for dragon players.
A dragon player (quetzal) can gain resistances for all enabled attacktypes.
attacknr | attacktype to check |
Definition at line 103 of file player.cpp.
References ATNR_ACID, ATNR_COLD, ATNR_ELECTRICITY, ATNR_FIRE, ATNR_MAGIC, and ATNR_POISON.
Referenced by command_resistances(), describe_item(), describe_resistance(), dragon_eat_flesh(), dragon_level_gain(), perceive_self(), and set_dragon_name().
Returns true if the given coordinate is blocked except by the object passed is not blocking.
This is used with multipart monsters - if we want to see if a 2x2 monster can move 1 space to the left, we don't want its own area to block it from moving there.
ob | object we ignore. Must not be NULL. |
m | map we're considering. |
sx | |
sy | target coordinates |
Definition at line 356 of file map.cpp.
References CHECK_INV, check_inv_recursive(), DOOR, draw_ext_info, FLAG_ALIVE, FLAG_WIZ, FOR_MAP_FINISH, FOR_MAP_PREPARE, GET_MAP_MOVE_BLOCK, HEAD, llevError, LOG(), m, object::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, TRANSPORT, and object::type.
Referenced by move_ob(), and path_to_player().
int book_overflow | ( | const char * | buf1, |
const char * | buf2, | ||
size_t | booksize | ||
) |
Checks if buf1 and buf2 can be combined.
buf1 | |
buf2 | buffer we plan on combining. |
booksize | maximum book size. |
Definition at line 719 of file readable.cpp.
References BOOK_BUF, booksize, and buf_overflow().
Referenced by write_note().
int calc_item_power | ( | const object * | op | ) |
This takes an object 'op' and figures out what its item_power rating should be.
This should only really be used by the treasure generation code, and when loading legacy objects. It returns the item_power it calculates.
op | object of which to compute the item_power |
Definition at line 235 of file item.cpp.
References AMULET, ARMOUR, object::attacktype, bits_set(), BOOTS, BRACERS, CLOAK, living::exp, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_XRAYS, living::food, get_attr_value(), get_power_from_ench(), GIRDLE, GLOVES, living::grace, HELMET, living::hp, if(), INORGANIC, living::luck, object::magic, NROFATTACKS, NUM_STATS, object::path_attuned, object::path_denied, object::path_repelled, QUERY_FLAG, object::resist, RING, SHIELD, object::slaying, living::sp, object::stats, object::type, and WEAPON.
Referenced by add_one_item(), and fix_generated_item().
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 1914 of file living.cpp.
References living::exp, MAX_EXPERIENCE, Settings::permanent_exp_ratio, settings, object::stats, and object::total_exp.
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 1908 of file map.cpp.
References archetype::clone, living::exp, FLAG_GENERATOR, FLAG_MONSTER, FOR_MAP_FINISH, FOR_MAP_PREPARE, if(), level_exp(), m, MAP_DIFFICULTY, MAP_HEIGHT, MAP_WIDTH, object_get_value(), QUERY_FLAG, and object::stats.
Referenced by cfapi_map_get_map_property(), generate_random_map(), and mapfile_load().
int can_see_monsterP | ( | mapstruct * | m, |
int | x, | ||
int | y, | ||
int | dir | ||
) |
Recursive routine to see if we can find a path to a certain point.
Modified to be map tile aware -.MSW
m | map we're on |
x | |
y | origin coordinates |
dir | direction we're going to. Must be less than SIZEOFFREE. |
Definition at line 3822 of file object.cpp.
References can_see_monsterP(), freearr_x, freearr_y, get_map_flags(), m, P_BLOCKSVIEW, P_OUT_OF_MAP, and reduction_dir.
Referenced by can_see_monsterP(), do_skill_ident(), monster_find_nearest_enemy(), and spell_find_dir().
Permanently alters an object's stats/flags based on another object.
Definition at line 394 of file living.cpp.
References living::ac, add_string(), object::arch, AT_CONFUSION, ATNR_PHYSICAL, object::attacktype, BOW, change_attr_value(), change_resist_msg, check_stat_bounds(), CLEAR_FLAG, archetype::clone, object::contr, DIFF_MSG, player::do_los, draw_ext_info, draw_ext_info_format(), living::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, living::food, free_string(), gain_msg, get_attr_value(), living::grace, living::hp, lose_msg, living::luck, Settings::max_stat, MIN_STAT, MOVE_FLY_HIGH, MOVE_FLY_LOW, MOVE_SWIM, object::move_type, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_ATTACKTYPE_GAIN, MSG_TYPE_ATTRIBUTE_ATTACKTYPE_LOSS, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START, MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END, MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_START, MSG_TYPE_ATTRIBUTE_MOVE, MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN, MSG_TYPE_ATTRIBUTE_PROTECTION_LOSS, MSG_TYPE_ATTRIBUTE_RACE, MSG_TYPE_ATTRIBUTE_STAT_GAIN, MSG_TYPE_ATTRIBUTE_STAT_LOSS, NDI_BLUE, NDI_UNIQUE, NROFATTACKS, NUM_STATS, object_check_move_on(), player::orig_stats, object::path_attuned, object::path_denied, object::path_repelled, PLAYER, POTION, QUERY_FLAG, object::race, object::resist, set_attr_value(), SET_FLAG, settings, SKILL, living::sp, object::stats, object::type, and living::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().
void change_attr_value | ( | living * | stats, |
int | attr, | ||
int8_t | value | ||
) |
Like set_attr_value(), but instead the value (which can be negative) is added to the specified stat.
stats | item to modify. Must not be NULL. |
attr | attribute to change. |
value | delta (can be positive). |
Definition at line 264 of file living.cpp.
References CHARISMA, CONSTITUTION, DEXTERITY, INTELLIGENCE, llevError, LOG(), POWER, stats, STRENGTH, and WISDOM.
Referenced by add_abilities(), alchemy_failure_effect(), apply_changes_to_player(), change_abil(), drain_specific_stat(), fix_object(), and kill_player_not_permadeath().
void change_exp | ( | object * | op, |
int64_t | exp, | ||
const char * | skill_name, | ||
int | flag | ||
) |
Changes experience to a player/monster.
This does bounds checking to make sure we don't overflow the max exp.
The exp passed is typically not modified much by this function - it is assumed the caller has modified the exp as needed. skill_name is the skill that should get the exp added. flag is what to do if player doesn't have the skill. these last two values are only used for players.
op | victim to alter. |
exp | experience to gain (positive) or lose (negative). |
skill_name | skill to change. Can be NULL. |
flag |
|
Definition at line 2179 of file living.cpp.
References add_player_exp(), ADD_TOTALEXP, living::exp, FABS, FLAG_ALIVE, object::item_power, level_exp(), llevError, LOG(), MAX_EXPERIENCE, PLAYER, QUERY_FLAG, object::stats, subtract_player_exp(), object::total_exp, object::type, and WEAPON.
Referenced by attempt_do_alchemy(), book_type_apply(), cfapi_object_change_exp(), cure_disease(), do_harvest(), do_hidden_move(), do_skill(), examine_autoidentify(), god_examines_priest(), hit_with_drain(), peacemaker_type_process(), scroll_type_apply(), sell_item(), share_exp(), shop_pay_unpaid_callback(), spellbook_type_apply(), and try_leave_cult().
void change_luck | ( | object * | op, |
int | value | ||
) |
Alter the object's luck.
op | object to altar. |
value | delta to apply. 0 indicates timeout (moves luck towards 0), otherwise change the luck of the object via an applied bad_luck object in inventory. |
Definition at line 796 of file living.cpp.
References arch_present_in_ob(), arch_to_object(), FABS, find_archetype(), FLAG_APPLIED, living::luck, object_insert_in_ob(), RANDOM, SET_FLAG, and object::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 2006 of file map.cpp.
References ext_info_map(), m, MAX_DARKNESS, MSG_SUBTYPE_NONE, MSG_TYPE_MISC, NDI_BLACK, and update_all_map_los().
Referenced by cast_change_map_lightlevel(), cfapi_map_change_light(), dawn_to_dusk(), generate_random_map(), and set_darkness_map().
int check_altar_sacrifice | ( | const object * | altar, |
const object * | sacrifice, | ||
int | remove_others, | ||
int * | toremove | ||
) |
Checks whether the altar has enough to sacrifice.
Function put in (0.92.1) so that identify altars won't grab money unnecessarily - we can see if there is sufficient money, see if something needs to be identified, and then remove money if needed.
0.93.4: Linked objects (ie, objects that are connected) can not be sacrificed. This fixes a bug of trying to put multiple altars/related objects on the same space that take the same sacrifice.
The function will now check for all items sitting on the altar, so that the player can put various matching but non merging items on the altar.
This function can potentially remove other items, if remove_others is set.
altar | item to which there is a sacrifice | |
sacrifice | object that may be sacrifed | |
remove_others | if 1, will remove enough items apart sacrifice to compensate for not having enough in sacrifice itself. | |
[out] | toremove | will contain the nrof of sacrifice to really remove to finish operating. Will be set if not NULL only if the function returns 1. |
Definition at line 347 of file button.cpp.
References ARCH_SACRIFICE, FLAG_UNPAID, FOR_ABOVE_FINISH, FOR_ABOVE_PREPARE, llevError, LOG(), object::map, matches_sacrifice(), object::nrof, NROF(), NROF_SACRIFICE, object_decrease_nrof(), object_remove(), mapstruct::path, QUERY_FLAG, and object::value.
Referenced by identify_altar_type_move_on(), and operate_altar().
int64_t check_exp_adjust | ( | const object * | op, |
int64_t | exp | ||
) |
Returns the maximum experience the object can gain or lose.
op | object which will be the victim. |
exp | experience to gain or lose. |
Definition at line 2102 of file living.cpp.
References check_exp_loss(), living::exp, MAX_EXPERIENCE, MIN, and object::stats.
Referenced by command_addexp().
int64_t check_exp_loss | ( | const object * | op, |
int64_t | exp | ||
) |
This function checks to make sure that object 'op' can lose 'exp' experience.
It basically makes adjustments based on permanent exp and the like. This function should always be used for losing experience - the 'exp' value passed should be positive - this is the amount that should get subtract from the player.
op | object from which to subtract. |
exp | experience to lose. |
Definition at line 2077 of file living.cpp.
References living::exp, PERM_EXP, PERM_EXP_MAX_LOSS_RATIO, Settings::permanent_exp_ratio, settings, object::stats, and object::total_exp.
Referenced by apply_death_exp_penalty(), check_exp_adjust(), kill_object(), and subtract_player_exp().
bool check_formulae | ( | void | ) |
Check if formula don't have the same index.
Since we are doing a squential search on the formulae lists now, we have to be carefull that we dont have 2 formula with the exact same index value. Under the new nbatches code, it is possible to have multiples of ingredients in a cauldron which could result in an index formula mismatch. We *don't *check for that possibility here. -b.t.
LOG() to error level.
Definition at line 292 of file recipe.cpp.
References recipe::arch_name, recipe::arch_names, recipe::cauldron, formulalist, recipe::index, recipelist::items, llevDebug, llevError, LOG(), recipe::next, recipelist::next, recipe::title, recipe::tool, recipe::tool_size, and try_find_archetype().
Referenced by assets_end_load().
Function to search the inventory, of a player and then based on a set of conditions, the square will activate connected items.
Monsters can't trigger this square (for now) Values are: last_sp = 1/0 obj/no obj triggers last_heal = 1/0 remove/dont remove obj if triggered -b.t. (thoma s@no mad.a stro .psu. edu
op | object to check. Must be a player. |
trig | trigger object that may be activated. |
Definition at line 825 of file button.cpp.
References check_inv_recursive(), object::last_heal, object::last_sp, object_decrease_nrof_by_one, PLAYER, object::type, and use_trigger().
Referenced by check_inv_type_move_on().
Checks object and its inventory for specific item.
It will descend through containers to find the object. slaying = match object slaying flag race = match object archetype name flag hp = match object type (excpt type '0'== PLAYER) title = match object title unpaid = 1 -> match only unpaid, 0 -> match only not unpaid Searching by title only is not recommended, as it can be a rather slow operation; use it in combination with archetype or type.
op | object of which to search inventory |
trig | what to search |
Definition at line 782 of file button.cpp.
References object::arch, check_inv_recursive(), FLAG_UNPAID, FOR_INV_FINISH, FOR_INV_PREPARE, living::hp, archetype::name, QUERY_FLAG, object::race, object::slaying, object::stats, object::title, and object::type.
Referenced by blocked_link(), check_inv(), check_inv_recursive(), town_portal_destroy_existing(), and town_portal_find_force().
int check_path | ( | const char * | name, |
int | prepend_dir | ||
) |
This function checks if a file with the given path exists.
name | map path to check. |
prepend_dir | If set, then we call create_pathname (which prepends libdir & mapdir). Otherwise, we assume the name given is fully complete. |
Definition at line 201 of file map.cpp.
References buf, create_pathname(), MAX_BUF, name, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR, and strlcpy().
Referenced by cfapi_system_check_path(), and check_login().
bool check_recipes | ( | ) |
Ensure that all recipes have a valid artifact, and that archetypes are correct.
Definition at line 147 of file recipe.cpp.
References check_recipe(), formulalist, recipelist::items, recipe::next, and recipelist::next.
Referenced by assets_end_load().
void check_stat_bounds | ( | living * | stats, |
int8_t | min_stat, | ||
int8_t | max_stat | ||
) |
Ensures that all stats (str/dex/con/wis/cha/int) are within the passed in range of min_stat and max_stat.
Often, the caller will pass in MIN_STAT and MAX_STAT, but in case of force objects or temporary calculations, we want things outside the range (force objects may have negative stats, but we don't want them too negative)
stats | attributes to check. |
min_stat | lowest the stat can be |
max_stat | highest the stat can be |
Definition at line 354 of file living.cpp.
References get_attr_value(), NUM_STATS, set_attr_value(), and stats.
Referenced by change_abil(), do_symptoms(), fix_object(), fix_player(), and kill_player_not_permadeath().
cause == NULL: nothing has moved, we have been called from animate_trigger().
TRIGGER_ALTAR: Returns 1 if 'cause' was destroyed, 0 if not.
TRIGGER: Returns 1 if handle could be moved, 0 if not.
TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0.
Definition at line 518 of file button.cpp.
References living::ac, FOR_ABOVE_FINISH, FOR_ABOVE_PREPARE, object::last_sp, llevDebug, LOG(), object::move_on, object::move_type, object::name, NROF(), NUM_ANIMATIONS, object_update(), object_update_speed(), operate_altar(), PLAYER, object::race, SET_ANIMATION, object::slaying, object::speed, object::stats, TRIGGER, TRIGGER_ALTAR, TRIGGER_BUTTON, trigger_move(), TRIGGER_PEDESTAL, object::type, UP_OBJ_FACE, object::value, living::wc, and object::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().
void clean_friendly_list | ( | void | ) |
It traverses the friendly list removing objects that should not be here (ie, do not have friendly flag set, freed, etc)
Definition at line 80 of file friend.cpp.
References FLAG_FREED, FLAG_FRIENDLY, friends, llevDebug, LOG(), 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 1599 of file map.cpp.
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().
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 1965 of file map.cpp.
References m.
Referenced by clean_tmp_files(), flush_old_maps(), and ready_map_name().
void clear_friendly_list | ( | void | ) |
Totally clear the friendly list.
Definition at line 134 of file friend.cpp.
References friends.
Referenced by free_globals().
void clear_los | ( | player * | pl | ) |
Clears/initialises the los-array associated to the player controlling the object.
pl | player to clear. |
Definition at line 270 of file los.cpp.
References player::blocked_los, LOS_NO_DARKNESS, MAP_CLIENT_X, and MAP_CLIENT_Y.
Referenced by do_wizard_dm(), get_player(), and update_los().
void clear_player | ( | player * | pl | ) |
Clears data in player structure.
Socket isn't touched. Nor is anything that doesn't need to be freed. So you may need to do a memset() to clear out values.
pl | player to clear. Pointer is still valid, and can be reused for "play again". |
Definition at line 33 of file player.cpp.
References player::delayed_buffers, player::delayed_buffers_allocated, player::delayed_buffers_used, FREE_AND_CLEAR, FREE_AND_CLEAR_STR, FREE_OBJ_NO_DESTROY_CALLBACK, player::last_exit, client_spell::next, object_free(), player::spell_state, player::stack_items, player::stack_position, and player::unarmed_skill.
Referenced by free_player(), and get_player().
object* create_archetype | ( | const char * | name | ) |
Finds which archetype matches the given name, and returns a new object containing a copy of the archetype.
name | archetype name |
Definition at line 276 of file arch.cpp.
References arch_to_object(), create_singularity(), name, and try_find_archetype().
Referenced by add_force(), alchemy_failure_effect(), apply_handle_yield(), become_follower(), blind_living(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_create_missile(), cast_create_town_portal(), cast_curse(), cast_spell(), cast_word_of_recall(), change_book(), charge_mana_effect(), command_use(), confuse_living(), converter_type_move_on(), create_aura(), dialog_preparse(), do_item_conversion(), do_symptoms(), eat_special_food(), examine_monster(), find_or_create_connection_for_map(), find_transmution_ob(), fire_swarm(), fix_generated_item(), get_npc(), god_examines_priest(), god_intervention(), grant_immunity(), keyplace(), kill_player_not_permadeath(), locate_recipe_artifact(), lock_and_hide_doors(), make_object_glow(), object_handle_death_animation(), place_alchemy_objects(), place_chest(), place_exits(), potion_type_apply(), pray_at_altar(), prayer_failure(), put_a_monster(), recharge(), save_throw_object(), scroll_failure(), spell_failure(), surround_by_doors(), swap_random_stats(), town_portal_destroy_existing(), transmute_item_to_flower(), trap_show(), and write_rune().
object* create_archetype_by_object_name | ( | const char * | name | ) |
Creates an object given the name that appears during the game (for example, "writing pen" instead of "stylus").
name | the name we're searching for (ex: "writing pen"), must not be null |
Definition at line 114 of file arch.cpp.
References arch_to_object(), AssetsManager::archetypes(), create_singularity(), Archetypes::findByObjectName(), getManager(), MAX_BUF, and name.
Referenced by check_loaded_object(), and god_intervention().
void create_overlay_pathname | ( | const char * | name, |
char * | buf, | ||
size_t | size | ||
) |
Same as create_pathname(), but for the overlay maps.
/
name | path of the overlay map. |
buf | buffer that will contain the full path. |
size | buffer's length. |
Definition at line 125 of file map.cpp.
References buf, Settings::localdir, Settings::mapdir, name, and settings.
Referenced by cfapi_map_create_path(), command_overlay_reset(), load_overlay_map(), map_path(), and save_map().
char* create_pathname | ( | const char * | name, |
char * | buf, | ||
size_t | size | ||
) |
Get the full path to a map file.
This simply means prepending the correct map directory to the given path.
name | path of the map. |
buf | buffer that will contain the full path. |
size | buffer's length. |
Definition at line 104 of file map.cpp.
References buf, Settings::datadir, Settings::mapdir, name, and settings.
Referenced by cfapi_map_create_path(), check_path(), enter_fixed_template_map(), map_path(), process_map(), 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 253 of file arch.cpp.
References add_string(), object::arch, ARCH_SINGULARITY, buf, empty_archetype, FLAG_NO_PICK, MAX_BUF, name, object::name, object::name_pl, object_new(), and SET_FLAG.
Referenced by create_archetype(), and create_archetype_by_object_name().
void create_template_pathname | ( | const char * | name, |
char * | buf, | ||
size_t | size | ||
) |
same as create_pathname(), but for the template maps.
name | path of the template map. |
buf | buffer that will contain the full path. |
size | buf's length |
Definition at line 145 of file map.cpp.
References buf, Settings::localdir, name, settings, and Settings::templatedir.
Referenced by enter_fixed_template_map(), and enter_random_template_map().
void create_treasure | ( | treasurelist * | t, |
object * | op, | ||
int | flag, | ||
int | difficulty, | ||
int | tries | ||
) |
This calls the appropriate treasure creation function.
t | what to generate. |
op | for who to generate the treasure. |
flag | combination of GT_xxx values. |
difficulty | map difficulty. |
tries | to avoid infinite recursion. |
Definition at line 263 of file treasure.cpp.
References create_all_treasures(), create_one_treasure(), llevDebug, llevError, LOG(), and t.
Referenced by apply_auto(), apply_auto_fix(), apply_race_and_class(), auto_apply_fix_inventory(), command_create(), create_all_treasures(), create_one_treasure(), do_auto_apply(), do_harvest(), fix_generated_item(), fix_summon_pet(), generate_monster_arch(), generate_monster_inv(), generate_treasure(), give_initial_items(), god_intervention(), key_change_class(), pets_summon_object(), polymorph_living(), put_a_monster(), and rune_attack().
void decay_objects | ( | mapstruct * | m | ) |
Decay and destroy persihable items in a map.
Definition at line 175 of file utils.cpp.
References CLOAK, FLAG_IS_FLOOR, FLAG_OBJ_ORIGINAL, FLAG_OVERLAY_FLOOR, FLAG_UNIQUE, FLAG_UNPAID, FOOD, FOR_MAP_FINISH, FOR_MAP_PREPARE, GIRDLE, GLOVES, IS_ARMOR, IS_LIVE, IS_SHIELD, IS_WEAPON, m, M_ADAMANT, M_BONE, M_CLOTH, M_GLASS, M_ICE, M_IRON, M_LEATHER, M_LIQUID, M_ORGANIC, M_PAPER, M_SOFT_METAL, M_STONE, M_WOOD, MAP_HEIGHT, MAP_WIDTH, object_free_drop_inventory(), object_remove(), QUERY_FLAG, and rndm().
Referenced by ready_map_name().
void delete_map | ( | mapstruct * | m | ) |
Frees the map, including the mapstruct.
This deletes all the data on the map (freeing pointers) and then removes this map from the global linked list of maps.
m | pointer to mapstruct, if NULL no action. Will be invalid after this function. |
Definition at line 1708 of file map.cpp.
References first_map, FREE_AND_CLEAR_STR_IF, free_map(), llevError, LOG(), m, MAP_IN_MEMORY, MAP_SAVING, mapstruct::next, and mapstruct::tile_map.
Referenced by cfapi_map_delete_map(), flush_old_maps(), free_all_maps(), free_style_maps(), init_dynamic(), key_confirm_quit(), mapfile_load_lowlevel(), process_map(), ready_map_name(), and swap_map().
StringBuffer* describe_attacktype | ( | const char * | attack, |
int | value, | ||
StringBuffer * | buf | ||
) |
Describe the specified attack type.
attack | string describing the attack ("Clawing", and such). |
value | attack type to describe. |
buf | where to describe, can be NULL. |
Definition at line 538 of file utils.cpp.
References attacks, buf, NROFATTACKS, stringbuffer_append_printf(), stringbuffer_append_string(), and stringbuffer_new().
Referenced by describe_item(), and describe_monster().
int describe_god | ( | const object * | god, |
int | what, | ||
StringBuffer * | buf, | ||
size_t | maxlen | ||
) |
Describe a god.
The reason we return a combination is to know what exactly was written for knowledge management.
god | which god to describe. |
what | information to describe, combination of GOD_xxx flags. |
buf | where to describe, must not be NULL. |
maxlen | maximum wanted length of the description, if 0 no maximum length. |
Definition at line 109 of file holy.cpp.
References attacktype_desc, buf, describe_resistance(), describe_spellpath_attenuation(), GOD_BLESSED, GOD_ENEMY, GOD_HOLYWORD, GOD_IMMUNITIES, GOD_PATHS, GOD_RESISTANCES, GOD_SACRED, HUGE_BUF, MAX_BUF, object::msg, name, object::name, NROFATTACKS, nstrtok(), object::path_attuned, object::path_denied, object::path_repelled, PATH_SUMMON, PATH_TURNING, object::race, object::resist, object::slaying, stringbuffer_append_printf(), stringbuffer_append_string(), stringbuffer_append_stringbuffer(), stringbuffer_finish(), stringbuffer_length(), stringbuffer_new(), strtoktolin(), and object::title.
Referenced by god_info_msg(), and knowledge_god_detail().
StringBuffer* describe_item | ( | const object * | op, |
const object * | owner, | ||
int | use_media_tags, | ||
StringBuffer * | buf | ||
) |
Describes an item, in all its details.
It would be really handy to actually pass another object pointer on who is examining this object. Then, you could reveal certain information depending on what the examiner knows, eg, wouldn't need to use the SEE_INVISIBLE flag to know it is a dragon player examining food. Could have things like a dwarven axe, in which the full abilities are only known to dwarves, etc.
Add 'owner' who is the person examining this object. owner can be null if no one is being associated with this item (eg, debug dump or the like)
op | object to describe. Must not be NULL. |
owner | player examining the object. |
use_media_tags | if non-zero, then media tags (colors and such) are inserted in the description. This enables the player to more easily see some things. |
buf | buffer that will contain the description. Can be NULL. |
Definition at line 951 of file item.cpp.
References living::ac, AMULET, ARMOUR, ARMOUR_SPEED, ARMOUR_SPELLS, ARROW, atnr_is_dragon_enabled(), object::attacktype, BOOTS, BOW, BRACERS, buf, change_resist_msg, CLOAK, living::dam, describe_attacktype(), describe_monster(), describe_resistance(), describe_spellpath_attenuation(), DRINK, living::exp, FLAG_BEEN_APPLIED, FLAG_CURSED, FLAG_LIFESAVE, FLAG_MONSTER, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_REFLECTING, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_XRAYS, FLESH, FMT64, living::food, FOOD, FORCE, get_attr_value(), GIRDLE, GLOVES, object::glow_radius, living::grace, HELMET, living::hp, is_dragon_pl(), is_identified(), object::item_power, LAMP, object::last_eat, object::level, living::luck, object::magic, MOVE_FLY_HIGH, MOVE_FLY_LOW, MOVE_SWIM, object::move_type, NUM_STATS, object::path_attuned, object::path_denied, object::path_repelled, PLAYER, QUERY_FLAG, RING, ring_desc(), ROD, SHIELD, short_stat_name, SKILL, SKILL_TOOL, object::slaying, living::sp, object::stats, stringbuffer_append_printf(), stringbuffer_append_string(), stringbuffer_new(), object::title, object::type, WAND, living::wc, WEAPON, and WEAPON_SPEED.
Referenced by artifact_describe(), cfapi_object_describe(), common_ob_describe(), dump_abilities(), knowledge_add_probe_monster(), knowledge_monster_detail(), mon_desc(), and perceive_self().
StringBuffer* describe_monster | ( | const object * | op, |
int | use_media_tags, | ||
StringBuffer * | buf | ||
) |
Describes a monster.
op | monster to describe. Must not be NULL, and must have FLAG_MONSTER or be a PLAYER. |
use_media_tags | if non-zero, then media tags (colors and such) are inserted in the description. This enables the player to more easily see some things. |
buf | buffer that will contain the description. Can be NULL. |
Definition at line 777 of file item.cpp.
References object::attacktype, buf, object::contr, describe_attacktype(), describe_resistance(), describe_spellpath_attenuation(), player::digestion, FABS, FLAG_CAN_USE_SKILL, FLAG_CAST_SPELL, FLAG_FRIENDLY, FLAG_HITBACK, FLAG_MONSTER, FLAG_SEE_INVISIBLE, FLAG_STEALTH, FLAG_UNAGGRESSIVE, FLAG_UNDEAD, FLAG_USE_ARMOUR, FLAG_USE_BOW, FLAG_USE_RANGE, FLAG_USE_RING, FLAG_USE_SCROLL, FLAG_USE_WEAPON, player::gen_grace, player::gen_hp, player::gen_sp, is_dragon_pl(), treasurelist::items, living::luck, MIN_ACTIVE_SPEED, object_find_by_type_and_name(), object::path_attuned, object::path_denied, object::path_repelled, PLAYER, QUERY_FLAG, object::randomitems, SKILL, object::speed, SPELL, object::stats, stringbuffer_append_printf(), stringbuffer_append_string(), stringbuffer_new(), t, and object::type.
Referenced by describe_item().
StringBuffer* describe_resistance | ( | const object * | op, |
int | newline, | ||
int | use_media_tags, | ||
StringBuffer * | buf | ||
) |
Generates the visible naming for resistances.
op | object we want information about. |
newline | If TRUE, we don't put parens around the description but do put a newline at the end. Useful when dumping to files |
use_media_tags | if non-zero, then media tags (colors and such) are inserted in the description. This enables the player to more easily see some things. |
buf | buffer that will receive the description. Can be NULL. |
Definition at line 372 of file item.cpp.
References atnr_is_dragon_enabled(), buf, FLESH, NROFATTACKS, object::resist, resist_color, resist_plus, stringbuffer_append_printf(), stringbuffer_append_string(), stringbuffer_new(), and object::type.
Referenced by describe_god(), describe_item(), describe_monster(), dump_gods(), and ring_desc().
StringBuffer* describe_spellpath_attenuation | ( | const char * | attenuation, |
int | value, | ||
StringBuffer * | buf | ||
) |
Describe the specified path attenuation.
attenuation | string describing if "Attenued", "Denied", "Repelled", may be NULL. |
value | path value to describe. |
buf | where to describe, can be NULL. |
Definition at line 507 of file utils.cpp.
References buf, NRSPELLPATHS, spellpathnames, stringbuffer_append_printf(), stringbuffer_append_string(), and stringbuffer_new().
Referenced by describe_god(), describe_item(), describe_monster(), ring_desc(), and stringbuffer_append_spelldesc().
int did_make_save | ( | const object * | op, |
int | level, | ||
int | bonus | ||
) |
This function takes an object (monster/player, op), and determines if it makes a basic save throw by looking at the save_throw table.
op | potential victim. |
level | the effective level to make the save at |
bonus | any plus/bonus (typically based on resistance to particular attacktype). |
Definition at line 2293 of file living.cpp.
References bonus, level, 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 122 of file utils.cpp.
References llevError, LOG(), living::luck, MAX, MIN, PLAYER, RANDOM, object::stats, and object::type.
Referenced by attempt_hide(), attempt_pick_lock(), attempt_steal(), fire_swarm(), identify_object_with_skill(), pets_summon_object(), pick_arrow_target(), player_lvl_adj(), scroll_type_apply(), and spellbook_type_apply().
int dirdiff | ( | int | dir1, |
int | dir2 | ||
) |
Computes a direction difference.
dir1 | |
dir2 | directions to compare. |
Definition at line 3732 of file object.cpp.
References d.
Referenced by monster_cast_spell(), monster_use_range(), monster_use_scroll(), and monster_use_skill().
void drain_specific_stat | ( | object * | op, |
int | deplete_stats | ||
) |
Drain a specified stat from op.
op | victim to drain. |
deplete_stats | statistic to drain. |
Definition at line 728 of file living.cpp.
References ARCH_DEPLETION, arch_present_in_ob(), arch_to_object(), change_attr_value(), drain_msg, draw_ext_info, find_archetype(), fix_object(), FLAG_APPLIED, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_STAT_LOSS, NDI_UNIQUE, object_insert_in_ob(), SET_FLAG, and object::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 716 of file living.cpp.
References drain_specific_stat(), NUM_STATS, and RANDOM.
Referenced by hit_with_one_attacktype(), and potion_type_apply().
void dump_abilities | ( | void | ) |
Dump to standard out the abilities of all monsters.
Definition at line 52 of file info.cpp.
References archetypes, AssetsManager::archetypes(), archetype::clone, describe_item(), AssetsCollection< T, Key >::each(), FLAG_CHANGING, FLAG_MONSTER, FMT64, getManager(), HEAD, if(), name, archetype::name, object::other_arch, QUERY_FLAG, and stringbuffer_finish().
Referenced by init_beforeplay().
void dump_alchemy | ( | void | ) |
Dumps alchemy recipes to output.
Borrowed (again) from the artifacts code for this.
Definition at line 350 of file recipe.cpp.
References recipe::arch_name, recipe::arch_names, buf, recipe::cauldron, recipe::chance, recipe::diff, recipe::exp, formulalist, recipe::index, recipe::ingred, recipelist::items, llevError, locate_recipe_artifact(), LOG(), logfile, MAX_BUF, linked_char::name, recipe::next, recipelist::next, linked_char::next, recipelist::number, recipe::skill, strlcpy(), strtoint(), recipe::title, recipelist::total_chance, and try_find_archetype().
Referenced by init_beforeplay().
void dump_alchemy_costs | ( | void | ) |
Dumps to output all costs of recipes.
Code copied from dump_alchemy() and modified by Raphael Quinet
Definition at line 588 of file recipe.cpp.
References recipe::arch_name, recipe::arch_names, buf, recipe::chance, archetype::clone, formulalist, recipe::ingred, artifact::item, recipelist::items, llevError, locate_recipe_artifact(), LOG(), logfile, MAX_BUF, linked_char::name, recipe::next, recipelist::next, linked_char::next, recipelist::number, recipe_find_ingredient_cost(), recipe::skill, strlcpy(), recipe::title, recipelist::total_chance, try_find_archetype(), object::value, and recipe::yield.
Referenced by init_beforeplay().
void dump_all_archetypes | ( | void | ) |
Dumps all archetypes to debug-level output.
If you run crossfire with debug, and enter DM-mode, you can trigger this with the "dumpallarchetypes" command.
Definition at line 148 of file arch.cpp.
References AssetsManager::archetypes(), dump_arch(), AssetsCollection< T, Key >::each(), getManager(), llevDebug, LOG(), stringbuffer_finish(), and stringbuffer_new().
Referenced by command_dumpallarchetypes().
void dump_all_maps | ( | void | ) |
Prints out debug-information about all maps.
This basically just goes through all the maps and calls dump_map() on each one. Can be used by a DM with the dumpallmaps command.
Definition at line 268 of file map.cpp.
References dump_map(), first_map, and m.
Referenced by command_dumpallmaps().
void dump_animations | ( | void | ) |
Dump all animations to stderr, for debugging purposes.
Definition at line 180 of file anim.cpp.
References AssetsManager::animations(), AssetsCollection< T, Key >::each(), and getManager().
Referenced by server_dump_animations().
void dump_arch | ( | archetype * | at, |
StringBuffer * | sb | ||
) |
Dumps an archetype to buffer.
at | archetype to dump. Must not be NULL. |
sb | buffer that will contain dumped information. |
Definition at line 139 of file arch.cpp.
References archetype::clone, and object_dump().
Referenced by dump_all_archetypes().
void dump_artifacts | ( | void | ) |
For debugging purposes.
Dumps all tables.
Definition at line 614 of file artifact.cpp.
References first_artifactlist, artifactlist::items, logfile, artifactlist::next, artifactlist::total_chance, and artifactlist::type.
Referenced by init_beforeplay().
void dump_experience | ( | void | ) |
void dump_faces | ( | void | ) |
Dump all faces to stderr, for debugging purposes.
Definition at line 159 of file image.cpp.
References AssetsCollection< T, Key >::each(), face(), AssetsManager::faces(), getManager(), and treasurelist::name.
Referenced by server_dump_faces().
void dump_friendly_objects | ( | void | ) |
Dumps all friendly objects.
Invoked in DM-mode with dumpfriendlyobjects command.
Definition at line 70 of file friend.cpp.
References friends.
Referenced by command_dumpfriendlyobjects().
void dump_gods | ( | void | ) |
Prints all gods to stderr.
Definition at line 367 of file holy.cpp.
References living::ac, object::attacktype, archetype::clone, living::Con, living::dam, DESCRIBE_ABILITY, DESCRIBE_PATH, describe_resistance(), living::Dex, FLAG_BLIND, FLAG_MAKE_INVIS, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_UNDEAD, FLAG_USE_ARMOUR, FLAG_USE_WEAPON, FLAG_XRAYS, living::hp, HUGE_BUF, living::Int, object::last_eat, object::last_grace, object::last_heal, object::last_sp, object::level, living::luck, object::msg, object::name, archetype::name, object::other_arch, object::path_attuned, object::path_denied, object::path_repelled, living::Pow, QUERY_FLAG, object::race, object::slaying, object::speed, object::stats, living::Str, stringbuffer_finish(), object::title, living::wc, and living::Wis.
Referenced by init_beforeplay().
void dump_map | ( | const mapstruct * | m | ) |
Prints out debug-information about a map.
Dumping these at llevError doesn't seem right, but is necessary to make sure the information is in fact logged. Can be used by a DM with the dumpmap command.
m | map to dump. |
Definition at line 245 of file map.cpp.
References llevError, LOG(), m, MAP_ENTER_X, MAP_ENTER_Y, MAP_HEIGHT, and MAP_WIDTH.
Referenced by command_dumpmap(), and dump_all_maps().
void dump_monster_treasure | ( | const char * | name | ) |
For debugging purposes.
Dumps all treasures for a given monster. Created originally by Raphael Quinet for debugging the alchemy code.
Definition at line 1244 of file treasure.cpp.
References AssetsManager::archetypes(), AssetsCollection< T, Key >::each(), is_valid_types_gen::found, getManager(), logfile, name, and strcasecmp().
Referenced by init_beforeplay().
void dump_stat_bonuses | ( | ) |
Definition at line 2651 of file living.cpp.
References bonus, float_bonuses, int_bonuses, Settings::max_stat, NUM_FLOAT_BONUSES, NUM_INT_BONUSES, and settings.
Referenced by server_dump_bonuses().
int exp_level | ( | int64_t | exp | ) |
Returns the level for a given exp.
exp | experince points to look up in the level table |
Definition at line 1897 of file living.cpp.
References level, levels, Settings::max_level, and settings.
Referenced by show_skills().
void fatal | ( | enum fatal_error | err | ) |
fatal() is meant to be called whenever a fatal signal is intercepted.
It will call the emergency_save and the clean_tmp_files functions.
Definition at line 590 of file utils.cpp.
References clean_tmp_files(), emergency_save(), Settings::fatal_hook, logfile, and settings.
Referenced by account_alloc(), add_to_tar(), allocate_map(), assets_pack(), bufferreader_create(), bufferreader_init_for_length(), build_stringlist(), check_generators(), do_each_skill(), do_module(), ensure_available_characters(), expand_objects(), get_archetype_struct(), get_client_spell_state(), get_empty_artifact(), get_empty_artifactlist(), get_empty_book(), get_empty_booklist(), get_empty_formula(), get_empty_mat(), get_empty_treasure(), get_linked_map(), get_new_quest_state(), get_objectlink(), get_objectlinkpt(), get_or_create_quest(), get_or_create_state(), get_player(), get_player_archetype(), get_region_struct(), i18n_init(), init_dynamic(), init_experience(), init_formulae(), init_library(), init_listening_socket(), init_recipelist(), init_regions(), init_server(), knowledge_get_or_create(), knowledge_give(), PngLoader::load(), MessageLoader::load(), TreasureLoader::loadTreasure(), minheap_init(), monster_compute_path(), new_connection(), new_shared_string(), object_new(), parse_dialog_information(), parse_shop_string(), player_get_delayed_buffer(), quest_create_condition(), quest_create_step(), re_init(), set_player_socket(), shop_inventory_type_apply(), SockList_Ensure(), stringbuffer_ensure(), and stringbuffer_new().
Animations* find_animation | ( | const char * | name | ) |
Definition at line 273 of file assets.cpp.
References AssetsManager::animations(), AssetsCollection< T, Key >::get(), manager, and name.
Referenced by mimic_type_apply(), transport_type_apply(), and while().
archetype* find_archetype | ( | const char * | name | ) |
Definition at line 265 of file assets.cpp.
References AssetsManager::archetypes(), AssetsCollection< T, Key >::get(), manager, and name.
Referenced by animate_bomb(), apply_builder_window(), apply_map_builder(), can_pay(), cast_raise_dead_spell(), change_luck(), drain_specific_stat(), find_enclosed_spot(), find_next_coin(), fix_flesh_item(), init_archetype_pointers(), kill_player_not_permadeath(), kill_player_permadeath(), make_formula_book(), msgfile_msg(), object_replace_insert_in_map(), op_on_battleground(), pay_from_container(), place_exits(), place_fountain_with_specials(), poison_living(), process_map(), put_in_icecube(), remove_depletion(), restore_player(), save_object_in_sb(), sell_item(), slow_living_by(), and while().
archetype* find_archetype_by_object_name | ( | const char * | name | ) |
This function retrieves an archetype given the name that appears during the game (for example, "writing pen" instead of "stylus").
It does not use the hashtable system, but browse the whole archlist each time. I suggest not to use it unless you really need it because of performance issue. It is currently used by scripting extensions (create-object). Params:
name | the name we're searching for (ex: "writing pen") |
Definition at line 51 of file arch.cpp.
References AssetsManager::archetypes(), Archetypes::findByObjectName(), getManager(), and name.
Referenced by artifact_describe(), artifact_get_face(), cfapi_object_create(), command_create(), knowledge_god_detail(), and knowledge_god_validate().
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 64 of file arch.cpp.
References AssetsManager::archetypes(), Archetypes::findByObjectTypeName(), getManager(), name, and is_valid_types_gen::type.
Referenced by cast_create_food().
Searches and returns a specific artifact compatible with an object, NULL if not found.
op | item to search the artifact for. |
name | artifact name. |
Definition at line 589 of file artifact.cpp.
References find_artifactlist(), find_string(), legal_artifact_combination(), list, name, sstring, and object::type.
Referenced by add_one_item(), do_single_item(), save_object_in_sb(), and while().
artifactlist* find_artifactlist | ( | int | type | ) |
Finds the artifact list for a certain item type.
type | item type to get the artifacts of. |
Definition at line 574 of file artifact.cpp.
References first_artifactlist, artifactlist::next, artifactlist::type, and is_valid_types_gen::type.
Referenced by artifact_compute_chance_for_item(), artifact_msg(), cast_create_missile(), command_create(), find_artifact(), generate_artifact(), ArtifactLoader::load(), and locate_recipe_artifact().
uint8_t find_color | ( | const char * | name | ) |
Finds a color by name.
name | color name, case-sensitive. |
Definition at line 75 of file image.cpp.
References colorname, llevError, LOG(), and name.
Referenced by FaceLoader::load().
int find_dir_2 | ( | int | x, |
int | y | ||
) |
Computes a direction which you should travel to move of x and y.
x | |
y | delta. |
Definition at line 3677 of file object.cpp.
Referenced by enter_map(), get_rangevector(), and get_rangevector_from_mapcoord().
const Face* find_face | ( | const char * | name | ) |
Definition at line 281 of file assets.cpp.
References AssetsManager::faces(), AssetsCollection< T, Key >::get(), manager, and name.
Referenced by MessageLoader::load(), FaceLoader::loadAnimationBlock(), and while().
const object* find_god | ( | const char * | name | ) |
Returns a god's object from its name.
name | god's name. |
Definition at line 317 of file holy.cpp.
References is_valid_types_gen::found, and gods.
Referenced by become_follower(), cast_bless(), cast_consecrate(), cast_curse(), cast_detection(), cast_smite_spell(), command_setgod(), determine_god(), hit_player(), hit_with_one_attacktype(), mood_change(), perceive_self(), pets_summon_golem(), pets_summon_object(), pray_at_altar(), and tailor_god_spell().
Find a recipe for a specified tool.
This function can be called multiple times to browse the whole list, using the 'from' parameter.
tool | tool's archetype name. |
from | formula to search from, if NULL from the first one. |
Definition at line 894 of file recipe.cpp.
References formulalist, get_formulalist(), recipe::ingred_count, list, recipe::next, t, recipe::tool, and recipe::tool_size.
Referenced by command_use().
Find the smooth face for a given face.
face | the face to find the smoothing face for |
smoothed | return value: set to smooth face |
Definition at line 102 of file image.cpp.
References face().
Referenced by send_smooth().
Find a treasure with a matching name.
The 'depth' parameter is only there to prevent infinite loops in treasure lists (a list referencing another list pointing back to the first one).
t | item of treasure list to search from |
name | name we're trying to find. Doesn't need to be a shared string. |
depth | current depth. Code will exit if greater than 10. |
Definition at line 422 of file recipe.cpp.
References find_treasure_by_name(), find_treasurelist(), treasurelist::items, name, strcasecmp(), and t.
Referenced by find_treasure_by_name().
treasurelist* find_treasurelist | ( | const char * | name | ) |
Search for the given treasurelist by name.
name | treasure list to search. |
Definition at line 248 of file assets.cpp.
References AssetsCollection< T, Key >::get(), manager, name, and AssetsManager::treasures().
Referenced by apply_race_and_class(), check_treasurelist(), create_all_treasures(), create_one_treasure(), do_harvest(), dragon_ability_gain(), dump_monster_treasure_rec(), find_treasure_by_name(), god_intervention(), key_change_class(), place_chest(), resurrect_player(), and while().
void first_arch_pass | ( | FILE * | fp, |
const char * | filename | ||
) |
fix_generated_item(): This is called after an item is generated, in order to set it up right.
This produced magical bonuses, puts spells into scrolls/books/wands, makes it unidentified, hides the value, etc.
4/28/96 added creator object from which op may now inherit properties based on op->type. Right now, which stuff the creator passes on is object type dependant. I know this is a spagetti manuever, but is there a cleaner way to do this? b.t.
op | object to fix. |
creator | for who op was created. Can be NULL. |
difficulty | difficulty level. |
max_magic | maximum magic for the item. |
flags |
|
Definition at line 903 of file treasure.cpp.
References add_string(), AMULET, amulet_arch, object::arch, ARMOUR, BOOK, BRACERS, calc_item_power(), CHANCE_FOR_ARTIFACT, CLOAK, CONTAINER, create_archetype(), create_treasure(), crown_arch, d, object::dam_modifier, DICE2, mapstruct::difficulty, object::duration_modifier, living::exp, fix_flesh_item(), FLAG_ALIVE, FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IS_THROWN, FLAG_MONSTER, FLAG_NO_PICK, FLAG_STARTEQUIP, flags, living::food, FREE_AND_COPY, generate_artifact(), GET_ANIM_ID, get_power_from_ench(), GT_ENVIRONMENT, GT_MINIMAL, GT_ONLY_GOOD, GT_STARTEQUIP, HELMET, object::inv, object::item_power, object::level, level_for_item(), llevDebug, LOG(), object::magic, object::map, MONEY, object::msg, object::name, object::name_pl, object::nrof, NUM_ANIMATIONS, object_free_drop_inventory(), object_insert_in_ob(), object_remove(), POTION, QUERY_FLAG, RANDOM, object::randomitems, object::range_modifier, RING, ring_arch, rndm(), ROD, rod_adjust(), RUNE, SCROLL, SET_ANIMATION, SET_FLAG, set_magic(), set_materialname(), set_ring_bonus(), SHIELD, object::slaying, living::sp, special_potion(), SPELL, spell_mapping, SPELLBOOK, object::stats, tailor_readable_ob(), object::title, TRAP, trap_adjust(), object::type, object::value, WAND, and WEAPON.
Referenced by do_item_conversion(), do_single_item(), god_gives_present(), move_creator(), and polymorph_item().
void fix_object | ( | object * | op | ) |
Updates all abilities given by applied objects in the inventory of the given object.
This functions starts from base values (archetype or player object) and then adjusts them according to what the player/monster has equipped.
Note that a player always has stats reset to their initial value.
July 95 - inserted stuff to handle new skills/exp system - b.t. spell system split, grace points now added to system –peterm
November 2006: max armor speed is always taken into account, no exception.
op | object to reset. |
Definition at line 1132 of file living.cpp.
References living::ac, add_refcount(), AMULET, player::applied_stats, object::arch, ARCH_DEPLETION, ARMOUR, ARMOUR_SPEED, AT_PHYSICAL, ATNR_PHYSICAL, object::attacktype, object::body_info, object::body_used, BOOTS, BOW, BRACERS, BUILDER, change_attr_value(), check_stat_bounds(), object::chosen_skill, CLEAR_FLAG, CLOAK, archetype::clone, CLOSE_CON, CONTAINER, object::contr, object::current_weapon, living::dam, player::digestion, DISEASE, player::encumbrance, fix_player(), FLAG_APPLIED, FLAG_BLIND, FLAG_CONFUSED, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_MONSTER, FLAG_PROBE, FLAG_READY_WEAPON, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_UNDEAD, FLAG_USE_ARMOUR, FLAG_WIZ, FLAG_XRAYS, FOR_INV_FINISH, FOR_INV_PREPARE, FORCE, free_string(), player::gen_grace, player::gen_hp, player::gen_sp, player::gen_sp_armour, get_attr_value(), GIRDLE, GLOVES, object::glow_radius, HELMET, if(), object::invisible, IS_COMBAT_SKILL, IS_GRACE_SKILL, IS_MANA_SKILL, player::item_power, object::level, llevDebug, llevInfo, LOG(), living::luck, MAX, Settings::max_level, Settings::max_stat, MIN_ACTIVE_SPEED, MOVE_FLY_HIGH, MOVE_FLY_LOW, object::move_type, MOVE_WALK, object::name, archetype::name, NROFATTACKS, NUM_BODY_LOCATIONS, NUM_STATS, object_update_speed(), player::orig_stats, object::path_attuned, object::path_denied, object::path_repelled, PLAYER, POTION, POTION_RESIST_EFFECT, prot, QUERY_FLAG, range_bow, range_builder, range_misc, range_skill, player::ranges, object::resist, RING, ROD, set_attr_value(), SET_FLAG, settings, SHIELD, SK_PRAYING, SKILL, SKILL_TOOL, object::slaying, object::speed, Settings::spell_encumbrance, stats, object::stats, SYMPTOM, TRUE, object::type, vuln, WAND, living::wc, WEAPON, and WEAPON_SPEED.
Referenced by animate_weapon(), apply_race_and_class(), apply_special(), blind_living(), blindness_type_process(), cast_curse(), cfapi_object_fix(), cfapi_object_set_property(), change_abil(), check_login(), command_abil(), command_brace(), command_drop(), command_dropall(), command_fix_me(), command_possess(), command_search_items(), command_take(), converter_type_apply(), create_aura(), do_light(), do_skill(), do_symptoms(), do_turn(), dragon_eat_flesh(), drain_specific_stat(), drop_object(), eat_special_food(), examine_monster(), fire_bow(), fix_weight(), hit_with_one_attacktype(), improve_armour(), improve_weapon_stat(), key_change_class(), kill_player_not_permadeath(), monster_check_apply_all(), object_decrease_nrof(), object_insert_in_ob(), object_remove(), pay_for_amount(), pay_for_item(), pick_up_object(), player_changer_type_process(), player_lvl_adj(), poison_living(), poisoning_type_process(), potion_type_apply(), put_object_in_sack(), remove_depletion(), remove_force(), remove_symptoms(), roll_stats(), save_life(), slow_living_by(), stop_jump(), swap_random_stats(), swap_stat(), and unapply_special().
void free_all_artifacts | ( | void | ) |
Free all artifact-related information.
Definition at line 117 of file artifact.cpp.
References first_artifactlist, and free_artifactlist().
Referenced by cleanup().
void free_all_god | ( | void | ) |
void free_all_maps | ( | void | ) |
Frees all allocated maps.
Definition at line 1974 of file map.cpp.
References delete_map(), first_map, mapstruct::in_memory, llevDebug, LOG(), MAP_IN_MEMORY, and MAP_SAVING.
Referenced by cleanup().
void free_all_readable | ( | void | ) |
Free all readable-related information.
Definition at line 1974 of file readable.cpp.
References title::archname, title::authour, booklist, titlelist::first_book, free_string(), llevDebug, LOG(), title::name, title::next, and titlelist::next.
Referenced by cleanup().
void free_all_recipes | ( | void | ) |
Frees all memory allocated to recipes and recipes lists.
Definition at line 811 of file recipe.cpp.
References recipe::arch_name, recipe::cauldron, recipe::failure_arch, recipe::failure_message, formulalist, free_string(), recipe::ingred, recipelist::items, llevDebug, LOG(), linked_char::name, recipe::next, recipelist::next, linked_char::next, recipe::skill, recipe::title, and recipe::tool.
Referenced by cleanup(), and init_formulae().
void free_arch | ( | archetype * | at | ) |
Frees archetype.
at | archetype to free. Pointer becomes invalid after the call. |
Definition at line 167 of file arch.cpp.
References archetype::clone, free_string(), object::msg, object::name, archetype::name, object::name_pl, object_free_key_values(), object::race, object::slaying, and object::title.
Referenced by asset_destroy(), object_free(), and Archetypes::replace().
void free_charlinks | ( | linked_char * | lc | ) |
Frees a link structure and its next items.
lc | item to free. Pointer is free()d too, so becomes invalid. |
Definition at line 616 of file utils.cpp.
References free_charlinks(), and linked_char::next.
Referenced by free_charlinks(), and send_account_players().
void free_dialog_information | ( | object * | op | ) |
Frees obj::dialog_information.
op | what to clean for. |
Definition at line 34 of file dialog.cpp.
References struct_dialog_information::all_messages, struct_dialog_information::all_replies, CLEAR_FLAG, object::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 copy_message(), object_clear(), object_copy_no_speed(), and object_free().
void free_experience | ( | void | ) |
Frees experience-related memory.
Definition at line 263 of file exp.cpp.
References FREE_AND_CLEAR, and levels.
Referenced by free_globals().
void free_globals | ( | void | ) |
Cleans all memory allocated for global variables.
Will clear:
Definition at line 438 of file init.cpp.
References all_regions, assets_free(), attack_mess, blocks_prayer, clear_friendly_list(), Settings::emergency_mapname, FREE_AND_CLEAR, FREE_AND_CLEAR_STR, free_experience(), region::jailmap, region::longname, MAXATTACKMESS, region::msg, region::name, NROFATTACKMESS, settings, and undead_name.
Referenced by cleanup().
void free_loader | ( | void | ) |
Frees all memory allocated by the loader.
Definition at line 39074 of file loader.cpp.
References YY_CURRENT_BUFFER, and yy_delete_buffer().
Referenced by cleanup().
void free_map | ( | mapstruct * | m | ) |
Frees everything allocated by the given mapstructure.
Don't free tmpname or the reset group - our caller is left to do that. Mapstructure itself is not freed.
m | map to free. |
Definition at line 1662 of file map.cpp.
References EVENT_MAPUNLOAD, events_execute_global_event(), free_all_objects(), FREE_AND_CLEAR, free_objectlinkpt(), llevError, LOG(), m, and MAP_SWAPPED.
Referenced by delete_map(), and swap_map().
void free_objectlink | ( | objectlink * | ol | ) |
Recursively frees all objectlinks.
ol | object link to free. |
Definition at line 67 of file links.cpp.
References free_objectlink(), and objectlink::next.
Referenced by add_button_link(), command_kill_pets(), command_showpets(), free_objectlink(), free_objectlinkpt(), get_nearest_player(), pets_attempt_follow(), and pets_terminate_all().
void free_objectlinkpt | ( | oblinkpt * | obp | ) |
Recursively frees all linked list of objectlink pointers.
obp | pointer to free. |
Definition at line 79 of file links.cpp.
References free_objectlink(), free_objectlinkpt(), oblinkpt::link, and oblinkpt::next.
Referenced by free_map(), and free_objectlinkpt().
void free_player | ( | player * | pl | ) |
Frees player structure, including pointed object (through object_free_drop_inventory()).
pl | player to clear. Pointer is invalid after this call. |
Definition at line 68 of file player.cpp.
References clear_player(), first_player, FLAG_REMOVED, llevError, LOG(), player::next, player::ob, object_free_drop_inventory(), object_remove(), and QUERY_FLAG.
Referenced by final_free_player().
void generate_artifact | ( | object * | op, |
int | difficulty | ||
) |
Decides randomly which artifact the object should be turned into.
Makes sure that the item can become that artifact (means magic, difficulty, and Allowed fields properly). Then calls give_artifact_abilities in order to actually create the artifact.
op | object to attempt to transform. |
difficulty | limit for artifact difficulty. |
Definition at line 177 of file artifact.cpp.
References ARTIFACT_TRIES, FABS, find_artifactlist(), give_artifact_abilities(), artifact::item, artifactlist::items, legal_artifact_combination(), llevDebug, llevError, LOG(), object::magic, object::name, RANDOM, artifactlist::total_chance, and object::type.
Referenced by alchemy_failure_effect(), fix_generated_item(), generate_monster_arch(), generate_monster_inv(), and place_monsters().
object* generate_treasure | ( | treasurelist * | t, |
int | difficulty | ||
) |
Generate a treasure from a list generating a single item.
This is similar to the old generate treasure function. However, it instead takes a treasurelist. It is really just a wrapper around create_treasure(). We create a dummy object that the treasure gets inserted into, and then return that treasure.
t | treasure list to generate from. |
difficulty | treasure difficulty. |
Definition at line 295 of file treasure.cpp.
References create_treasure(), object::inv, llevError, LOG(), object_free_drop_inventory(), object_new(), object_remove(), and t.
Referenced by apply_auto(), and cast_wonder().
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 78 of file arch.cpp.
References AssetsManager::archetypes(), Archetypes::findBySkillNameAndType(), getManager(), skill, and is_valid_types_gen::type.
Referenced by examine_fluff(), and give_skill_by_name().
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 97 of file arch.cpp.
References AssetsManager::archetypes(), Archetypes::findByTypeSubtype(), getManager(), and is_valid_types_gen::type.
Referenced by become_follower(), create_player_cmd(), init_dynamic(), and write_on_item().
archetype* get_archetype_struct | ( | void | ) |
Allocates, initialises and returns the pointer to an archetype structure.
Definition at line 193 of file arch.cpp.
References object::arch, CALLOC, CLEAR_FLAG, archetype::clone, fatal(), FLAG_FREED, FLAG_REMOVED, archetype::head, archetype::more, object::msg, object::name, archetype::name, object::name_pl, object_clear(), object::other_arch, OUT_OF_MEMORY, object::race, SET_FLAG, object::slaying, and object::title.
Referenced by asset_create(), check_loaded_object(), and ArchetypeLoader::load().
int8_t get_attr_value | ( | const living * | stats, |
int | attr | ||
) |
Gets the value of a stat.
stats | item from which to get stat. |
attr | attribute to get. |
Definition at line 313 of file living.cpp.
References CHARISMA, CONSTITUTION, DEXTERITY, INTELLIGENCE, POWER, stats, STRENGTH, and WISDOM.
Referenced by add_abilities(), apply_changes_to_player(), apply_race_and_class(), calc_item_power(), cast_change_ability(), change_abil(), check_race_and_class(), check_stat_bounds(), create_player_cmd(), describe_item(), do_symptoms(), eat_special_food(), fix_object(), is_magical(), kill_player_not_permadeath(), monster_get_weapon_quality(), perceive_self(), remove_depletion(), ring_desc(), set_ring_bonus(), swap_random_stats(), and swap_stat().
int get_button_value | ( | const object * | button | ) |
Returns the first value linked to this button.
Made as a separate function to increase efficiency
button | object to check. Must not be NULL. |
Definition at line 749 of file button.cpp.
References mapstruct::buttons, object::count, objectlink::id, oblinkpt::link, object::map, objectlink::next, oblinkpt::next, objectlink::ob, and oblinkpt::value.
Referenced by examine(), and get_ob_diff().
int get_cha_bonus | ( | int | stat | ) |
Definition at line 2361 of file living.cpp.
int get_cleric_chance | ( | int | stat | ) |
Definition at line 2381 of file living.cpp.
client_spell* get_client_spell_state | ( | player * | pl, |
object * | spell | ||
) |
Gets the (client-side) spell state for specified spell.
Will be created to empty state if not found.
pl | player we're handling. |
spell | spell for which to search data. |
Definition at line 144 of file player.cpp.
References fatal(), client_spell::next, OUT_OF_MEMORY, spell, client_spell::spell, and player::spell_state.
Referenced by append_spell(), and esrv_update_spells().
const char* get_colorname | ( | uint8_t | index | ) |
Definition at line 86 of file image.cpp.
References colorname.
Referenced by FaceWriter::write().
int get_dam_bonus | ( | int | stat | ) |
Definition at line 2389 of file living.cpp.
int get_dex_bonus | ( | int | stat | ) |
Definition at line 2365 of file living.cpp.
int get_dialog_message | ( | object * | op, |
const char * | text, | ||
struct_dialog_message ** | message, | ||
struct_dialog_reply ** | reply | ||
) |
Tries to find a message matching the said text.
op | who is being talked to. | |
text | what is being said. | |
[out] | message | what op should say. Won't be NULL if return is 1. |
[out] | reply | text the one talking should say based on the text. Can be NULL. |
Definition at line 233 of file dialog.cpp.
References struct_dialog_information::all_messages, struct_dialog_information::all_replies, object::dialog_information, FLAG_DIALOG_PARSED, matches(), message, struct_dialog_reply::next, player::next, parse_dialog_information(), QUERY_FLAG, and text.
Referenced by monster_do_talk_npc().
artifact* get_empty_artifact | ( | void | ) |
Allocate and return the pointer to an empty artifact structure.
Definition at line 55 of file artifact.cpp.
References artifact, fatal(), OUT_OF_MEMORY, and t.
Referenced by ArtifactLoader::load().
artifactlist* get_empty_artifactlist | ( | void | ) |
Allocate and return the pointer to an empty artifactlist structure.
Definition at line 37 of file artifact.cpp.
References fatal(), artifactlist::next, OUT_OF_MEMORY, and artifactlist::total_chance.
Referenced by ArtifactLoader::load().
mapstruct* get_empty_map | ( | int | sizex, |
int | sizey | ||
) |
Creates and returns a map of the specific size.
Used in random map code and the editor.
sizex | |
sizey | map size. |
Definition at line 854 of file map.cpp.
References allocate_map(), get_linked_map(), m, and MAP_SWAPPED.
Referenced by cfapi_map_get_map(), and make_map_floor().
treasure* get_empty_treasure | ( | void | ) |
Allocate and return the pointer to an empty treasure structure.
Definition at line 1380 of file treasure.cpp.
References fatal(), OUT_OF_MEMORY, and t.
Referenced by TreasureLoader::loadTreasure(), and treasure_insert().
const Face* get_face_by_id | ( | uint16_t | id | ) |
Get a face from its unique identifier.
id | face identifier. |
Definition at line 314 of file assets.cpp.
References AssetsManager::faces(), Faces::findById(), and manager.
Referenced by ask_smooth_cmd(), cfapi_system_find_face(), send_face_cmd(), and send_image_sums().
int get_face_fallback | ( | int | faceset, |
uint16_t | imageno | ||
) |
This returns the set we will actually use when sending a face.
This is used because the image files may be sparse. This function is recursive. imageno is the face number we are trying to send
If face is not found in specified faceset, tries with 'fallback' faceset.
faceset | faceset to check |
imageno | image number |
Definition at line 133 of file image.cpp.
References face_info::data, face_sets::faces, face_sets::fallback, find_faceset(), get_face_fallback(), face_sets::id, llevError, LOG(), and face_sets::prefix.
Referenced by esrv_send_face(), get_face_fallback(), process_map(), and send_image_sums().
size_t get_faces_count | ( | void | ) |
Definition at line 292 of file assets.cpp.
References AssetsCollection< T, Key >::count(), AssetsManager::faces(), and manager.
Referenced by init_connection(), main(), new_connection(), reset_faces_sent(), send_image_info(), and send_image_sums().
int get_fear_bonus | ( | int | stat | ) |
Definition at line 2397 of file living.cpp.
recipelist* get_formulalist | ( | int | i | ) |
Gets a formula list by ingredients count.
i | number of ingredients. |
Definition at line 98 of file recipe.cpp.
References formulalist, and recipelist::next.
Referenced by alchemy_failure_effect(), attempt_do_alchemy(), find_recipe_for_tool(), get_random_recipelist(), knowledge_alchemy_get_recipe(), make_formula_book(), and pack_formulae().
objectlink* get_friends_of | ( | const object * | owner | ) |
Get a list of friendly objects for the specified owner.
owner | who to get objects of, may be NULL to get all friendly objects. |
Definition at line 117 of file friend.cpp.
Referenced by command_kill_pets(), command_showpets(), get_nearest_player(), pets_attempt_follow(), and pets_terminate_all().
const char* get_god_for_race | ( | const char * | race | ) |
Returns a string that is the name of the god that should be natively worshipped by a creature of who has race *race if we can't find a god that is appropriate, we return NULL.
race | race we're getting the god of. |
Definition at line 90 of file holy.cpp.
References gods.
Referenced by determine_god().
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 252 of file region.cpp.
References add_string(), EXIT_PATH, EXIT_X, EXIT_Y, FLAG_DAMNED, get_region_by_map(), region::jailmap, region::jailx, region::jaily, llevDebug, llevError, LOG(), object::map, region::name, object_new(), region::parent, PLAYER, SET_FLAG, and object::type.
Referenced by player_arrest().
int get_learn_spell | ( | int | stat | ) |
Definition at line 2377 of file living.cpp.
void get_levelnumber | ( | int | i, |
char * | buf, | ||
size_t | size | ||
) |
mapstruct* get_linked_map | ( | void | ) |
Allocates, initialises, and returns a pointer to a mapstruct, linked through first_map.
Definition at line 788 of file map.cpp.
References fatal(), first_map, mapstruct::in_memory, mapstruct::last_reset_time, MAP_ENTER_X, MAP_ENTER_Y, MAP_HEIGHT, MAP_RESET_TIMEOUT, MAP_SWAPPED, MAP_WIDTH, mapstruct::next, and OUT_OF_MEMORY.
Referenced by get_empty_map(), mapfile_load_lowlevel(), and read_map_log().
int get_map_flags | ( | mapstruct * | oldmap, |
mapstruct ** | newmap, | ||
int16_t | x, | ||
int16_t | y, | ||
int16_t * | nx, | ||
int16_t * | ny | ||
) |
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_.
. value (see map.h) it will also do map translation for tiled maps, returning new values into newmap, nx, and ny. Any and all of those values can be null, in which case if a new map is needed (returned by a P_NEW_MAP value, another call to get_map_from_coord is needed. The case of not passing values is if we're just checking for the existence of something on those spaces, but don't expect to insert/remove anything from those spaces.
oldmap | map for which we want information. |
newmap | if not NULL, will contain the actual map checked if not oldmap. |
x | |
y | coordinates to check |
nx | |
ny | if not NULL, will contain the actual coordinates checked. |
Definition at line 300 of file map.cpp.
References MapSpace::flags, get_map_from_coord(), P_NEW_MAP, P_OUT_OF_MAP, mapstruct::spaces, and mapstruct::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(), counterspell(), create_bomb(), dimension_door(), dispel_rune(), do_harvest(), do_skill_ident(), do_throw(), draw_client_map(), eventListener(), expand_lighted_sight(), expand_sight(), find_target_for_friendly_spell(), find_traps(), fire_arch_from_position(), fire_bolt(), fire_bow(), forklightning(), get_pointed_target(), hideability(), hit_map(), magic_mapping_mark(), magic_mapping_mark_recursive(), magic_wall(), monster_communicate(), monster_find_nearest_enemy(), monster_npc_call_help(), mood_change(), move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_ob(), move_player_mover(), move_swarm_spell(), move_to(), ob_blocked(), object_find_multi_free_spot_within_radius(), ok_to_put_more(), path_to_player(), pets_get_enemy(), pets_move(), pets_move_golem(), pick_arrow_target(), probe(), process_players1(), remove_adjacent_doors(), remove_trap(), roll_ob(), singing(), skill_attack(), spell_failure(), spell_find_dir(), stand_near_hostile(), steal(), teleport(), try_fit(), use_oratory(), weapon_improver_type_apply(), and write_rune().
This is basically the same as out_of_map above(), but instead we return NULL if no map is valid (coordinates out of bounds and no tiled map), otherwise it returns the map as that the coordinates are really on, and updates x and y to be the localized coordinates.
Using this is more efficient than calling out_of_map and then figuring out what the real map is
m | map we want to look at. Must not be NULL. |
x | |
y | coordinates, which will contain the real position that was checked. |
Definition at line 2334 of file map.cpp.
References load_and_link_tiled_map(), m, MAP_HEIGHT, MAP_IN_MEMORY, MAP_SWAPPED, MAP_WIDTH, and OUT_OF_REAL_MAP.
Referenced by cfapi_map_get_map(), draw_client_map2(), get_map_flags(), look_at(), map_light_on(), monster_use_bow(), move_player_attack(), object_insert_in_map(), object_remove(), out_of_map(), and pets_move().
sstring get_message_body | ( | const GeneralMessage * | message | ) |
Get a message's body.
message | message, must not be NULL. |
Definition at line 2077 of file readable.cpp.
References message.
Referenced by knowledge_message_detail().
const Face* get_message_face | ( | const GeneralMessage * | message | ) |
Get a message's face.
message | message, must not be NULL. |
Definition at line 2086 of file readable.cpp.
References message.
Referenced by knowledge_message_face().
const GeneralMessage* get_message_from_identifier | ( | const char * | identifier | ) |
Find the message from its identifier.
identifier | message's identifier. |
Definition at line 323 of file assets.cpp.
References AssetsCollection< T, Key >::find(), manager, and AssetsManager::messages().
Referenced by knowledge_message_detail(), knowledge_message_face(), knowledge_message_summary(), and knowledge_message_validate().
sstring get_message_title | ( | const GeneralMessage * | message | ) |
Get a message's title.
message | message, must not be NULL. |
Definition at line 2068 of file readable.cpp.
References message, and player::title.
Referenced by knowledge_message_summary().
const char* get_month_name | ( | const int | index | ) |
give access to month names
Definition at line 113 of file time.cpp.
References month_name, and MONTHS_PER_YEAR.
Referenced by cfapi_get_month_name().
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 89 of file region.cpp.
References all_regions, llevInfo, LOG(), and m.
Referenced by current_region_info(), get_region_by_map(), get_who_escape_code_value(), and pick_bg_music().
Definition at line 261 of file assets.cpp.
References AssetsManager::archetypes(), manager, and AssetsCollection< T, Key >::next().
Referenced by artifact_get_face(), and cfapi_archetype_get_property().
Get the next object on the friendly list.
current | current object, NULL to get the first item on the list. |
Definition at line 143 of file friend.cpp.
References friends.
Referenced by cfapi_friendlylist_get_next(), and cfapi_system_get_object_vector().
void get_ob_diff | ( | StringBuffer * | sb, |
const object * | op, | ||
const object * | op2 | ||
) |
Returns a pointer to a static string which contains all variables which are different in the two given objects.
This function is typically used to dump objects (op2=empty object), or to save objects
sb | buffer that will contain the difference. |
op | what object the different values will be taken from. |
op2 | object's original archetype. |
Definition at line 4986 of file object.cpp.
References living::ac, ADD_STRINGLINE_ENTRY(), object::anim_suffix, object::animation, object::attack_movement, object::attacktype, object::body_info, body_locations, object::carrying, living::Cha, object::client_type, compare_flags(), living::Con, living::dam, object::dam_modifier, living::Dex, object::direction, object::duration, object::duration_modifier, object::elevation, living::exp, object::expmul, object::face, FAST_SAVE_DOUBLE(), FAST_SAVE_LONG(), FLAG_ANIMATE, FLAG_IS_LINKED, flag_names, flags_differ(), FMT64, living::food, object::gen_sp_armour, get_button_value(), get_string_move_type(), object::glow_radius, living::grace, living::hp, living::Int, object::invisible, object::item_power, key_value::key, object::key_values, object::last_eat, object::last_grace, object::last_heal, object::last_sp, object::level, object::lore, living::luck, object::magic, object::map_layer, map_layer_name, object::material, object::materialname, living::maxgrace, living::maxhp, living::maxsp, object::move_allow, object::move_block, object::move_off, object::move_on, object::move_slow, object::move_slow_penalty, object::move_status, object::move_type, object::msg, Face::name, Animations::name, treasurelist::name, object::name, archetype::name, object::name_pl, key_value::next, object::nrof, NROFATTACKS, NUM_BODY_LOCATIONS, object_get_key_value(), object::other_arch, object::path_attuned, object::path_denied, object::path_repelled, object::pick_up, living::Pow, QUERY_FLAG, object::race, object::randomitems, object::range, object::range_modifier, object::resist, resist_save, object::run_away, object::skill, object::slaying, object::smoothlevel, object::sound_chance, living::sp, object::speed, object::speed_left, object::state, object::stats, living::Str, stringbuffer_append_string(), object::subtype, object::title, object::total_exp, object::type, key_value::value, object::value, living::wc, object::weapon_speed, object::weapon_speed_left, object::weapontype, object::weight, object::weight_limit, object::will_apply, living::Wis, object::x, and object::y.
Referenced by add_one_item(), command_diff(), doWrite(), object_dump(), Archetypes::recursive_update(), save_object_in_sb(), and ArtifactWriter::write().
objectlink* get_objectlink | ( | void | ) |
Allocates a new objectlink structure, initialises it, and returns a pointer to it.
Definition at line 33 of file links.cpp.
References fatal(), and OUT_OF_MEMORY.
Referenced by add_button_link().
oblinkpt* get_objectlinkpt | ( | void | ) |
Allocates a new oblinkpt structure, initialises it, and returns a pointer to it.
Definition at line 51 of file links.cpp.
References fatal(), and OUT_OF_MEMORY.
Referenced by add_button_link().
const char* get_periodofday | ( | const int | index | ) |
give access to weekday names
Definition at line 106 of file time.cpp.
References PERIODS_PER_DAY, and periodsofday.
Referenced by cfapi_get_periodofday_name().
int get_power_from_ench | ( | int | ench | ) |
Definition at line 212 of file item.cpp.
References enc_to_item_power.
Referenced by calc_item_power(), and fix_generated_item().
const object* get_rand_god | ( | void | ) |
Returns a random god.
Definition at line 73 of file holy.cpp.
Referenced by determine_god(), and god_info_msg().
int get_random_dir | ( | void | ) |
Returns a random direction (1..8).
Definition at line 400 of file utils.cpp.
References rndm().
Referenced by move_firewall(), move_player_mover(), move_swarm_spell(), and pets_move().
object* get_random_mon | ( | int | level | ) |
Returns a random monster selected from linked list of all monsters in the current game.
Changed 971225 to be greater than equal to level passed. Also made choosing by level more random.
level | if non-zero, then only monsters greater than that level will be returned. |
Definition at line 1269 of file readable.cpp.
References level, llevError, LOG(), monsters, and RANDOM.
Referenced by alchemy_failure_effect(), and mon_info_msg().
recipe* get_random_recipe | ( | recipelist * | rpl | ) |
Gets a random recipe from a list, based on chance.
rpl | recipelist we want a recipe from. Can be NULL in which case a random one is selected. |
Definition at line 787 of file recipe.cpp.
References recipe::chance, get_random_recipelist(), recipelist::items, recipe::next, RANDOM, and recipelist::total_chance.
Referenced by alchemy_failure_effect().
int get_randomized_dir | ( | int | dir | ) |
Returns a random direction (1..8) similar to a given direction.
dir | the exact direction |
Definition at line 412 of file utils.cpp.
References absdir(), and RANDOM.
Referenced by face_player(), monster_cast_spell(), monster_move(), monster_use_bow(), monster_use_range(), monster_use_scroll(), monster_use_skill(), and move_player().
From map.c This is used by get_player to determine where the other creature is.
get_rangevector takes into account map tiling, so you just can not look the the map coordinates and get the right value. distance_x/y are distance away, which can be negative. direction is the crossfire direction scheme that the creature should head. part is the part of the monster that is closest.
get_rangevector looks at op1 and op2, and fills in the structure for op1 to get to op2. We already trust that the caller has verified that the two objects are at least on adjacent maps. If not, results are not likely to be what is desired.
op1 | object which wants to go to op2's location. |
op2 | target of op1. |
retval | vector for op1 to go to op2. |
flags | if 1, don't translate for closest body part of 'op1' |
Definition at line 2505 of file map.cpp.
References adjacent_map(), rv_vector::direction, rv_vector::distance, rv_vector::distance_x, rv_vector::distance_y, find_dir_2(), flags, ihypot(), object::map, object::more, rv_vector::part, object::x, and object::y.
Referenced by command_follow(), do_follow(), flee_player(), monster_can_detect_enemy(), monster_can_hit(), monster_cast_spell(), monster_find_enemy(), monster_move(), monster_use_bow(), monster_use_range(), monster_use_scroll(), monster_use_skill(), move_towards(), path_to_player(), pets_get_enemy(), pets_move(), player_can_view(), and spring_trap().
int get_rangevector_from_mapcoord | ( | const mapstruct * | m, |
int | x, | ||
int | y, | ||
const object * | op2, | ||
rv_vector * | retval | ||
) |
This is basically the same as get_rangevector() above, but instead of the first parameter being an object, it instead is the map and x,y coordinates - this is used for path to player - since the object is not infact moving but we are trying to traverse the path, we need this.
Since no object is pasted, the best field of the rv_vector is set to NULL.
m | map to consider. |
x | |
y | origin coordinates. |
op2 | target object. |
retval | vector to get to op2. |
Definition at line 2573 of file map.cpp.
References adjacent_map(), rv_vector::direction, rv_vector::distance, rv_vector::distance_x, rv_vector::distance_y, find_dir_2(), isqrt(), m, object::map, rv_vector::part, object::x, and object::y.
Referenced by path_to_player().
const readable_message_type* get_readable_message_type | ( | object * | readable | ) |
Get the readable type for an object (hopefully book).
readable | object for which we want the readable type. |
Definition at line 2055 of file readable.cpp.
References last_readable_subtype, readable_message_types, and object::subtype.
Referenced by apply_sign(), book_type_apply(), and spellbook_type_apply().
Gets a region from a map.
m | map we want the region of. |
Definition at line 71 of file region.cpp.
References get_name_of_region_for_map(), get_region_by_name(), and m.
Referenced by add_region_link(), cfapi_map_get_map_property(), command_whereabouts(), current_map_info(), enter_random_map(), enter_random_template_map(), get_jail_exit(), get_who_escape_code_value(), list_players(), process_map(), and ring_bell().
region* get_region_by_name | ( | const char * | region_name | ) |
Gets a region by name.
Used by the map parsing code.
region_name | name of region. |
Definition at line 45 of file region.cpp.
References all_regions, llevDebug, llevInfo, and LOG().
Referenced by current_region_info(), get_region_by_map(), init_regions(), 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. |
Definition at line 116 of file region.cpp.
References all_regions, region::longname, name, region::name, region::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 209 of file region.cpp.
References get_region_longname(), llevDebug, LOG(), region::longname, region::name, and region::parent.
Referenced by command_whereabouts(), current_map_info(), current_region_info(), get_region_longname(), and get_who_escape_code_value().
const char* get_region_msg | ( | const region * | r | ) |
Gets a message for a region.
r | region. Can't be NULL. |
Definition at line 230 of file region.cpp.
References get_region_msg(), llevDebug, LOG(), region::msg, region::name, and region::parent.
Referenced by current_region_info(), and get_region_msg().
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 293 of file region.cpp.
References fatal(), and OUT_OF_MEMORY.
Referenced by init_regions(), and main().
void get_search_arr | ( | int * | search_arr | ) |
New function to make monster searching more efficient, and effective! This basically returns a randomized array (in the passed pointer) of the spaces to find monsters.
In this way, it won't always look for monsters to the north first. However, the size of the array passed covers all the spaces, so within that size, all the spaces within the 3x3 area will be searched, just not in a predictable order.
search_arr | array that will be initialized. Must contain at least SIZEOFFREE elements. |
Definition at line 3642 of file object.cpp.
References permute(), SIZEOFFREE, SIZEOFFREE1, and SIZEOFFREE2.
Referenced by monster_find_nearest_enemy(), pets_get_enemy(), and spell_find_dir().
const char* get_season_name | ( | const int | index | ) |
give access to season names
Definition at line 127 of file time.cpp.
References season_name, and SEASONS_PER_YEAR.
Referenced by cfapi_get_season_name().
long get_sleep_remaining | ( | void | ) |
Definition at line 189 of file time.cpp.
References game_time, log_time(), tick_duration, and timespec_diff().
Referenced by do_server().
float get_speed_bonus | ( | int | stat | ) |
Definition at line 2393 of file living.cpp.
int get_thaco_bonus | ( | int | stat | ) |
Definition at line 2369 of file living.cpp.
void get_tod | ( | timeofday_t * | tod | ) |
int get_turn_bonus | ( | int | stat | ) |
Definition at line 2385 of file living.cpp.
const typedata* get_typedata | ( | int | itemtype | ) |
itemtype | item type for which to return typedata. |
Definition at line 323 of file item.cpp.
References item_types, and item_types_size.
Referenced by cost_approx_str(), examine_autoidentify(), is_identifiable_type(), parse_shop_string(), price_approx(), and skill_ident().
const typedata* get_typedata_by_name | ( | const char * | name | ) |
name | item name for which to return typedata. Singular form is preferred. |
Definition at line 343 of file item.cpp.
References item_types, item_types_size, llevInfo, LOG(), and name.
Referenced by parse_shop_string().
const char* get_weekday | ( | const int | index | ) |
give access to weekday names
Definition at line 120 of file time.cpp.
References DAYS_PER_WEEK, and weekdays.
Referenced by cfapi_get_weekday_name().
uint32_t get_weight_limit | ( | int | stat | ) |
Definition at line 2373 of file living.cpp.
Fixes the given object, giving it the abilities and titles it should have due to the second artifact-template.
op | object to give properties to. |
artifact | what properties to apply. |
Definition at line 230 of file artifact.cpp.
References add_abilities(), add_refcount(), add_string(), object::artifact, free_string(), MAX_BUF, and object::title.
Referenced by add_one_item(), cast_create_missile(), command_create(), do_single_item(), generate_artifact(), make_item_from_recipe(), recipe_get_face(), save_object_in_sb(), and while().
Given the skill name skill_name, we find the skill archetype/object, set appropriate values, and insert it into the object (op) that is passed.
We return the skill - this makes it easier for calling functions that want to do something with it immediately.
op | object to which to give the skill. Must not be NULL. |
skill_name | skill to give. Must not be NULL. |
Definition at line 1788 of file living.cpp.
References arch_to_object(), CLEAR_FLAG, object::contr, living::exp, FLAG_CAN_USE_SKILL, get_archetype_by_skill_name(), object::level, link_player_skills(), llevError, LOG(), object_insert_in_ob(), SKILL, and object::stats.
Referenced by add_player_exp(), adjust_skill_tool(), become_follower(), cfapi_object_give_skill(), do_skill(), food_type_apply(), and learn_skill().
int has_ability | ( | const object * | ob | ) |
Checks whether object has innate abilities (spell/spellbook in inventory).
Definition at line 153 of file exp.cpp.
References object_find_by_type(), SPELL, and SPELLBOOK.
Referenced by new_exp().
mapstruct* has_been_loaded | ( | const char * | name | ) |
Checks whether map has been loaded.
name | path of the map to search. Can be NULL. |
Definition at line 79 of file map.cpp.
References first_map, name, mapstruct::next, and mapstruct::path.
Referenced by add_npc_to_random_map(), cfapi_map_has_been_loaded(), check_login(), command_reset(), command_swap(), 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 346 of file los.cpp.
References object::glow_radius.
Referenced by hideability(), and monster_can_see_enemy().
const char* i18n | ( | const object * | who, |
const char * | code | ||
) |
Translate a message in the appropriate language.
who | who to translate for. |
code | string to translate, usually the English version. |
Definition at line 42 of file languages.cpp.
References code, object::contr, find_string(), is_valid_types_gen::found, player::language, i18n_file::messages, and sstring.
Referenced by command_body(), command_delete(), command_passwd(), command_quest(), command_statistics(), confirm_password(), do_harvest(), draw_ext_info(), draw_ext_info_format(), get_name(), get_party_password(), get_password(), key_change_class(), key_roll_stat(), play_again(), quest_display(), quest_info(), receive_player_password(), and roll_again().
language_t i18n_find_language_by_code | ( | const char * | code | ) |
Attempt to find the identifier of a language from its code.
code | language code. |
Definition at line 60 of file languages.cpp.
References code, and i18n_files.
Referenced by command_language(), and i18n_get_language_by_code().
void i18n_free | ( | void | ) |
Clears all i18n-related data.
Definition at line 210 of file languages.cpp.
References free_string(), i18n_files, and message.
Referenced by cleanup().
language_t i18n_get_language_by_code | ( | const char * | code | ) |
Find the identifier of a language from its code.
code | language's code. |
Definition at line 74 of file languages.cpp.
References code, is_valid_types_gen::found, i18n_default, and i18n_find_language_by_code().
Referenced by check_login(), and get_player().
sstring i18n_get_language_code | ( | language_t | language | ) |
Return the code of a specified language.
language | identifier of the language. |
Definition at line 86 of file languages.cpp.
References code, i18n_file::code, and i18n_default.
Referenced by command_help(), help_topics(), and save_player().
void i18n_init | ( | void | ) |
Initializes the i18n subsystem.
Will load all found strings. If there is an error, calls fatal().
Definition at line 131 of file languages.cpp.
References add_refcount(), add_string(), bufferreader_destroy(), bufferreader_init_from_file(), bufferreader_next_line(), closedir(), code, i18n_file::code, convert_newline(), Settings::datadir, fatal(), is_valid_types_gen::found, free_string(), i18n_default, i18n_files, is_valid_types_gen::line, llevDebug, llevError, LOG(), MAX_BUF, i18n_file::messages, i18n_file::name, opendir(), OUT_OF_MEMORY, readdir(), SEE_LAST_ERROR, settings, and sstring.
Referenced by init_library().
void i18n_list_languages | ( | object * | who | ) |
List all languages for who.
who | who to display languages for. |
Definition at line 96 of file languages.cpp.
References draw_ext_info_format(), i18n_files, MSG_SUBTYPE_NONE, MSG_TYPE_COMMAND, and NDI_UNIQUE.
Referenced by command_language().
Identifies an item.
Supposed to fix face-values as well here, but later. Note - this may merge op with other object, so this function returns either the merged object or the original if no merge happened.
op | item to identify. Can be already identified without ill effects. |
object | The identify object - this may vary from op if the object was merged. |
Definition at line 1426 of file item.cpp.
References add_refcount(), object::arch, CLEAR_FLAG, archetype::clone, object::container, object::env, esrv_update_item(), FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_KNOWN_BLESSED, FLAG_KNOWN_CURSED, FLAG_NO_SKILL_IDENT, free_string(), GET_MAP_TOP, object::inv, object::map, map_find_by_type(), object::name, object::name_pl, object_get_player_container(), object_give_identified_properties(), object_merge(), object_update(), PLAYER, POTION, QUERY_FLAG, object::randomitems, SET_FLAG, object::title, object::type, UP_OBJ_FACE, UPD_ALL, UPD_FACE, UPD_FLAGS, UPD_NAME, object::x, and object::y.
Referenced by apply_auto(), cast_create_food(), cast_identify(), cfapi_object_identify(), identify_altar_type_move_on(), identify_object_with_skill(), monster_do_talk_npc(), potion_type_apply(), scroll_type_apply(), sell_item(), and spellbook_type_apply().
int ihypot | ( | int | a, |
int | b | ||
) |
Rough estimate of hypot(a, b).
Based on stack overflow: https://stackoverflow.com/questions/3506404/fast-hypotenuse-algorithm-for-embedded-processor
Definition at line 570 of file utils.cpp.
References a().
Referenced by expand_lighted_sight(), get_rangevector(), map_light_on(), and play_sound_map().
void init_archetype_pointers | ( | void | ) |
Initialize global archtype pointers:
Definition at line 62 of file treasure.cpp.
References amulet_arch, crown_arch, find_archetype(), and ring_arch.
Referenced by init_beforeplay().
void init_attackmess | ( | BufferReader * | reader, |
const char * | filename | ||
) |
Initializes the attack messages.
Called by init_library().
Memory will be cleared by free_globals().
Definition at line 570 of file init.cpp.
References attack_mess, buf, attackmess_t::buf1, attackmess_t::buf2, attackmess_t::buf3, bufferreader_next_line(), attackmess_t::level, level, llevDebug, LOG(), and strdup_local.
Referenced by assets_collect().
void void init_block | ( | void | ) |
initialises the array used by the LOS routines.
Since we are only doing the upper left quadrant, only these spaces could possibly get blocked, since these are the only ones further out that are still possibly in the sightline.
Definition at line 106 of file los.cpp.
References block, FABS, blocks::index, MAP_CLIENT_X, MAP_CLIENT_Y, set_block(), and SPACE_BLOCK.
Referenced by init_library().
void init_experience | ( | void | ) |
This loads the experience table from the exp_table file.
This tends to exit on any errors, since it populates the table as it goes along, so if there are errors, the table is likely in an inconsistent state.
Definition at line 167 of file exp.cpp.
References buf, Settings::confdir, fatal(), FMT64, levels, llevDebug, llevError, LOG(), MAX_BUF, Settings::max_level, SEE_LAST_ERROR, and settings.
Referenced by init_library().
void init_formulae | ( | BufferReader * | reader, |
const char * | filename | ||
) |
Builds up the lists of formula from the file in the libdir.
-b.t.
Definition at line 166 of file recipe.cpp.
References add_string(), recipe::arch_name, recipe::arch_names, buf, bufferreader_current_line(), bufferreader_next_line(), build_stringlist(), recipe::cauldron, recipe::chance, recipe::diff, recipe::exp, recipe::failure_arch, recipe::failure_message, fatal(), formulalist, free_all_recipes(), get_empty_formula(), recipe::index, recipe::ingred, recipe::ingred_count, init_recipelist(), recipe::is_combination, recipelist::items, recipe::keycode, llevDebug, llevError, LOG(), recipe::min_level, linked_char::name, recipe::next, recipelist::next, linked_char::next, numb_ingred(), recipelist::number, SEE_LAST_ERROR, recipe::skill, strtoint(), recipe::title, recipe::tool, recipe::tool_size, recipelist::total_chance, recipe::transmute, and recipe::yield.
Referenced by assets_collect().
void init_globals | ( | void | ) |
Initialises all global variables.
Might use environment-variables as default for some of them.
Setups logfile, and such variables.
Definition at line 394 of file init.cpp.
References add_string(), blocks_prayer, exiting, first_artifactlist, first_map, first_map_ext_path, first_player, init_defaults(), llevError, LOG(), logfile, Settings::logfilename, nrofallowedstr, nrofartifacts, settings, statistics, trying_emergency_save, and undead_name.
Referenced by generate_map(), 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 59 of file holy.cpp.
References add_god_to_list(), archetypes_for_each(), llevDebug, and LOG().
Referenced by generate_map(), init_beforeplay(), and main().
void init_library | ( | void | ) |
It is vital that init_library() is called by any functions using this library.
If you want to lessen the size of the program using the library, you can replace the call to init_library() with init_globals(). Good idea to also call init_hash_table if you are doing any object loading.
Definition at line 322 of file init.cpp.
References assets_init(), attack_mess, attackmess_t::buf1, attackmess_t::buf2, attackmess_t::buf3, fatal(), getManager(), i18n_init(), Settings::ignore_assets_errors, init_block(), init_clocks(), init_dynamic(), init_emergency_mappath(), init_environ(), init_experience(), init_globals(), init_hash_table(), init_objects(), init_stats(), attackmess_t::level, level, llevError, load_assets(), LOG(), MAXATTACKMESS, SEE_LAST_ERROR, and settings.
Referenced by generate_map(), init(), and main().
void init_msgfile | ( | FILE * | file, |
const char * | filename | ||
) |
void init_ob_method_struct | ( | ob_methods * | methods, |
ob_methods * | fallback | ||
) |
Initializes a ob_methods struct.
Make sure this always matches ob_methods.h
methods | ob_method structure to initialize |
fallback | Default fallback for the ob_method |
Definition at line 32 of file ob_types.cpp.
References ob_methods::apply, ob_methods::describe, ob_methods::fallback, ob_methods::move_on, ob_methods::process, and ob_methods::trigger.
Referenced by init_ob_methods(), and init_ob_types().
void init_ob_types | ( | ob_methods * | base_type | ) |
Initializes the object system.
base_type | base type to use as a base for all types. |
Definition at line 49 of file ob_types.cpp.
References base_type, init_ob_method_struct(), OBJECT_TYPE_MAX, and type_methods.
Referenced by init_ob_methods().
void init_objects | ( | void | ) |
Sets up and initialises the linked list of free and used objects.
Allocates a certain chunk of objects and puts them on the free list. Called by init_library();
Definition at line 327 of file object.cpp.
References active_objects, FLAG_FREED, FLAG_REMOVED, free_objects, object::next, objarray, objects, object::prev, SET_FLAG, and STARTMAX.
Referenced by init_library().
void init_readable | ( | void | ) |
Initialize linked lists utilized by message functions in tailor_readable_ob()
This is the function called by the main routine to initialize all the readable information.
Definition at line 904 of file readable.cpp.
References init_book_archive(), init_mon_info(), llevDebug, and LOG().
Referenced by generate_map(), init_beforeplay(), and main().
void init_regions | ( | BufferReader * | reader, |
const char * | filename | ||
) |
Reads/parses the region file, and copies into a linked list of region structs.
reader | buffer to read from. |
filename | file being read. |
Definition at line 310 of file region.cpp.
References all_regions, buf, bufferreader_next_line(), region::fallback, fatal(), get_region_by_name(), get_region_struct(), HUGE_BUF, region::jailmap, region::jailx, region::jaily, llevError, LOG(), region::longname, MAX_BUF, region::msg, msgbuf, region::name, path(), SEE_LAST_ERROR, and strdup_local.
Referenced by assets_collect().
void init_stats | ( | ) |
This loads statistic bonus/penalties from the stat_bonus file.
Any error is fatal, as system needs working bonuses.
Definition at line 2520 of file living.cpp.
References buf, Settings::confdir, float_bonus_names, float_bonuses, int_bonus_names, int_bonuses, llevError, LOG(), MAX_BUF, Settings::max_stat, MIN_STAT, NUM_FLOAT_BONUSES, NUM_INT_BONUSES, and settings.
Referenced by init_library().
int is_dragon_pl | ( | const object * | op | ) |
Checks if player is a dragon.
op | player to check. Can be NULL. |
Definition at line 122 of file player.cpp.
References object::arch, archetype::clone, PLAYER, object::race, and object::type.
Referenced by check_login(), command_resistances(), command_title(), describe_item(), describe_monster(), dragon_eat_flesh(), dragon_focus_type_apply(), find_best_player_hth_skill(), food_type_apply(), perceive_self(), and player_lvl_adj().
int is_friendly | ( | const object * | op | ) |
Checks if the given object is already in the friendly list or not.
op | item to check |
Definition at line 108 of file friend.cpp.
References friends.
Referenced by add_friendly_object(), cfapi_object_get_property(), and cfapi_object_set_property().
int is_identifiable_type | ( | const object * | op | ) |
Return true if this item's type is one that cares about whether or not it's been identified – e.g.
money and walls don't care (they are considered to be "always identified" no matter what FLAG_IDENTIFIED says) but weapons and scrolls do. In practice, this means anything with at least one identifyskill in the typedata, or skill tools (which have no identifyskill, but can still be IDed using magic).
op | Object to check. |
Definition at line 1329 of file item.cpp.
References get_typedata(), typedata::identifyskill, SKILL_TOOL, and object::type.
Referenced by command_create(), examine_fluff(), give_initial_items(), and is_identified().
int is_identified | ( | const object * | op | ) |
Return true if the item is identified, either because it is of a type that doesn't ever need identification (e.g.
money), or because it has FLAG_IDENTIFIED set. Uses is_identifiable_type() to distinguish between the two cases.
op | Object to check. |
Definition at line 1353 of file item.cpp.
References FLAG_IDENTIFIED, is_identifiable_type(), and QUERY_FLAG.
Referenced by add_abilities(), cast_create_food(), cast_identify(), describe_item(), examine(), examine_fluff(), examine_rod_charge_level(), examine_wand_charge_level(), identify_altar_type_move_on(), identify_object_with_skill(), make_item_from_recipe(), price_base(), query_base_name(), query_flags(), query_short_name(), and spellbook_type_describe().
int is_magical | ( | const object * | op | ) |
Checks whether object is magical.
A magical item is one that increases/decreases any abilities, provides a resistance, has a generic magical bonus, or is an artifact.
op | item to check. |
Definition at line 1232 of file item.cpp.
References living::ac, AMULET, ARMOUR, ATNR_PHYSICAL, BOOTS, living::dam, living::exp, FLAG_ALIVE, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_STEALTH, FLAG_XRAYS, living::food, get_attr_value(), GIRDLE, GLOVES, living::grace, HELMET, living::hp, living::luck, object::magic, object::move_type, NROFATTACKS, NUM_STATS, POTION, POWER_CRYSTAL, QUERY_FLAG, object::resist, RING, ROD, SCROLL, SHIELD, living::sp, SPELLBOOK, object::stats, object::title, object::type, WAND, and living::wc.
Referenced by apply_auto(), cast_detection(), cfapi_object_get_property(), detect_magic_on_item(), query_base_name(), and query_short_name().
int is_old_wraith_pl | ( | object * | op | ) |
Checks if player is a wraith without the 'wraith feed' skill.
op | player to check. |
Definition at line 185 of file player.cpp.
References object::arch, object::contr, player::is_old_wraith, is_wraith_pl(), PLAYER, and object::type.
Referenced by food_type_apply().
int is_type_valid | ( | uint8_t | type | ) |
Checks if the specified type is a valid one for a Crossfire object.
type | value to check. |
Definition at line 17 of file arch_types_valid.cpp.
References OBJECT_TYPE_MAX, and is_valid_types_gen::type.
Referenced by check_loaded_object().
int is_valid_faceset | ( | int | fsn | ) |
int is_wraith_pl | ( | object * | op | ) |
Tests if a player is a wraith.
op | player to check. |
Definition at line 173 of file player.cpp.
References object::arch, object::contr, player::is_wraith, PLAYER, and object::type.
Referenced by check_heal_and_mana(), food_type_apply(), hit_with_one_attacktype(), and is_old_wraith_pl().
int isqrt | ( | int | n | ) |
Compute the square root.
This is now a wrapper around sqrt().
Definition at line 562 of file utils.cpp.
Referenced by fix_flesh_item(), get_rangevector_from_mapcoord(), pick_lock(), spell_failure(), and value_limit().
void jump_time | ( | void | ) |
Definition at line 198 of file time.cpp.
References game_time, and process_utime_long_count.
Referenced by do_server().
Checks if op can be combined with art.
op | object to test. |
art | artifact to test. |
Definition at line 252 of file artifact.cpp.
References artifact::allowed, object::arch, llevDebug, LOG(), name, object::name, and archetype::name.
Referenced by artifact_compute_chance_for_item(), do_single_item(), find_artifact(), generate_artifact(), and locate_recipe_artifact().
int64_t level_exp | ( | int | level, |
double | expmul | ||
) |
Returns how much experience is needed for a player to become the given level.
level should really never exceed max_level
level | level player wants to reach |
expmul | penality/bonus for experience. |
Definition at line 1885 of file living.cpp.
References level, levels, Settings::max_level, and settings.
Referenced by calculate_difficulty(), change_exp(), command_statistics(), place_monsters(), player_lvl_adj(), and show_skills().
void link_player_skills | ( | object * | op | ) |
This function goes through the player inventory and sets up the last_skills[] array in the player object.
The last_skills[] is used to more quickly lookup skills - mostly used for sending exp. This function should be called anytime the player gains a skill.
op | player to link skills for. Must be a player. |
Definition at line 287 of file player.cpp.
References object::contr, FOR_INV_FINISH, FOR_INV_PREPARE, player::last_skill_exp, player::last_skill_ob, MAX_SKILLS, SKILL, and skill.
Referenced by adjust_skill_tool(), apply_race_and_class(), become_follower(), check_login(), food_type_apply(), give_initial_items(), give_skill_by_name(), key_change_class(), and learn_skill().
int load_face_file | ( | FILE * | file, |
const char * | full_path | ||
) |
void load_image_info | ( | FILE * | file, |
const char * | filename | ||
) |
int load_object | ( | FILE * | fp, |
object * | op, | ||
int | bufstate, | ||
int | map_flags, | ||
bool | artifact_init | ||
) |
Loads an object from the given file-pointer.
Variables will be read and parsed and patched into the object until the string "end" is reached, or the end of the file.
fp | file pointer from which to read. |
op | where to read the data. |
bufstate | used to determine various file attributes:
|
map_flags | combination of Map loading flags flags, though only MAP_STYLE is used. |
artifact_init | whether the object is being loaded as part of artifact loading or not. |
Definition at line 38944 of file loader.cpp.
References LL_EOF, LL_NORMAL, llevDebug, LO_LINEMODE, LO_NEWFILE, LO_NOREAD, LOG(), lorebuf, MAXDEPTH, msgbuf, msglen, total_msglen, VERY_BIG_BUF, YY_BUF_SIZE, yy_create_buffer(), YY_CURRENT_BUFFER, yy_delete_buffer(), yy_scan_string(), and yy_switch_to_buffer().
Referenced by check_login(), load_objects(), and load_unique_objects().
int load_object_from_reader | ( | BufferReader * | reader, |
object * | op, | ||
int | map_flags, | ||
bool | arch_init, | ||
bool | artifact_init | ||
) |
Load an object from the specified reader, stopping when the object is complete.
reader | where to read from. |
op | object to read. |
map_flags | one or more map loading flags. |
arch_init | whether we are loading archetypes or not. |
artifact_init | whether the object is being loaded as part of artifact loading or not. |
Definition at line 38996 of file loader.cpp.
References buf, bufferreader_get_line(), HUGE_BUF, INITIAL, LL_EOF, LL_MORE, LL_NORMAL, llevError, LOG(), lorebuf, MAXDEPTH, msgbuf, msglen, total_msglen, YY_CURRENT_BUFFER, yy_delete_buffer(), yy_pop_state(), yy_push_state(), and yy_scan_string().
Referenced by ArtifactLoader::load(), and ArchetypeLoader::load().
int load_png_file | ( | FILE * | file, |
const char * | full_path | ||
) |
void load_treasures | ( | void | ) |
Finds an artifact for a recipe.
rp | recipe |
idx | index of ingredient in recipe. |
Definition at line 730 of file recipe.cpp.
References recipe::arch_name, create_archetype(), find_artifactlist(), legal_artifact_combination(), object_free_drop_inventory(), and recipe::title.
Referenced by check_recipe(), dump_alchemy(), dump_alchemy_costs(), make_item_from_recipe(), and recipe_get_face().
void LOG | ( | LogLevel | logLevel, |
const char * | format, | ||
... | |||
) |
void make_list_like | ( | char * | input | ) |
Taking a string as an argument, mutate it into a string that looks like a list.
A 'list' for the purposes here is a string of items, separated by commas, except for the last entry, which has an 'and' before it, and a full stop (period) after it.
This function will also strip all trailing non alphanumeric characters.
It does not insert an oxford comma.
input | string to transform. Will be overwritten. Must be long enough to contain the modified string. |
Definition at line 368 of file utils.cpp.
References MAX_BUF.
Referenced by can_pay(), and shop_describe().
void make_path_to_file | ( | const char * | filename | ) |
Checks if any directories in the given path doesn't exist, and creates if necessary.
filename | file path we'll want to access. Can be NULL. |
Definition at line 164 of file porting.cpp.
References buf, llevDebug, llevError, LOG(), MAX_BUF, safe_strncpy, and SAVE_DIR_MODE.
Referenced by apply_race_and_class(), create_destination(), key_change_class(), save_map(), save_player(), and write_pictures_from_real_size().
void make_sure_not_seen | ( | const object * | op | ) |
The object which is supposed to be visible through walls has just been removed from the map, so update the los of any players within its range.
op | object that disappears. |
Definition at line 718 of file los.cpp.
References player::do_los, first_player, object::map, socket_struct::mapx, socket_struct::mapy, player::next, player::ob, player::socket, object::x, and object::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 695 of file los.cpp.
References player::blocked_los, first_player, LOS_NO_DARKNESS, object::map, socket_struct::mapx, socket_struct::mapy, player::next, player::ob, player::socket, object::x, and object::y.
Referenced by process_object().
Searches for any objects with a matching archetype at the given map and coordinates.
m | |
x | |
y | where to search. Must be valid position. |
at | archetype to search for. |
Definition at line 3118 of file object.cpp.
References FOR_MAP_FINISH, FOR_MAP_PREPARE, llevError, LOG(), m, and OUT_OF_REAL_MAP.
Referenced by cfapi_map_find_by_archetype_name(), put_in_icecube(), and town_portal_destroy_existing().
Finds an object in a map tile by flag number.
Checks the objects' heads.
map | the map to search. |
x | the x-coordiate to search. |
y | the y-coordiate to search. |
flag | the flag to seacrh for |
Definition at line 2634 of file map.cpp.
References object::above, GET_MAP_OB, HEAD, and QUERY_FLAG.
Referenced by cast_light(), common_process_projectile(), do_mood_floor(), get_pointed_target(), and mood_change().
Searches for any objects with a matching type variable at the given map and coordinates.
m | |
x | |
y | where to search. Must be valid position. |
type | type to get. |
Definition at line 3145 of file object.cpp.
References FOR_MAP_FINISH, FOR_MAP_PREPARE, m, OUT_OF_REAL_MAP, and is_valid_types_gen::type.
Referenced by identify(), remove_door(), and remove_locked_door().
const char* map_get_path | ( | const object * | item | ) |
Return the map path on which the specified item is.
item | what to return the map path for. |
Definition at line 2676 of file map.cpp.
References object::env, object::map, map_get_path(), mapstruct::name, and mapstruct::path.
Referenced by gate_type_process(), and map_get_path().
void map_remove_unique_files | ( | const mapstruct * | map | ) |
Remove files containing the map's unique items.
map |
Definition at line 2651 of file map.cpp.
References create_items_path(), HUGE_BUF, llevError, Settings::localdir, LOG(), path(), mapstruct::path, Settings::playerdir, settings, and mapstruct::unique.
Referenced by command_reset().
mapstruct* mapfile_load | ( | const char * | map, |
int | flags | ||
) |
Opens the file "filename" and reads information about the map from the given file, and stores it in a newly allocated mapstruct.
A pointer to this structure is returned, or NULL on failure. flags correspond to those in map.h. Main ones used are MAP_PLAYER_UNIQUE, in which case we don't do any name changes, and
map | Map path |
flags | Additional options for loading the map:
|
Definition at line 1228 of file map.cpp.
References apply_auto_fix(), calculate_difficulty(), EVENT_MAPLOAD, events_execute_global_event(), flags, llevDebug, LOG(), m, MAP_DIFFICULTY, MAP_NO_DIFFICULTY, map_path(), MAP_STYLE, mapfile_load_lowlevel(), maps_loaded_total, MAX_BUF, PROFILE_BEGIN, PROFILE_END, set_map_reset_time(), and update_buttons().
Referenced by enter_fixed_template_map(), enter_unique_map(), load_style_map(), and ready_map_name().
materialtype_t* name_to_material | ( | const char * | name | ) |
Convert materialname to materialtype_t.
name | material name to get. |
Definition at line 248 of file utils.cpp.
References materials, and name.
Referenced by animate_weapon(), object_get_materialtype(), and transmute_materialname().
int64_t new_exp | ( | const object * | ob | ) |
Alternative way to calculate experience based on the ability of a monster.
It's far from perfect, and doesn't consider everything which can be considered, thus it's only used in debugging. this is only used with one of the dumpflags, and not anyplace in the code.
ob | object for which to return experience |
Definition at line 100 of file exp.cpp.
References living::ac, object::attacktype, living::Con, living::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, living::maxhp, living::maxsp, MIN, NROFATTACKS, QUERY_FLAG, object::resist, object::speed, object::stats, and living::wc.
Referenced by print_monsters().
int nstrtok | ( | const char * | buf1, |
const char * | buf2 | ||
) |
Simple routine to return the number of list items in buf1 as separated by the value of buf2.
buf1 | items we want to split. |
buf2 | what to split by. |
Definition at line 642 of file readable.cpp.
References buf, MAX_BUF, and strlcpy().
Referenced by describe_god(), and strtoktolin().
method_ret ob_apply | ( | object * | op, |
object * | applier, | ||
int | aflags | ||
) |
Apply an object by running an event hook or an object method.
Consider using apply_manual() instead of this function if the applier should check for apply restrictions.
op | The object to apply |
applier | The object that executes the apply action |
aflags | Special (always apply/unapply) flags |
0 | A player or monster can't apply objects of that type |
1 | has been applied, or there was an error applying the object |
2 | objects of that type can't be applied if not in inventory |
Definition at line 44 of file ob_methods.cpp.
References ob_methods::apply, EVENT_APPLY, events_execute_object_event(), ob_methods::fallback, METHOD_OK, METHOD_UNHANDLED, SCRIPT_FIX_ALL, object::type, and type_methods.
Referenced by apply_by_living_below(), apply_manual(), create_player_cmd(), dimension_door(), enter_exit(), and thrown_item_effect().
Returns true if the given object can't fit in the given spot.
This is meant for multi space objects - for single space objecs, just calling get_map_blocked and checking that against movement type of object. This function goes through all the parts of the multipart object and makes sure they can be inserted.
While this doesn't call out of map, the get_map_flags does.
This function has been used to deprecate arch_out_of_map - this function also does that check, and since in most cases, a call to one would follow the other, doesn't make a lot of sense to have two separate functions for this.
This returns nonzero if this arch can not go on the space provided, 0 otherwise. the return value will contain the P_.. value so the caller can know why this object can't go on the map. Note that callers should not expect P_NEW_MAP to be set in return codes - since the object is multispace - if we did return values, what do you return if half the object is one map, half on another.
ob | object to test. |
m | |
x | |
y | map and coordinates to check. |
Definition at line 491 of file map.cpp.
References AB_NO_PASS, object::arch, archetype::clone, get_map_flags(), GET_MAP_MOVE_BLOCK, m, object::more, archetype::more, MOVE_ALL, object::move_type, OB_TYPE_MOVE_BLOCK, P_IS_ALIVE, P_OUT_OF_MAP, TRANSPORT, object::type, object::x, and object::y.
Referenced by enter_map(), monster_compute_path(), move_creator(), object_find_first_free_spot(), object_find_free_spot(), object_find_multi_free_spot_around(), object_find_multi_free_spot_within_radius(), pets_summon_golem(), pets_summon_object(), and turn_one_transport().
char* ob_describe | ( | const object * | op, |
const object * | observer, | ||
int | use_media_tags, | ||
char * | buf, | ||
size_t | size | ||
) |
Returns the description of an object, as seen by the given observer.
op | The object to describe |
observer | The object to which the description is made |
use_media_tags | whether to add media tags or not on the description |
buf | Buffer that will contain the description |
size | Size of buf |
Definition at line 91 of file ob_methods.cpp.
References buf, ob_methods::describe, ob_methods::fallback, object::type, and type_methods.
Referenced by book_type_apply(), cast_identify(), enter_exit(), examine(), identify_altar_type_move_on(), and identify_object_with_skill().
method_ret ob_move_on | ( | object * | op, |
object * | victim, | ||
object * | originator | ||
) |
Makes an object move on top of another one.
op | The object over which to move |
victim | The object moving over op |
originator | The object that is the cause of the move |
METHOD_UNHANDLED | if the process method does not exist for that object |
Definition at line 111 of file ob_methods.cpp.
References ob_methods::fallback, METHOD_UNHANDLED, ob_methods::move_on, object::type, and type_methods.
Referenced by move_hole(), object_check_move_on(), and object_remove().
method_ret ob_process | ( | object * | op | ) |
Processes an object, giving it the opportunity to move or react.
Note: The return value of ob_process doesn't seem to be used anymore.
op | The object to process |
METHOD_UNHANDLED | if the process method does not exist for that objec, |
Definition at line 67 of file ob_methods.cpp.
References ob_methods::fallback, METHOD_UNHANDLED, ob_methods::process, object::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 133 of file ob_methods.cpp.
References ob_methods::fallback, METHOD_UNHANDLED, ob_methods::trigger, object::type, and type_methods.
Referenced by trigger_connected().
void object_add_weight | ( | object * | op, |
signed long | weight | ||
) |
object_add_weight(object, weight) adds the specified weight to an object, and also updates how much the environment(s) is/are carrying.
Takes container weight reduction into account.
op | object to which we add weight. |
weight | weight to add. |
Definition at line 2833 of file object.cpp.
References object::carrying, CONTAINER, object::env, object::stats, living::Str, object::type, and weight.
Referenced by make_item_from_recipe(), object_decrease_nrof(), object_increase_nrof(), and object_insert_in_ob().
Examines the 2 objects given to it, and returns true if they can be merged together, including inventory.
Note that this function appears a lot longer than the macro it replaces - this is mostly for clarity - a decent compiler should hopefully reduce this to the same efficiency.
Check nrof variable before calling object_can_merge()
Improvements made with merge: Better checking on potion, and also check weight
ob1 | |
ob2 | objects to try to merge. |
Definition at line 433 of file object.cpp.
References object::animation, object::arch, object::attacktype, object::client_type, compare_ob_value_lists(), FABS, FLAG_ANIMATE, FLAG_APPLIED, FLAG_BEEN_APPLIED, FLAG_IDENTIFIED, object::flags, object::inv, object::item_power, object::key_values, object::level, object::lore, object::magic, object::map_layer, object::materialname, MIN_ACTIVE_SPEED, object::move_allow, object::move_block, object::move_off, object::move_on, object::move_slow, object::move_slow_penalty, object::move_type, object::msg, object::name, object::nrof, object_can_merge(), QUERY_FLAG, object::resist, SCROLL, SET_FLAG, object::skill, object::slaying, speed, object::speed, object::stats, object::subtype, object::title, object::type, object::value, and object::weight.
Referenced by cfapi_object_get_property(), check_loaded_object(), give_initial_items(), object_can_merge(), object_insert_in_map(), object_insert_in_ob(), and object_merge().
Finds out if an object can be picked up.
Add a check so we can't pick up invisible objects (0.93.8)
who | who is trying to pick up. Can be a monster or a player. |
item | item we're trying to pick up. |
Definition at line 3867 of file object.cpp.
References object::carrying, object::contr, FLAG_ALIVE, FLAG_NO_PICK, get_weight_limit(), object::head, object::invisible, object::more, PLAYER, QUERY_FLAG, object::stats, living::Str, TRANSPORT, object::type, and object::weight.
Referenced by cfapi_object_get_property(), check_pick(), do_skill_detect_curse(), do_skill_detect_magic(), esrv_move_object(), examine_autoidentify(), matcher_name(), matcher_number(), monster_can_pick(), and pick_up().
Checks if any objects has a move_type that matches objects that effect this object on this space.
Call apply() to process these events.
Any speed-modification due to SLOW_MOVE() of other present objects will affect the speed_left of the object. 4-21-95 added code to check if appropriate skill was readied - this will permit faster movement by the player through this terrain. -b.t.
MSW 2001-07-08: Check all objects on space, not just those below object being inserted. object_insert_in_map may not put new objects on top.
op | object that may trigger something. |
originator | player, monster or other object that caused 'op' to be inserted into 'map'. May be NULL. |
Definition at line 3012 of file object.cpp.
References object::above, object::count, FABS, find_skill_by_number(), FLAG_IS_HILLY, FLAG_IS_WOODED, FLAG_NO_APPLY, FLAG_NO_PICK, FLAG_WIZPASS, FOR_OB_AND_ABOVE_FINISH, FOR_OB_AND_ABOVE_PREPARE, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, GET_MAP_MOVE_BLOCK, GET_MAP_MOVE_ON, GET_MAP_MOVE_SLOW, GET_MAP_OB, m, object::map, object::move_block, MOVE_FLY_LOW, object::move_on, object::move_slow, object::move_slow_penalty, object::move_type, MOVE_WALK, ob_move_on(), object_was_destroyed, PLAYER, QUERY_FLAG, SK_CLIMBING, SK_WOODSMAN, object::speed, object::speed_left, object::type, object::x, and object::y.
Referenced by change_abil(), and object_insert_in_map().
void object_clear | ( | object * | op | ) |
Frees everything allocated by an object, and also clears all variables and flags to default settings.
op | object to clear |
Definition at line 983 of file object.cpp.
References object::above, object::active_next, object::active_prev, object::attacked_by_count, object::below, blank_face, Settings::casting_time, object::casting_time, object::container, object::contr, object::env, object::expmul, object::face, FLAG_FRIENDLY, FLAG_REMOVED, FREE_AND_CLEAR_STR, free_dialog_information(), object::head, object::inv, object::lore, object::map, object::materialname, object::more, object::msg, name, object::name, object::name_pl, object_free_key_values(), offsetof, QUERY_FLAG, object::race, remove_friendly_object(), SET_FLAG, settings, object::skill, object::slaying, and object::title.
Referenced by cfapi_object_clear(), get_archetype_struct(), object_new(), and object_reset().
void object_clear_owner | ( | object * | op | ) |
Clears the owner of specified object.
op | object we want to clear the owner of. Can be NULL. |
Definition at line 823 of file object.cpp.
References object::owner, and object::ownercount.
Referenced by do_mood_floor(), fix_stopped_arrow(), object_get_owner(), object_set_owner(), and stop_projectile().
Copy object first frees everything allocated by the second object, and then copies the contents of the first object into the second object, allocating what needs to be allocated.
Basically, any data that is malloc'd needs to be re-malloc/copied. Otherwise, if the first object is freed, the pointers in the new object will point at garbage. Will call object_update_speed() on the copied object.
src_ob | object that we copy.from |
dest_ob | object that we copy to. |
Definition at line 1192 of file object.cpp.
References object_copy_no_speed(), and object_update_speed().
Referenced by add_abilities(), apply_race_and_class(), cast_create_food(), cfapi_object_clone(), change_book(), check_loaded_object(), command_create(), do_learn_spell(), enter_exit(), explosion(), forklightning(), infect_object(), key_change_class(), magic_wall(), make_throw_ob(), move_bolt(), move_cone(), object_copy_with_inv(), object_create_clone(), pay_from_container(), place_special_exit(), polymorph_item(), put_decor(), put_doors(), sell_item(), while(), write_note(), write_rune(), and write_scroll().
Copy object first frees everything allocated by the second object, and then copies the contents of the first object into the second object, allocating what needs to be allocated.
Basically, any data that is malloc'd needs to be re-malloc/copied. Otherwise, if the first object is freed, the pointers in the new object will point at garbage. Will not call object_update_speed() on the copied object.
src_ob | object that we copy.from |
dest_ob | object that we copy to. |
Definition at line 1061 of file object.cpp.
References add_refcount(), object::anim_suffix, object::arch, object::artifact, BITMASK_VALID, CLEAR_FLAG, object::event_bitmask, FLAG_DIALOG_PARSED, FLAG_FREED, FLAG_REMOVED, FREE_AND_CLEAR, free_dialog_information(), free_string(), key_value::key, object::key_values, object::lore, object::materialname, object::msg, name, object::name, object::name_pl, key_value::next, object_free_key_values(), offsetof, QUERY_FLAG, object::race, RANDOM, archetype::reference_count, SET_FLAG, object::skill, object::slaying, object::speed, object::speed_left, SPELL_TAG_SIZE, object::spell_tags, object::title, and key_value::value.
Referenced by object_copy(), object_copy_with_inv(), and while().
Set the owner to clone's current owner and set the skill and experience objects to clone's objects (typically those objects that where the owner's current skill and experience objects at the time when clone's owner was set - not the owner's current skill and experience objects).
Use this function if player created an object (e.g. fire bullet, swarm spell), and this object creates further objects whose kills should be accounted for the player's original skill, even if player has changed skills meanwhile.
op | object to update. |
clone | object from which to get the owner. |
Definition at line 893 of file object.cpp.
References object_get_owner(), object_set_owner(), PLAYER, and object::type.
Referenced by animate_bomb(), explode_bullet(), fire_arch_from_position(), and poison_living().
Copy an object with an inventory, duplicate the inv too.
src_ob | object to copy. |
dest_ob | where to copy. |
update_speed | if true then call update_speed() on the duplicated objects, else don't. |
Definition at line 1208 of file object.cpp.
References FOR_INV_FINISH, FOR_INV_PREPARE, object_copy(), object_copy_no_speed(), object_copy_with_inv(), object_insert_in_ob(), and object_new().
Referenced by arch_to_object(), include_map_in_map(), object_copy_with_inv(), place_chest(), place_fountain_with_specials(), place_monsters(), Archetypes::recursive_update(), and Archetypes::replace().
int object_count_active | ( | void | ) |
Objects statistics.
Definition at line 1783 of file object.cpp.
References object::active_next, and active_objects.
Referenced by malloc_info().
int object_count_free | ( | void | ) |
Objects statistics.
Definition at line 1751 of file object.cpp.
References free_objects, and object::next.
Referenced by malloc_info().
int object_count_used | ( | void | ) |
Object statistics.
Definition at line 1767 of file object.cpp.
References object::next, and objects.
Referenced by malloc_info().
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 296 of file arch.cpp.
References arch_to_object(), archetype::clone, object::head, object::more, archetype::more, object::x, and object::y.
Referenced by apply_map_builder(), cast_detection(), cfapi_object_create(), command_create(), do_harvest(), do_item_conversion(), include_map_in_map(), move_creator(), msgfile_msg(), place_monsters(), and polymorph_living().
Create clone from object to another.
asrc | object to clone. |
Definition at line 3909 of file object.cpp.
References FOR_INV_FINISH, FOR_INV_PREPARE, object::head, HEAD, object::more, object_copy(), object_create_clone(), object_insert_in_ob(), and object_new().
Referenced by cfapi_object_clone(), do_item_conversion(), generate_monster_arch(), generate_monster_inv(), move_creator(), object_create_clone(), and object_split().
Decreases a specified number from the amount of an object.
If the amount reaches 0, the object is subsequently removed and freed.
This function will send an update to client if op is in a player inventory.
op | object to decrease. |
i | number to remove. |
Definition at line 2676 of file object.cpp.
References object::container, object::env, esrv_update_item(), first_player, fix_object(), FLAG_REMOVED, FOR_MAP_FINISH, FOR_MAP_PREPARE, object::map, player::next, object::nrof, player::ob, object_add_weight(), object_free_drop_inventory(), object_get_player_container(), object_remove(), object_sub_weight(), QUERY_FLAG, UPD_NROF, UPD_WEIGHT, object::weight, object::x, and object::y.
Referenced by cfapi_object_set_property(), check_altar_sacrifice(), do_item_conversion(), eat_item(), object_split(), operate_altar(), save_throw_object(), and spell_consume_items().
Return the square of the distance between the two given objects.
ob1 | |
ob2 | objects we want to compute the distance of. |
Definition at line 3661 of file object.cpp.
References object::x, and object::y.
Referenced by cfapi_object_distance().
void object_dump | ( | const object * | op, |
StringBuffer * | sb | ||
) |
Dumps an object.
op | object to dump. Can be NULL. |
sb | buffer that will contain object information. Must not be NULL. |
Definition at line 645 of file object.cpp.
References object::arch, object::artifact, object::attacked_by, archetype::clone, object::count, empty_archetype, object::enemy, object::env, get_ob_diff(), object::head, object::inv, object::more, object::name, archetype::name, object_get_owner_const(), stringbuffer_append_printf(), and stringbuffer_append_string().
Referenced by animate_object(), command_dump(), do_dump(), dump_arch(), gate_type_process(), object_dump_all(), object_free(), object_insert_in_map(), object_insert_in_ob(), object_remove(), and process_events().
void object_dump_all | ( | void | ) |
Dumps all objects to console.
This is really verbose...Can be triggered by the dumpallobjects command while in DM mode.
All objects are dumped to stderr (or alternate logfile, if in server-mode)
Definition at line 704 of file object.cpp.
References object::count, llevDebug, LOG(), object::next, object_dump(), objects, stringbuffer_finish(), and stringbuffer_new().
Referenced by command_dumpallobjects().
Find object in inventory by archetype name.
who | where to search. |
name | what to search. |
Definition at line 4252 of file object.cpp.
References object::arch, object::below, object::inv, name, and archetype::name.
Referenced by annotate_ob(), cfapi_object_find_by_arch_name(), converter_type_apply(), dialog_preparse(), and dragon_ability_gain().
Find object in inventory by flag.
who | where to search. |
flag | what to search. |
Definition at line 4206 of file object.cpp.
References object::below, object::inv, and QUERY_FLAG.
Referenced by use_alchemy().
Find applied object in inventory by flag.
who | where to search. |
flag | what to search. |
Definition at line 4229 of file object.cpp.
References object::below, FLAG_APPLIED, object::inv, and QUERY_FLAG.
Referenced by save_life().
Finds an object in inventory name.
who | the object to search |
name | name to search for |
Definition at line 3956 of file object.cpp.
References add_string(), object::below, free_string(), object::inv, name, and object::name.
Referenced by apply_changes_to_player(), apply_race_and_class(), cfapi_object_find_by_name(), check_login(), key_change_class(), and move_detector().
object* object_find_by_name_global | ( | const char * | str | ) |
Finds an object by name.
Used only by the patch command, but not all that useful. Enables features like "patch name-of-other-player food 999"
str | name to search for. Must not be allocated by add_string(). |
Definition at line 747 of file object.cpp.
References add_string(), free_string(), name, object::name, object::next, and objects.
Referenced by command_possess(), and find_object_both().
Find object in inventory.
who | where to search. |
tag | what to search. |
Definition at line 4060 of file object.cpp.
References object::below, object::count, and object::inv.
Referenced by command_cast_spell().
Returns the object which has the count-variable equal to the argument.
i | tag. |
Definition at line 727 of file object.cpp.
References object::count, object::next, and objects.
Referenced by cftimer_process_event(), command_diff(), command_insert_into(), command_inventory(), command_possess(), command_stack_list(), dm_stack_peek(), find_object_both(), and get_dm_object().
Find object in inventory.
who | where to search. |
type | what to search. |
Definition at line 3980 of file object.cpp.
References object::below, object::inv, is_valid_types_gen::type, and object::type.
Referenced by fire_bow(), has_ability(), and transport_type_apply().
Find object in inventory.
who | where to search. |
type1 | what to search. |
type2 | what to search. |
Definition at line 4037 of file object.cpp.
References object::below, object::inv, and object::type.
Referenced by dispel_rune(), and hit_player().
Find object in inventory by type and archetype name.
who | where to search. |
type | what to search. |
name | what to search. |
Definition at line 4277 of file object.cpp.
References object::arch, object::below, object::inv, name, archetype::name, is_valid_types_gen::type, and object::type.
Referenced by check_login(), command_resistances(), dragon_eat_flesh(), dragon_focus_type_apply(), dragon_level_gain(), and perceive_self().
Find object in inventory by type and name.
who | where to search. |
type | what to search. |
name | what to search |
Definition at line 4108 of file object.cpp.
References object::below, object::inv, name, object::name, is_valid_types_gen::type, and object::type.
Referenced by check_probe(), check_spell_known(), describe_monster(), do_symptoms(), examine_monster(), find_symptom(), grant_immunity(), and infect_object().
Find object in inventory by type and race.
who | where to search. |
type | what to search. |
race | what to search |
Definition at line 4133 of file object.cpp.
References object::below, object::inv, object::race, is_valid_types_gen::type, and object::type.
Referenced by monster_check_apply().
Find object in inventory by type and skill.
who | where to search. |
type | what to search. |
skill | what to search |
Definition at line 4183 of file object.cpp.
References object::below, object::inv, object::skill, skill, is_valid_types_gen::type, and object::type.
Referenced by do_skill().
Find object in inventory by type and slaying.
who | where to search. |
type | what to search. |
slaying | what to search |
Definition at line 4158 of file object.cpp.
References object::below, object::inv, object::slaying, is_valid_types_gen::type, and object::type.
Referenced by attempt_recipe(), enter_exit(), find_force(), find_key(), move_detector(), and op_on_battleground().
Find applied object in inventory.
who | where to search. |
type | what to search. |
Definition at line 4083 of file object.cpp.
References object::below, FLAG_APPLIED, object::inv, QUERY_FLAG, is_valid_types_gen::type, and object::type.
Referenced by apply_can_apply_object(), attack_hth(), cast_create_missile(), do_skill_attack(), god_enchants_weapon(), monster_check_good_armour(), and monster_check_good_weapon().
Find object in inventory.
who | where to search. |
type | |
subtype | what to search. |
Definition at line 4301 of file object.cpp.
References object::below, object::inv, object::subtype, is_valid_types_gen::type, and object::type.
Referenced by become_follower(), cast_word_of_recall(), cftimer_create(), deep_swamp_type_process(), determine_god(), do_hidden_move(), eventListener(), god_examines_priest(), and monster_can_pick().
object* object_find_by_type_without_flags | ( | const object * | who, |
int | type, | ||
int * | flags, | ||
int | num_flags | ||
) |
Find an object in inventory that does not have any of the provided flags set.
who | where to search. |
type | what to search. |
flags | Array of integers corresponding to the set of flags that cannot have any set on the found item. |
num_flags | The size of the array flags above |
Definition at line 4004 of file object.cpp.
References object::below, flags, object::inv, QUERY_FLAG, and is_valid_types_gen::type.
Referenced by find_key().
object_find_first_free_spot(archetype, mapstruct, x, y) works like object_find_free_spot(), but it will search max number of squares.
It will return the first available spot, not a random choice. Changed 0.93.2: Have it return -1 if there is no free spot available.
ob | object to insert. |
m | |
x | |
y | where to insert the object. |
Definition at line 3599 of file object.cpp.
References freearr_x, freearr_y, m, ob_blocked(), and SIZEOFFREE.
Referenced by find_enclosed_spot(), keyplace(), object_teleport(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), polymorph_living(), put_a_monster(), and transfer_ob().
object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coordinates which will be able to contain the given object.
It returns a random choice among the alternatives found.
ob | object to insert. |
m | |
x | |
y | where to insert the object. |
start | |
stop | first (inclusive) and last (exclusive) positions, in the freearr_ arrays, to search. |
Definition at line 3559 of file object.cpp.
References AB_NO_PASS, freearr_x, freearr_y, m, maxfree, ob_blocked(), RANDOM, and SIZEOFFREE.
Referenced by animate_weapon(), cfapi_object_insert(), command_summon(), command_teleport(), do_follow(), do_harvest(), enter_map(), gate_type_process(), mimic_type_apply(), object_insert_to_free_spot_or_free(), pets_follow_owner(), pets_summon_golem(), pets_summon_object(), shop_mat_type_move_on(), teleport(), and transfer_ob().
int object_find_multi_free_spot_around | ( | const object * | ob, |
const object * | gen, | ||
int16_t * | hx, | ||
int16_t * | hy | ||
) |
Sets hx and hy to the coords to insert a possibly multi-tile ob at, around gen.
ob | object to insert. Must not be NULL. | |
gen | where to insert. Must not be NULL. | |
[out] | hx | |
[out] | hy | coordinates at which insertion is possible. |
Definition at line 3296 of file object.cpp.
References HEAD, object::map, MAP_HEIGHT, MAP_WIDTH, ob_blocked(), object_get_multi_size(), RANDOM, object::x, and object::y.
Referenced by change_object().
int object_find_multi_free_spot_within_radius | ( | const object * | ob, |
const object * | gen, | ||
int * | hx, | ||
int * | hy | ||
) |
Sets hx and hy to the coords to insert a possibly multi-tile ob at, within radius of generator, which is stored in key_value "generator_radius".
Radius defaults to 1.
ob | object to insert. Must not be NULL. | |
gen | where to insert. Must not be NULL. | |
[out] | hx | |
[out] | hy | coordinates at which insertion is possible. |
Definition at line 3412 of file object.cpp.
References get_map_flags(), HEAD, object::map, ob_blocked(), object_get_multi_size(), object_get_value(), P_OUT_OF_MAP, RANDOM, object::x, and object::y.
Referenced by generate_monster_arch(), and generate_monster_inv().
void object_fix_multipart | ( | object * | tmp | ) |
Ensures specified object has its more parts correctly inserted in map.
Extracted from common/map.c:link_multipart_objects
tmp | object we want to fix. Must be on a map. |
Definition at line 4685 of file object.cpp.
References add_string(), object::arch, arch_to_object(), free_string(), object::head, INS_ABOVE_FLOOR_ONLY, INS_NO_MERGE, INS_NO_WALK_ON, llevError, LOG(), object::map, object::more, archetype::more, object::name, object_insert_in_map(), object::title, object::x, and object::y.
Referenced by change_object(), generate_monster_inv(), link_multipart_objects(), and object_handle_death_animation().
void object_free | ( | object * | ob, |
int | flags | ||
) |
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
The IS_FREED() flag is set in the object.
The object must have been removed by object_remove() first for this function to succeed.
ob | object to free. Will become invalid when function returns. |
flags | the flags; see FREE_OBJ_xxx constants. |
Definition at line 1592 of file object.cpp.
References object::anim_suffix, object::arch, object::artifact, object::count, EVENT_DESTROY, events_execute_object_event(), FLAG_ALIVE, FLAG_FREED, FLAG_FRIENDLY, FLAG_IS_A_TEMPLATE, FLAG_NO_DROP, FLAG_REMOVED, FLAG_STARTEQUIP, flags, FOR_INV_FINISH, FOR_INV_PREPARE, FREE_AND_CLEAR, FREE_AND_CLEAR_STR, FREE_AND_CLEAR_STR_IF, free_arch(), free_dialog_information(), FREE_OBJ_DROP_ABOVE_FLOOR, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, free_objects, GET_MAP_MOVE_BLOCK, mapstruct::in_memory, INS_ABOVE_FLOOR_ONLY, object::inv, llevError, llevMonster, LOG(), object::lore, object::map, MAP_IN_MEMORY, object::materialname, object::more, MOVE_ALL, object::msg, object::name, object::name_pl, object::next, nroffreeobjects, object_dump(), object_free(), object_free_drop_inventory(), object_free_key_values(), object_insert_in_map_at(), object_insert_to_free_spot_or_free(), object_remove(), object_update_speed(), objects, object::prev, QUERY_FLAG, object::race, RANDOM, archetype::reference_count, remove_friendly_object(), RUNE, SCRIPT_FIX_NOTHING, SET_FLAG, SIZEOFFREE, object::skill, object::slaying, object::speed, object::spell_tags, stringbuffer_finish(), stringbuffer_new(), object::title, TRAP, object::x, and object::y.
Referenced by add_one_item(), alchemy_object(), apply_auto(), apply_by_living(), apply_race_and_class(), cast_create_missile(), cast_create_town_portal(), cfapi_object_insert(), clear_player(), command_create(), command_learn_spell_or_prayer(), command_reset(), command_summon(), command_teleport(), counterspell(), do_execute_event(), do_forget_spell(), do_goto(), do_harvest(), do_single_item(), enter_exit(), enter_player_savebed(), eventListener(), free_all_objects(), free_no_drop(), god_gives_present(), move_aura(), object_free(), object_free_drop_inventory(), object_free_inventory(), object_insert_in_map(), object_insert_in_ob(), object_merge(), object_split(), peacemaker_type_process(), player_arrest(), polymorph_item(), polymorph_living(), polymorph_melt(), process_events(), process_object(), recharge(), recipe_get_face(), save_object_in_sb(), scroll_failure(), stop_projectile(), town_portal_destroy_existing(), town_portal_find_force(), and write_scroll().
void object_free_all_data | ( | void | ) |
Destroys all allocated objects.
Definition at line 767 of file object.cpp.
References FLAG_FREED, free_objects, llevDebug, LOG(), object::name, object::next, nrofallocobjects, nroffreeobjects, objects, QUERY_FLAG, and STARTMAX.
Referenced by cleanup().
void object_free_drop_inventory | ( | object * | ob | ) |
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
The IS_FREED() flag is set in the object. The object must have been removed by object_remove() first for this function to succeed.
Inventory will be dropped on the ground if in a map, else freed too.
ob | object to free. Will become invalid when function returns. |
Definition at line 1560 of file object.cpp.
References object_free().
Referenced by add_abilities(), add_npc_to_point(), add_npc_to_zone(), adjust_sign_msg(), alchemy_failure_effect(), apply_auto(), apply_builder_floor(), apply_builder_item(), apply_builder_remove(), apply_builder_wall(), apply_builder_window(), arrow_type_process(), artifact_describe(), become_follower(), blindness_type_process(), cast_cause_disease(), cast_dust(), cast_raise_dead_spell(), cast_smite_spell(), cfapi_object_delete(), cfapi_object_insert(), change_book(), change_object(), check_bullet(), clean_object(), command_cast_spell(), command_free(), command_kill_pets(), common_process_projectile(), cure_disease(), decay_objects(), delete_unique_items(), destroy_object(), dispel_rune(), do_item_conversion(), do_turn(), drop(), drop_object(), eat_special_food(), enter_map(), eventListener(), execute_word_of_recall(), explode_bullet(), explosion(), fire_arch_from_position(), fire_bolt(), fire_bow(), fix_generated_item(), fix_stopped_arrow(), fix_walls(), follower_remove_given_items(), free_player(), generate_monster(), generate_treasure(), give_initial_items(), god_intervention(), hit_player(), hit_with_arrow(), insert_objects(), key_change_class(), kill_object(), kill_player_permadeath(), load_objects(), locate_recipe_artifact(), lock_and_hide_doors(), loot_object(), monster_move(), monster_move_no_enemy(), move_aura(), move_bolt(), move_bullet(), move_cone(), move_creator(), move_disease(), move_duplicator(), move_marker(), move_player_mover(), move_swarm_spell(), move_symptom(), move_teleporter(), nuke_map_region(), object_decrease_nrof(), object_free(), object_insert_to_free_spot_or_free(), object_merge_spell(), object_replace_insert_in_map(), pay_from_container(), pets_attempt_follow(), pets_move(), pets_move_golem(), pets_summon_golem(), pets_terminate_all(), pick_up_object(), place_chest(), place_exits(), place_fountain_with_specials(), poisoning_type_process(), prayer_failure(), print_monsters(), receive_play_again(), remove_adjacent_doors(), remove_contents(), remove_depletion(), remove_door(), remove_force(), remove_locked_door(), remove_marking_runes(), remove_monsters(), remove_special_prayers(), remove_symptoms(), remove_unpaid_objects(), restore_player(), retrofit_joined_wall(), rune_attack(), save_life(), save_throw_object(), spell_effect_type_move_on(), spell_failure(), spring_trap(), stop_item(), stop_projectile(), tailor_god_spell(), tear_down_wall(), and thrown_object_type_process().
void object_free_inventory | ( | object * | ob | ) |
Frees the inventory of an object, without any callback.
ob | object to free the inventory of. |
Definition at line 1568 of file object.cpp.
References FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, object::inv, object_free(), and object_remove().
Referenced by asset_destroy(), Archetypes::recursive_update(), and Archetypes::replace().
void object_free_key_values | ( | object * | op | ) |
Zero the key_values on op, decrementing the shared-string refcounts and freeing the links.
op | object to clear. |
Definition at line 954 of file object.cpp.
References FREE_AND_CLEAR_STR, key_value::key, object::key_values, key_value::next, and key_value::value.
Referenced by free_arch(), free_artifact(), object_clear(), object_copy_no_speed(), and object_free().
Utility function.
op | object we want the environment of. Can't be NULL. |
Definition at line 590 of file object.cpp.
References object::env.
Referenced by animate_bomb(), cfapi_object_set_property(), do_execute_event(), explode_bullet(), and spring_trap().
Search for a field by key.
ob | object where search |
key | key to search. Must be a passed in shared string - otherwise, this won't do the desired thing. |
Definition at line 4321 of file object.cpp.
References key_value::key, object::key_values, and key_value::next.
Referenced by compare_ob_value_lists_one(), get_ob_diff(), object_set_value_s(), and process_object().
void object_get_multi_size | ( | const object * | ob, |
int * | sx, | ||
int * | sy, | ||
int * | hx, | ||
int * | hy | ||
) |
Computes the size of a multitile object.
ob | object we compute the size of. | |
[out] | sx | |
[out] | sy | will contain the coords of the bottom right tail relative to the head. Must not be NULL. |
[out] | hx | |
[out] | hy | will contain the coords of the head tile relative to the top left tile. Can be NULL. |
Definition at line 4744 of file object.cpp.
References object::arch, archetype::clone, HEAD, archetype::more, object::x, and object::y.
Referenced by object_find_multi_free_spot_around(), object_find_multi_free_spot_within_radius(), object_on_exit(), process_map(), and update_transport_block().
Returns the object which this object marks as being the owner.
A id-scheme is used to avoid pointing to objects which have been freed and are now reused. If this is detected, the owner is set to NULL, and NULL is returned.
op | item to search owner of. |
Definition at line 804 of file object.cpp.
References object::count, FLAG_FREED, FLAG_REMOVED, object_clear_owner(), object::owner, object::ownercount, and QUERY_FLAG.
Referenced by adj_attackroll(), attack_message(), attack_ob_simple(), blame(), blind_living(), cast_spell(), cfapi_object_get_property(), change_object(), command_kill_pets(), common_process_projectile(), common_projectile_move_on(), cone_drop(), counterspell(), do_mood_floor(), do_symptoms(), explode_bullet(), find_target_for_friendly_spell(), find_traps(), fire_arch_from_position(), fix_summon_pet(), friendly_fire(), get_real_owner(), hit_player(), hit_with_drain(), hit_with_one_attacktype(), infect_object(), is_enemy(), kill_object(), monster_cast_spell(), monster_check_enemy(), monster_move(), monster_use_bow(), monster_use_range(), monster_use_scroll(), monster_use_skill(), move_ball_spell(), move_missile(), move_player_attack(), move_swarm_spell(), object_copy_owner(), object_set_owner(), peacemaker_type_process(), pets_attempt_follow(), pets_get_enemy(), pets_move(), pets_move_golem(), pets_summon_golem(), pets_summon_object(), poison_living(), polymorph_living(), push_ob(), remove_trap(), save_object_in_sb(), save_objects(), scare_creature(), steal(), tailor_god_spell(), trap_disarm(), and use_oratory().
Finds the player carrying an object.
op | item for which we want the carrier (player). |
Definition at line 607 of file object.cpp.
References object::env, PLAYER, and object::type.
Referenced by cfapi_object_set_property(), do_light(), drain_wand_charge(), identify(), lamp_type_apply(), object_decrease_nrof(), object_increase_nrof(), object_insert_in_ob(), object_remove(), pick_up_object(), remove_force(), and send_changed_object().
const char* object_get_value | ( | const object * | op, |
const char *const | key | ||
) |
Get an extra value by key.
op | object we're considering |
key | key of which to retrieve the value. Doesn't need to be a shared string. |
Definition at line 4346 of file object.cpp.
References find_string(), key_value::key, object::key_values, key_value::next, and key_value::value.
Referenced by add_abilities(), add_object_to_socklist(), adjust_sign_msg(), append_spell(), apply_check_personalized_blessings(), apply_check_race_restrictions(), apply_handle_yield(), calculate_difficulty(), cfapi_object_get_key(), cfapi_object_get_property(), change_book(), check_spell_expiry(), command_cast_spell(), command_rename_item(), create_player_cmd(), do_harvest(), do_monster(), esrv_add_spells(), esrv_update_item(), eventListener(), examine(), fix_player(), follower_remove_given_items(), generate_monster(), generate_monster_arch(), generate_monster_inv(), god_enchants_weapon(), knowledge_monster_validate(), knowledge_read(), monster_move_randomly(), monster_npc_call_help(), mood_change(), move_aura(), object_find_multi_free_spot_within_radius(), object_give_identified_properties(), object_handle_death_animation(), object_matches_string(), object_try_get_value(), object_value_set(), price_base(), send_arch_info(), set_object_face_main(), set_object_face_other(), shop_price_buy(), shop_price_sell(), SP_level_wc_adjust(), spell_consume_items(), and transport_type_apply().
void object_give_identified_properties | ( | object * | op | ) |
Ensure op has all its "identified" properties set.
op | object to process. |
Definition at line 1361 of file item.cpp.
References object::anim_speed, animate_object(), object::animation, CLEAR_FLAG, object::face, object::facing, FLAG_ANIMATE, FLAG_CLIENT_ANIM_RANDOM, FLAG_CLIENT_ANIM_SYNC, FLAG_IS_TURNABLE, FREE_AND_COPY, object::last_anim, object::name, object::name_pl, object_get_value(), object_set_value(), QUERY_FLAG, SET_FLAG, sstring, try_find_animation(), and try_find_face().
Referenced by add_abilities(), add_one_item(), check_loaded_object(), command_create(), identify(), make_item_from_recipe(), and recipe_get_face().
void object_handle_death_animation | ( | object * | op | ) |
Definition at line 5410 of file object.cpp.
References object::arch, create_archetype(), object::map, archetype::more, object_fix_multipart(), object_get_value(), object_insert_in_map_at(), sstring, object::x, and object::y.
Referenced by generate_monster(), and kill_object().
This function inserts the object in the two-way linked list which represents what is on a map.
It will update player count if the op is a player.
Player ground window will be updated if needed.
op | object to insert. Must be removed. Its coordinates must be valid for the map. |
m | map to insert into. Must not be NULL. |
originator | player, monster or other object that caused 'op' to be inserted into 'm'. May be NULL. |
flag | bitmask about special things to do (or not do) when this function is called. See the object.h file for the INS_xxx values. Passing 0 for flag gives proper default values, so flag really only needs to be set if special handling is needed. |
Definition at line 2361 of file object.cpp.
References object::above, object::below, CLEAR_FLAG, object::contr, player::do_los, find_insert_pos(), FLAG_ALIVE, FLAG_APPLIED, FLAG_FREED, FLAG_INV_LOCKED, FLAG_NO_STEAL, FLAG_REMOVED, floor, FOR_MAP_FINISH, FOR_MAP_PREPARE, FOR_OB_AND_ABOVE_FINISH, FOR_OB_AND_ABOVE_PREPARE, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, get_map_from_coord(), GET_MAP_OB, object::glow_radius, object::head, player::hidden, INS_BELOW_ORIGINATOR, INS_MAP_LOAD, INS_NO_MERGE, INS_NO_WALK_ON, LAMP, llevError, LOG(), m, object::map, MAP_DARKNESS, object::more, object::nrof, object_can_merge(), object_check_move_on(), object_dump(), object_free(), object_insert_in_map(), object_merge_spell(), object_remove(), object_update(), object::other_arch, out_of_map(), OUT_OF_REAL_MAP, object::ox, object::oy, PLAYER, mapstruct::players, QUERY_FLAG, object::range, SET_MAP_OB, SET_MAP_TOP, player::socket, object::speed, object::speed_left, SPELL_EFFECT, stringbuffer_finish(), stringbuffer_new(), player::transport, object::type, UP_OBJ_INSERT, update_all_los(), socket_struct::update_look, object::x, and object::y.
Referenced by change_object(), fix_stopped_item(), object_fix_multipart(), object_insert_in_map(), object_insert_in_map_at(), and pick_up().
object* object_insert_in_map_at | ( | object * | op, |
mapstruct * | m, | ||
object * | originator, | ||
int | flag, | ||
int | x, | ||
int | y | ||
) |
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing multi-part monsters.
op | object to insert. |
m | map to insert into. |
originator | what caused op to be inserted. |
flag | Combination of INS_xxx values. |
x | |
y | coordinates to insert at. |
Definition at line 2100 of file object.cpp.
References object::arch, archetype::clone, HEAD, m, object::map, object::more, object_insert_in_map(), object::x, and object::y.
Referenced by alchemy_failure_effect(), animate_bomb(), animate_weapon(), apply_auto(), apply_builder_floor(), apply_builder_item(), apply_builder_wall(), apply_builder_window(), apply_container(), apply_handle_yield(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_cone(), cast_consecrate(), cast_create_obj(), cast_create_town_portal(), cast_curse(), cast_destruction(), cast_detection(), cast_heal(), cast_light(), cast_magic_storm(), cast_polymorph(), cast_raise_dead_spell(), cast_smite_spell(), cfapi_object_insert(), cfapi_object_transfer(), charge_mana_effect(), command_create(), command_reset(), common_process_projectile(), cone_drop(), convert_item(), converter_type_apply(), converter_type_move_on(), create_bomb(), dimension_door(), do_follow(), do_harvest(), do_throw(), drop_object(), eat_special_food(), enter_map(), explode_bullet(), explosion(), fire_arch_from_position(), fire_bolt(), fire_bow(), fire_swarm(), fix_walls(), forklightning(), gate_type_process(), generate_monster_arch(), generate_monster_inv(), hit_with_arrow(), identify_object_with_skill(), include_map_in_map(), key_change_class(), keyplace(), kill_player(), kill_player_not_permadeath(), kill_player_permadeath(), load_objects(), lock_and_hide_doors(), loot_object(), magic_wall(), make_map_floor(), make_map_walls(), mimic_type_apply(), mood_change(), move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_cone(), move_creator(), move_ob(), move_symptom(), object_free(), object_handle_death_animation(), object_insert_to_free_spot_or_free(), object_replace_insert_in_map(), object_teleport(), pets_follow_owner(), pets_summon_golem(), pets_summon_object(), pick_up_object(), place_alchemy_objects(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), polymorph_item(), polymorph_living(), potion_type_apply(), push_ob(), put_a_monster(), put_decor(), put_doors(), put_floor(), put_in_icecube(), put_object_in_sack(), put_treasure(), recharge(), remove_door(), remove_force(), remove_locked_door(), remove_unpaid_objects(), retrofit_joined_wall(), roll_ob(), save_throw_object(), shop_mat_type_move_on(), spell_effect(), spell_failure(), spring_trap(), stop_jump(), stop_projectile(), surround_by_doors(), teleport(), transfer_ob(), transport_type_apply(), trap_show(), treasure_type_apply(), turn_one_transport(), write_mark(), and write_rune().
This function inserts the object op in the linked list inside the object environment.
It will send to client where is a player.
op | object to insert. Must be removed and not NULL. Must not be multipart. May become invalid after return, so use return value of the function. |
where | object to insert into. Must not be NULL. Should be the head part. |
Definition at line 2857 of file object.cpp.
References above, object::above, object::arch, object::below, BITMASK_EVENT, object::carrying, CLEAR_FLAG, CONTAINER, object::contr, object::count, object::env, esrv_send_item(), object::event_bitmask, EVENT_CONNECTOR, living::exp, fix_object(), FLAG_APPLIED, FLAG_NO_FIX_PLAYER, FLAG_OBJ_ORIGINAL, FLAG_REMOVED, FOR_ABOVE_FINISH, FOR_ABOVE_PREPARE, FOR_INV_FINISH, FOR_INV_PREPARE, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, object::glow_radius, object::head, HEAD, object::inv, llevDebug, llevError, LOG(), object::map, MAP_DARKNESS, object::more, object::name, archetype::name, object::nrof, object_add_weight(), object_can_merge(), object_dump(), object_free(), object_get_player_container(), object_increase_nrof(), object::ox, object::oy, P_NEED_UPDATE, QUERY_FLAG, SET_FLAG, SET_MAP_FLAGS, SKILL, object::skill, object::stats, stringbuffer_finish(), stringbuffer_new(), object::subtype, object::total_exp, object::type, update_all_los(), update_position(), object::weight, object::x, and object::y.
Referenced by add_abilities(), add_force(), alchemy_failure_effect(), animate_weapon(), apply_auto(), apply_container(), apply_handle_yield(), apply_special(), attempt_recipe(), blind_living(), cast_bless(), cast_change_ability(), cast_create_town_portal(), cast_curse(), cast_word_of_recall(), cfapi_object_insert(), change_luck(), change_object(), check_loaded_object(), command_create(), command_insert_into(), command_use(), confuse_living(), converter_type_apply(), create_aura(), create_player_cmd(), dialog_preparse(), do_harvest(), do_learn_spell(), do_symptoms(), do_throw(), do_turn(), dragon_ability_gain(), drain_specific_stat(), eat_special_food(), examine_monster(), find_or_create_connection_for_map(), fix_generated_item(), get_npc(), give_skill_by_name(), god_gives_present(), grant_immunity(), hit_with_arrow(), identify_object_with_skill(), improve_armour(), infect_object(), insert_objects(), keyplace(), kill_player_not_permadeath(), lamp_type_apply(), lighter_type_apply(), magic_wall(), make_object_glow(), make_throw_ob(), mimic_type_apply(), monster_check_pickup(), move_aura(), msgfile_msg(), object_copy_with_inv(), object_create_clone(), pick_up_object(), place_chest(), poison_living(), potion_type_apply(), put_in_icecube(), put_object_in_sack(), put_treasure(), remove_force(), save_throw_object(), sell_item(), slow_living_by(), stick_arrow(), swap_random_stats(), town_portal_find_force(), transmute_item_to_flower(), transport_type_apply(), while(), write_note(), write_rune(), and write_scroll().
void object_insert_to_free_spot_or_free | ( | object * | op, |
mapstruct * | map, | ||
int | x, | ||
int | y, | ||
int | start, | ||
int | stop, | ||
object * | originator | ||
) |
Inserts an object into its map.
The object is inserted into a free spot (as returned by object_find_free_spot()). If no free spot can be found, the object is freed.
op | the object to insert or free |
map | the map to insert into |
x | the x-coordinate to insert into |
y | the y-coordinate to insert into |
start | first (inclusive) position in the freearr_ arrays to search |
stop | last (exclusive) position in the freearr_ arrays to search |
originator | what caused op to be inserted. |
Definition at line 4791 of file object.cpp.
References freearr_x, freearr_y, object_find_free_spot(), object_free_drop_inventory(), and object_insert_in_map_at().
Referenced by change_object(), and object_free().
int object_matches_pickup_mode | ( | const object * | item, |
int | mode | ||
) |
Checks if an item matches a specific pickup mode.
item | item to check. |
mode | one value of Pickup modes, not a combination of modes. |
Definition at line 656 of file c_object.cpp.
References AMULET, ARMOUR, ARMOUR_IMPROVER, ARROW, BOOK, BOOTS, BOW, CLOAK, CONTAINER, DRINK, FLAG_IS_THROWN, FLAG_KNOWN_CURSED, FLAG_KNOWN_MAGICAL, FLESH, FOOD, GEM, GLOVES, HELMET, KEY, MONEY, POISON, POTION, PU_ARMOUR, PU_ARROW, PU_BOOTS, PU_BOW, PU_CLOAK, PU_CONTAINER, PU_CURSED, PU_DRINK, PU_FLESH, PU_FOOD, PU_GLOVES, PU_HELMET, PU_JEWELS, PU_KEY, PU_MAGIC_DEVICE, PU_MAGICAL, PU_MELEEWEAPON, PU_MISSILEWEAPON, PU_POTION, PU_READABLES, PU_SHIELD, PU_SKILLSCROLL, PU_SPELLBOOK, PU_VALUABLES, QUERY_FLAG, RING, ROD, SCROLL, SHIELD, SKILL_TOOL, SKILLSCROLL, SPECIAL_KEY, SPELLBOOK, object::type, WAND, WEAPON, and WEAPON_IMPROVER.
Referenced by check_pick(), and matcher_pickup_type().
This is a subset of the parse_id command.
Basically, name can be a string separated lists of things to match, with certain keywords. pl is the player (only needed to set count properly) op is the item we are trying to match. Calling function takes care of what action might need to be done and if it is valid (pickup, drop, etc.) Return NONZERO if we have a match. A higher value means a better match. 0 means no match.
Brief outline of the procedure: We take apart the name variable into the individual components. cases for 'all' and unpaid are pretty obvious. Next, we check for a count (either specified in name, or in the player object.) If count is 1, make a quick check on the name. IF count is >1, we need to make plural name. Return if match. Last, make a check on the full name.
Details on values output (highest is output):
nothing 0 'all' 1 'unpaid' 2 'cursed' 2 'unlocked' 2 partial custom name 3 op->name with count >1 4 op->name with count <2 6 op->name_pl with count >1 6 inside base name 12 inside short name 12 begin of base name 14 custom name 15 base name 16 short name 18 full name 20 (note, count is extracted from begin of name parameter or from pl->contr->count, name has priority)
pl | object we're searching an item for. Must not be NULL. |
op | object we're considering. Must not be NULL. |
name | string we're searching. |
Definition at line 4574 of file object.cpp.
References object::contr, player::count, CUSTOM_NAME_FIELD, FLAG_CURSED, FLAG_DAMNED, FLAG_INV_LOCKED, FLAG_KNOWN_CURSED, FLAG_UNPAID, HUGE_BUF, MAX_BUF, name, object::name, object::name_pl, object_get_value(), PLAYER, query_base_name(), QUERY_FLAG, query_name(), query_short_name(), safe_strncpy, sstring, strcasecmp(), and object::type.
Referenced by check_pick(), find_best_apply_object_match(), matcher_name(), and write_rune().
This function goes through all objects below and including top, and merges op to the first matching object.
Will correctly send updated objects to client if needed.
op | object to merge. |
top | from which item to merge. If NULL, it is calculated. |
Definition at line 2051 of file object.cpp.
References object::above, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, object::nrof, object_can_merge(), object_free(), object_increase_nrof(), and object_remove().
Referenced by cfapi_object_merge(), command_lock_item(), command_rename_item(), fix_stopped_item(), hit_with_arrow(), identify(), identify_object_with_skill(), lock_item_cmd(), shop_pay_unpaid_callback(), stop_projectile(), and unapply_special().
void object_merge_spell | ( | object * | op, |
int16_t | x, | ||
int16_t | y | ||
) |
This sees if there are any objects on the space that can merge with op.
Note that op does not need to actually be inserted on the map (when called from object_insert_in_map, it won't be), but op->map should be set correctly.
Note that even if we find a match on the space, we keep progressing looking for more. This is because op->range is set to 0 in explosion, so what may not have been mergable now is.
op | object to try to merge into. |
x | |
y | coordinates to look at for merging. |
Definition at line 2129 of file object.cpp.
References object::attacktype, living::dam, object::direction, object::duration, FOR_MAP_FINISH, FOR_MAP_PREPARE, FREE_AND_CLEAR, object::level, llevError, LOG(), object::map, MAX, living::maxhp, OB_SPELL_TAG_HASH, OB_SPELL_TAG_MATCH, object_free_drop_inventory(), object_remove(), object::owner, object::ownercount, object::range, object::speed, object::speed_left, Statistics::spell_hash_full, Statistics::spell_merges, SPELL_TAG_SIZE, object::spell_tags, statistics, object::stats, object::subtype, object::type, and living::wc.
Referenced by explosion(), and object_insert_in_map().
object* object_new | ( | void | ) |
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
If there are no free objects, expand_objects() is called to get more.
Definition at line 1273 of file object.cpp.
References object::active_next, object::active_prev, BITMASK_VALID, object::count, object::event_bitmask, expand_objects(), fatal(), FLAG_FREED, FLAG_REMOVED, free_objects, llevError, LOG(), object::lore, object::materialname, object::msg, object::name, object::name_pl, object::next, nroffreeobjects, ob_count, object_clear(), objects, OUT_OF_MEMORY, object::prev, QUERY_FLAG, object::race, SET_FLAG, object::skill, object::slaying, object::spell_tags, and object::title.
Referenced by add_abilities(), arch_to_object(), artifact_describe(), cast_create_food(), cfapi_object_clone(), cfapi_object_create(), command_reset(), command_summon(), command_teleport(), create_singularity(), do_goto(), do_learn_spell(), enter_exit(), enter_player_savebed(), explosion(), forklightning(), generate_treasure(), get_jail_exit(), infect_object(), key_change_class(), load_objects(), magic_wall(), make_throw_ob(), move_bolt(), move_cone(), object_copy_with_inv(), object_create_clone(), pay_from_container(), place_chest(), place_fountain_with_specials(), place_special_exit(), polymorph_item(), sell_item(), while(), write_note(), write_rune(), and write_scroll().
Searches for any objects with a matching type variable in the inventory of the given object.
type | type to search for. |
op | object to search into. |
Definition at line 3168 of file object.cpp.
References object::below, object::inv, is_valid_types_gen::type, and object::type.
Referenced by blind_living(), cfapi_object_get_property(), check_probe(), and examine_monster().
Searches for any objects with a matching type & name variable in the inventory of the given object.
This is mostly used by spell effect code, so that we only have one spell effect at a time. type can be used to narrow the search - if type is set, the type must also match. -1 can be passed for the type, in which case the type does not need to pass. str is the string to match against. Note that we match against the object name, not the archetype name. this is so that the spell code can use one object type (force), but change it's name to be unique.
type | object type to search for. -1 means to ignore it. |
str | object name to search for. |
op | where to search. |
Definition at line 3203 of file object.cpp.
References object::below, object::inv, object::name, is_valid_types_gen::type, and object::type.
Referenced by apply_changes_to_player(), become_follower(), cast_heal(), cfapi_object_get_property(), confuse_living(), and create_aura().
void object_remove | ( | object * | op | ) |
This function removes the object op from the linked list of objects which it is currently tied to.
When this function is done, the object will have no environment. If the object previously had an environment, the x and y coordinates will be updated to the previous environment.
Will inform the client of the removal if needed.
op | object to remove. Must not be removed yet, else abort() is called. |
Definition at line 1833 of file object.cpp.
References above, object::above, object::below, object::carrying, CLEAR_FLAG, CONTAINER, object::contr, object::count, object::env, esrv_del_item(), esrv_update_item(), object::event_bitmask, EVENT_CONNECTOR, fix_object(), FLAG_APPLIED, FLAG_BLOCKSVIEW, FLAG_NO_APPLY, FLAG_NO_FIX_PLAYER, FLAG_REMOVED, FOR_MAP_FINISH, FOR_MAP_PREPARE, get_map_from_coord(), GET_MAP_OB, object::glow_radius, object::head, player::hidden, mapstruct::in_memory, object::inv, llevError, LOG(), LOOK_OBJ, m, object::map, MAP_SAVING, object::more, object::move_type, object::nrof, ob_move_on(), object_dump(), object_get_player_container(), object_remove(), object_sub_weight(), object_update(), object_was_destroyed, object::ox, object::oy, P_NEED_UPDATE, mapstruct::path, PLAYER, mapstruct::players, QUERY_FLAG, SET_FLAG, SET_MAP_FLAGS, SET_MAP_OB, SET_MAP_TOP, stringbuffer_finish(), stringbuffer_new(), object::type, UP_OBJ_REMOVE, UPD_FLAGS, update_all_los(), update_position(), object::weight, object::x, and object::y.
Referenced by add_abilities(), adjust_sign_msg(), alchemy_object(), animate_bomb(), animate_weapon(), apply_auto(), apply_builder_floor(), apply_builder_item(), apply_builder_remove(), apply_builder_wall(), apply_builder_window(), apply_by_living(), apply_race_and_class(), apply_savebed(), arrow_type_process(), attempt_jump(), become_follower(), blindness_type_process(), cast_consecrate(), cast_create_town_portal(), cast_dust(), cast_raise_dead_spell(), cfapi_object_insert(), cfapi_object_remove(), change_object(), check_altar_sacrifice(), check_bullet(), check_login(), clean_object(), command_cast_spell(), command_free(), command_insert_into(), command_kill_pets(), command_remove(), command_reset(), common_process_projectile(), counterspell(), create_player_cmd(), cure_disease(), decay_objects(), delete_unique_items(), destroy_object(), dimension_door(), dispel_rune(), do_execute_event(), do_follow(), do_forget_spell(), do_harvest(), do_item_conversion(), do_throw(), do_turn(), drop(), drop_object(), enter_exit(), enter_map(), eventListener(), execute_word_of_recall(), explode_bullet(), explosion(), fire_bow(), fix_generated_item(), fix_stopped_arrow(), fix_walls(), follower_remove_given_items(), free_all_objects(), free_no_drop(), free_player(), gate_type_process(), generate_monster(), generate_treasure(), give_initial_items(), hit_player(), hit_with_arrow(), key_change_class(), key_confirm_quit(), kill_object(), kill_player_permadeath(), leave(), lock_and_hide_doors(), loot_object(), mimic_type_apply(), monster_move(), monster_move_no_enemy(), move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_cone(), move_disease(), move_duplicator(), move_marker(), move_ob(), move_player_mover(), move_swarm_spell(), move_symptom(), move_teleporter(), nuke_map_region(), object_decrease_nrof(), object_free(), object_free_inventory(), object_insert_in_map(), object_merge(), object_merge_spell(), object_remove(), object_replace_insert_in_map(), object_split(), object_teleport(), pay_from_container(), peacemaker_type_process(), pets_follow_owner(), pets_move(), pets_move_golem(), pets_summon_golem(), pets_terminate_all(), pick_up_object(), place_exits(), play_again(), poisoning_type_process(), polymorph_item(), polymorph_living(), polymorph_melt(), process_object(), push_ob(), put_in_icecube(), put_object_in_sack(), recharge(), remove_adjacent_doors(), remove_contents(), remove_depletion(), remove_door(), remove_force(), remove_locked_door(), remove_marking_runes(), remove_monsters(), remove_special_prayers(), remove_symptoms(), remove_unpaid_objects(), restore_player(), retrofit_joined_wall(), roll_ob(), rune_attack(), save_life(), save_throw_object(), shop_mat_type_move_on(), spell_effect_type_move_on(), spring_trap(), stick_arrow(), stop_item(), stop_projectile(), tear_down_wall(), teleport(), thrown_object_type_process(), town_portal_destroy_existing(), transfer_ob(), transmute_item_to_flower(), transport_type_apply(), treasure_type_apply(), turn_one_transport(), and write_scroll().
void object_remove_from_active_list | ( | object * | op | ) |
This function removes object 'op' from the list of active objects.
This should only be used for style maps or other such reference maps where you don't want an object that isn't in play chewing up cpu time getting processed. The reverse of this is to call object_update_speed(), which will do the right thing based on the speed of the object.
op | object to remove. |
Definition at line 1392 of file object.cpp.
References object::active_next, active_objects, and object::active_prev.
Referenced by load_objects(), and object_update_speed().
void object_replace_insert_in_map | ( | const char * | arch_string, |
object * | op | ||
) |
This function inserts an object of a specified archetype in the map, but if it finds objects of its own type, it'll remove them first.
arch_string | object's archetype to insert. |
op | object to insert it under: supplies x and the map. |
Definition at line 2597 of file object.cpp.
References arch_to_object(), find_archetype(), FOR_MAP_FINISH, FOR_MAP_PREPARE, INS_BELOW_ORIGINATOR, object::map, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object::x, and object::y.
Referenced by save_throw_object().
void object_reset | ( | object * | op | ) |
Totally resets the specified object, without freeing associated memory.
op | object to reset. |
Definition at line 934 of file object.cpp.
References object::lore, object::materialname, object::msg, object::name, object::name_pl, object_clear(), object::race, object::skill, object::slaying, and object::title.
Referenced by cfapi_object_reset(), check_login(), and ArtifactLoader::load().
void object_set_cheat | ( | object * | op | ) |
object_set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in all it's inventory (recursively).
If checksums are used, a player will get object_set_cheat called for him/her-self and all object carried by a call to this function.
op | object for which to set the flag. |
Definition at line 3274 of file object.cpp.
References FLAG_WAS_WIZ, object_set_flag_inv(), and SET_FLAG.
Referenced by cfapi_object_set_property().
Sets the enemy of an object.
op | the object of which to set the enemy |
enemy | the new enemy for op; can be NULL to clear the enemy |
Definition at line 915 of file object.cpp.
References object::count, object::enemy, llevDebug, LOG(), object::name, PLAYER, and object::type.
Referenced by alchemy_failure_effect(), cfapi_object_set_property(), command_mon_aggr(), do_mood_floor(), enter_map(), fix_summon_pet(), flee_player(), hit_player(), monster_check_enemy(), monster_find_enemy(), monster_move(), monster_npc_call_help(), mood_change(), pets_get_enemy(), pets_move(), pets_summon_object(), push_ob(), and scare_creature().
void object_set_flag_inv | ( | object * | op, |
int | flag | ||
) |
Activate recursively a flag on an object's inventory.
op | object to recurse. Can have an empty inventory. |
flag | flag to set. |
Definition at line 3239 of file object.cpp.
References object::below, object::inv, object_set_flag_inv(), and SET_FLAG.
Referenced by check_loaded_object(), object_set_cheat(), and object_set_flag_inv().
void object_set_msg | ( | object * | op, |
const char * | msg | ||
) |
Set the message field of an object.
op | the object to modify |
msg | the new message to set or NULL to clear |
Definition at line 4811 of file object.cpp.
References add_string(), free_string(), object::msg, stringbuffer_append_string(), stringbuffer_finish_shared(), and stringbuffer_new().
Referenced by add_abilities(), adjust_sign_msg(), apply_race_and_class(), cast_create_town_portal(), change_book(), commit_crime(), copy_message(), do_symptoms(), find_or_create_connection_for_map(), key_change_class(), kill_player(), kill_player_not_permadeath(), kill_player_permadeath(), make_formula_book(), place_exits(), place_special_exit(), tailor_readable_ob(), while(), write_mark(), write_note(), and write_rune().
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects.
op | object of which to set the owner |
owner | new owner for object. Can be NULL, in which case it's equivalent of calling object_clear_owner(op) |
Definition at line 840 of file object.cpp.
References object::count, object_clear_owner(), object_get_owner(), object::owner, and object::ownercount.
Referenced by animate_weapon(), cast_cause_disease(), cast_cone(), cast_smite_spell(), cfapi_object_set_property(), change_object(), cone_drop(), create_aura(), create_bomb(), do_mood_floor(), do_symptoms(), do_throw(), fire_arch_from_position(), fire_bolt(), fire_bow(), fire_swarm(), fix_summon_pet(), hit_with_arrow(), infect_object(), magic_wall(), mood_change(), object_copy_owner(), pets_summon_golem(), pets_summon_object(), polymorph_living(), use_oratory(), and write_rune().
int object_set_value | ( | object * | op, |
const char * | key, | ||
const char * | value, | ||
int | add_key | ||
) |
Updates the key in op to value.
op | object we're considering. |
key | key to set or update. Doesn't need to be a shared string. |
value | value to set. Doesn't need to be a shared string. |
add_key | if 0, will not add the key if it doesn't exist in op. |
Definition at line 4499 of file object.cpp.
References add_string(), FALSE, find_string(), free_string(), object_set_value_s(), and TRUE.
Referenced by add_abilities(), add_key_value(), cfapi_object_set_key(), cfapi_object_set_property(), change_book(), command_rename_item(), do_harvest(), eventListener(), generate_monster(), generate_monster_arch(), generate_monster_inv(), get_npc(), god_enchants_weapon(), god_gives_present(), god_info_msg(), make_formula_book(), mon_info_msg(), monster_do_talk_npc(), monster_move_randomly(), mood_change(), msgfile_msg(), object_give_identified_properties(), place_fountain_with_specials(), sell_item(), set_object_face_other(), and store_spell_expiry().
object_split(ob,nr) splits up ob into two parts.
The part which is returned contains nr objects, and the remaining parts contains the rest (or is removed and freed if that number is 0). On failure, NULL is returned, and the reason LOG()ed.
This function will send an update to the client if the remaining object is in a player inventory.
orig_ob | object from which to split. |
nr | number of elements to split. |
err | buffer that will contain failure reason if NULL is returned. Can be NULL. |
size | err's size |
Definition at line 2637 of file object.cpp.
References FLAG_REMOVED, FREE_OBJ_FREE_INVENTORY, llevDebug, LOG(), MAX, object::name, object::nrof, NROF(), object_create_clone(), object_decrease_nrof(), object_free(), object_remove(), and QUERY_FLAG.
Referenced by animate_weapon(), apply_container(), apply_special(), cfapi_object_split(), do_harvest(), do_throw(), drop_object(), fire_bow(), identify_object_with_skill(), improve_armour(), lamp_type_apply(), lighter_type_apply(), loot_object(), monster_check_pickup(), pick_up_object(), and put_object_in_sack().
void object_sub_weight | ( | object * | op, |
signed long | weight | ||
) |
Recursively (outwards) subtracts a number from the weight of an object (and what is carried by it's environment(s)).
Takes into account the container's weight reduction.
op | object to which weight is substracted. |
weight | weight to remove. |
Definition at line 1807 of file object.cpp.
References object::carrying, CONTAINER, object::env, object::stats, living::Str, object::type, and weight.
Referenced by make_item_from_recipe(), object_decrease_nrof(), object_increase_nrof(), and object_remove().
signed long object_sum_weight | ( | object * | op | ) |
object_sum_weight() is a recursive function which calculates the weight an object is carrying.
It goes through in figures out how much containers are carrying, and sums it up.
This takes into account the container's weight reduction.
op | object we want the weight of. |
Definition at line 568 of file object.cpp.
References object::carrying, CONTAINER, FOR_INV_FINISH, FOR_INV_PREPARE, NROF(), object_sum_weight(), object::stats, living::Str, and object::type.
Referenced by cfapi_object_set_property(), check_login(), command_fix_me(), fix_weight(), load_objects(), object_sum_weight(), and transport_type_apply().
void object_unset_flag_inv | ( | object * | op, |
int | flag | ||
) |
Desactivate recursively a flag on an object inventory.
op | object to recurse. Can have an empty inventory. |
flag | flag to unset. |
Definition at line 3256 of file object.cpp.
References object::below, CLEAR_FLAG, object::inv, and object_unset_flag_inv().
Referenced by do_item_conversion(), generate_monster_inv(), move_creator(), and object_unset_flag_inv().
void object_update | ( | object * | op, |
int | action | ||
) |
object_update() updates the array which represents the map.
It takes into account invisible objects (and represent squares covered by invisible objects by whatever is below them (unless it's another invisible object, etc...)
If the object being updated is beneath a player, the look-window of that player is updated (this might be a suboptimal way of updating that window, though, since object_update() is called often)
op | object to update |
action | Hint of what the caller believes need to be done. One of UP_OBJ_xxx values. For example, if the only thing that has changed is the face (due to an animation), we don't need to call update_position until that actually comes into view of a player. OTOH, many other things, like addition/removal of walls or living creatures may need us to update the flags now. |
Definition at line 1434 of file object.cpp.
References object::contr, object::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, mapstruct::in_memory, llevDebug, llevError, LOG(), object::map, MAP_HEIGHT, MAP_SAVING, MAP_WIDTH, object::more, object::move_allow, object::move_block, object::move_off, object::move_on, object::move_slow, object_update(), 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, player::socket, object::type, UP_OBJ_CHANGE, UP_OBJ_FACE, UP_OBJ_INSERT, UP_OBJ_REMOVE, UPD_FACE, socket_struct::update_look, update_position(), object::x, and object::y.
Referenced by animate_object(), animate_trigger(), animate_turning(), apply_race_and_class(), cast_invisible(), cf_handle_type_apply(), cfapi_object_set_property(), cfapi_object_update(), check_trigger(), command_invisible(), common_trap_type_process(), do_skill_attack(), fix_stopped_arrow(), gate_type_process(), hide(), hit_map(), identify(), key_change_class(), make_visible(), move_hole(), object_insert_in_map(), object_remove(), object_update(), pets_move_golem(), tear_down_wall(), trapdoor_type_move_on(), trigger_connected(), trigger_type_process(), unblock_exits(), and update_button().
void object_update_speed | ( | object * | op | ) |
Updates the speed of an object.
If the speed changes from 0 to another value, or vice versa, then add/remove the object from the active list. This function needs to be called whenever the speed of an object changes.
op | object to update. Must not be freed and still have a speed. |
Definition at line 1349 of file object.cpp.
References object::active_next, active_objects, object::active_prev, FABS, FLAG_FREED, llevError, LOG(), MIN_ACTIVE_SPEED, object::name, object_remove_from_active_list(), QUERY_FLAG, and object::speed.
Referenced by add_abilities(), add_force(), animate_weapon(), apply_auto_fix(), apply_savebed(), cast_detection(), cast_word_of_recall(), cfapi_object_set_property(), check_loaded_object(), check_login(), check_trigger(), command_remove(), do_auto_apply(), do_mood_floor(), do_throw(), drain_wand_charge(), eat_special_food(), enter_exit(), find_or_create_connection_for_map(), fire_bow(), fix_object(), fix_stopped_arrow(), gate_type_process(), kill_object(), move_cone(), move_detector(), move_hole(), move_player_mover(), object_copy(), object_free(), place_fountain_with_specials(), power_crystal_type_apply(), process_events(), recharge(), remove_door(), remove_locked_door(), swap_random_stats(), timed_gate_type_process(), transmute_item_to_flower(), trigger_connected(), trigger_move(), and while().
void object_update_turn_face | ( | object * | op | ) |
If an object with the IS_TURNABLE() flag needs to be turned due to the closest player being on the other side, this function can be called to update the face variable, and how it looks on the map.
op | object to update. |
Definition at line 1332 of file object.cpp.
References animate_object(), object::animation, object::direction, FLAG_IS_TURNABLE, and QUERY_FLAG.
Referenced by animate_bomb(), common_process_projectile(), director_type_move_on(), do_throw(), fire_arch_from_position(), fire_bolt(), fire_bow(), forklightning(), move_bolt(), move_bullet(), move_missile(), and spinner_type_move_on().
bool object_value_set | ( | const object * | op, |
const char *const | key | ||
) |
Determine if an extra value is set.
Wrapper around object_get_value(), but also recognizes empty string and "0".
Definition at line 4376 of file object.cpp.
References object_get_value().
Referenced by attack_ob_simple(), do_harvest(), generate_monster(), matches_sacrifice(), monster_check_enemy(), monster_find_enemy(), mood_change(), singing(), turn_transport(), and use_oratory().
Determine if an extra value is set to a non empty or 0 value.
op | object which may contain the value. |
key | value to search for, must be a shared string. |
Definition at line 4390 of file object.cpp.
References object::key_values, and key_value::next.
Referenced by update_position().
Checks whether 2 objects are on the same map or not.
Note we only look one map out to keep the processing simple and efficient. This could probably be a macro. MSW 2001-08-05
op1 | first object. |
op2 | second object. |
Definition at line 2611 of file map.cpp.
References adjacent_map(), and object::map.
Referenced by abort_attack(), adj_attackroll(), cfapi_object_on_same_map(), get_attack_mode(), monster_check_enemy(), monster_find_enemy(), monster_move(), move_ball_spell(), pets_attempt_follow(), pets_get_enemy(), pets_move(), and share_exp().
Checks if sacrifice was accepted and removes sacrificed objects.
Might be better to call check_altar_sacrifice (above) than depend on the return value, since operate_altar will remove the sacrifice also.
If this function returns 1, '*sacrifice' is modified to point to the remaining sacrifice, or is set to NULL if the sacrifice was used up.
altar | item to which there is a sacrifice |
sacrifice | object that may be sacrifed |
Definition at line 463 of file button.cpp.
References check_altar_sacrifice(), ext_info_map(), llevError, LOG(), object::map, object::msg, MSG_TYPE_DIALOG, MSG_TYPE_DIALOG_ALTAR, NDI_BLACK, object_decrease_nrof(), object::slaying, and object::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 | ||
) |
Return 1 if coordinates X and Y are out of the map M, taking into account tiling.
m | map to consider. Must not be NULL. |
x | |
y | coordinates. |
Definition at line 2306 of file map.cpp.
References get_map_from_coord(), and m.
Referenced by animate_bomb(), cfapi_map_out_of_map(), command_create(), enter_map(), esrv_draw_look(), explode_bullet(), look_at(), move_player_attack(), move_teleporter(), object_insert_in_map(), and object_teleport().
char* path_combine | ( | const char * | src, |
const char * | dst, | ||
char * | path, | ||
size_t | size | ||
) |
Combines 2 paths, which can be relative.
src | path we're starting from. |
dst | path we're doing to. |
path | buffer containing the combined path. |
size | size of path. |
char* path_combine_and_normalize | ( | const char * | src, |
const char * | dst, | ||
char * | path, | ||
size_t | size | ||
) |
void path_normalize | ( | char * | path | ) |
const char* player_get_own_title | ( | const struct player * | pl | ) |
Returns the player's own title.
The returned value must not be modified and points into the player structure.
pl | the player |
Definition at line 260 of file player.cpp.
References player::own_title.
Referenced by save_player().
void player_get_title | ( | const struct player * | pl, |
char * | buf, | ||
size_t | bufsize | ||
) |
int player_has_own_title | ( | const struct player * | pl | ) |
Returns whether the player has a custom title.
pl | the player to check |
Definition at line 247 of file player.cpp.
References player::own_title.
Referenced by command_title(), and save_player().
For the new exp system.
we are concerned with whether the player gets more hp, sp and new levels. Note this this function should only be called for players. Monsters don't really gain levels
Will tell the player about changed levels. A single call will handle mutiple level changes to one object from one effect. The only difference between this and the recursive version is this cannot handle a level that both increases and decreases simultaneously.
who | player, must not be NULL. |
op | what we are checking to gain the level (eg, skill), can be NULL. |
Definition at line 1830 of file living.cpp.
References buf, object::contr, die_roll(), dragon_level_gain(), draw_ext_info, living::exp, object::expmul, fix_object(), is_dragon_pl(), object::level, level_exp(), player::levgrace, player::levhp, player::levsp, MAX_BUF, Settings::max_level, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_LEVEL_GAIN, MSG_TYPE_ATTRIBUTE_LEVEL_LOSS, object::name, NDI_RED, NDI_UNIQUE, PLAYER, PREFER_HIGH, settings, object::stats, and object::type.
Referenced by add_player_exp(), apply_death_exp_penalty(), command_addexp(), and subtract_player_exp().
void player_set_dragon_title | ( | player * | pl, |
int | level, | ||
const char * | attack, | ||
int | skin_resist | ||
) |
Updates the title of a dragon player to reflect the current level, attack type, and resistances.
pl | the player to update |
level | the dragon's current level |
attack | the dragon's current attack focus |
skin_resist | the dragon's skin resistance for attack |
Definition at line 202 of file player.cpp.
References level, player::own_title, and player::title.
Referenced by set_dragon_name().
void player_set_own_title | ( | struct player * | pl, |
const char * | title | ||
) |
Sets the custom title.
pl | the player to modify |
title | the new title to set; empty string to unset |
Definition at line 272 of file player.cpp.
References player::own_title, replace_unprintable_chars(), and strlcpy().
Referenced by cfapi_object_set_property(), check_login(), command_title(), key_confirm_quit(), and kill_player_permadeath().
void print_los | ( | object * | op | ) |
Debug-routine which dumps the array which specifies the visible area of a player.
Triggered by the DM command printlos.
op | DM asking for information. |
Definition at line 665 of file los.cpp.
References player::blocked_los, buf, object::contr, draw_ext_info, LOS_BLOCKED, MAP_CLIENT_X, socket_struct::mapx, socket_struct::mapy, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DEBUG, NDI_UNIQUE, and player::socket.
Referenced by command_printlos().
void print_monsters | ( | void | ) |
As dump_abilities(), but with an alternative way of output.
Definition at line 87 of file info.cpp.
References living::ac, object::arch, arch_to_object(), AssetsManager::archetypes(), object::attacktype, attacktype_desc, bitstostring(), living::dam, AssetsCollection< T, Key >::each(), living::exp, FLAG_MONSTER, FMT64, getManager(), living::maxhp, archetype::name, new_exp(), NROFATTACKS, object_free_drop_inventory(), QUERY_FLAG, object::resist, resist_plus, object::stats, and living::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 149 of file button.cpp.
References get_button_links(), trigger_connected(), and object::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 689 of file item.cpp.
References AMULET, buf, FLAG_BEEN_APPLIED, FLAG_IDENTIFIED, object::inv, is_identified(), is_magical(), object::level, object::magic, object::name, object::name_pl, object::nrof, QUERY_FLAG, RING, ring_desc(), ROD, safe_strcat(), SCROLL, SKILL, SPELLBOOK, stringbuffer_finish(), strlcpy(), object::title, object::type, WAND, and object::weight.
Referenced by add_object_to_socklist(), add_shop_item(), cfapi_object_get_property(), command_rename_item(), esrv_update_item(), fire_misc_object(), matches_sacrifice(), object_matches_string(), rangetostring(), send_updated_shoottype(), and use_alchemy().
void query_name | ( | const object * | op, |
char * | buf, | ||
size_t | size | ||
) |
Describes an item.
op | item to describe. Must not be NULL. |
buf | buffer that will contain the description. |
size | size of buffer. |
Definition at line 588 of file item.cpp.
References AMULET, ARMOUR, BOOK, BOOTS, BOW, BRACERS, buf, CLOAK, CONTAINER, object::container, object::env, FLAG_APPLIED, FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_INV_LOCKED, FLAG_KNOWN_BLESSED, FLAG_KNOWN_CURSED, FLAG_KNOWN_MAGICAL, FLAG_NO_SKILL_IDENT, FLAG_UNPAID, GIRDLE, GLOVES, HELMET, QUERY_FLAG, query_short_name(), RING, ROD, safe_strcat(), SHIELD, SKILL, object::type, WAND, and WEAPON.
Referenced by animate_weapon(), apply_builder_item(), apply_builder_remove(), apply_by_living(), apply_check_apply_restrictions(), apply_check_race_restrictions(), apply_container(), apply_special(), apply_update_ranged_skill(), attack_hth(), attempt_jump(), attempt_steal(), blind_living(), cast_smite_spell(), cast_spell(), cfapi_object_find_archetype_inside(), cfapi_object_forget_spell(), cfapi_object_get_property(), command_insert_into(), command_mark(), command_remove(), common_ob_describe(), converter_type_move_on(), do_skill(), do_skill_attack(), do_throw(), drop_object(), empty_container(), exit_type_apply(), find_key(), find_player_options(), find_throw_ob(), god_examines_item(), hit_with_one_attacktype(), inventory(), kill_object(), knowledge_alchemy_detail(), lamp_type_describe(), leave(), legacy_ob_describe(), look_at(), make_formula_book(), mark_item_cmd(), mimic_type_apply(), monster_can_detect_enemy(), monster_find_throw_ob(), monster_format_say(), object_matches_string(), pick_up_object(), polymorph_melt(), power_crystal_describe(), power_crystal_type_apply(), put_object_in_sack(), recharge(), recursive_roll(), sack_can_hold(), save_life(), save_throw_object(), sell_item(), send_updated_shoottype(), shop_pay_unpaid_callback(), singing(), skillscroll_type_apply(), spellbook_type_apply(), spellbook_type_describe(), transport_type_apply(), treasure_type_apply(), unapply_for_ob(), unapply_special(), use_oratory(), and write_scroll().
void query_short_name | ( | const object * | op, |
char * | buf, | ||
size_t | size | ||
) |
query_short_name(object) is similar to query_name(), but doesn't contain any information about object status (worn/cursed/etc.)
op | object to describe. |
buf | buffer which will contain the name. Must not be NULL. |
size | buffer length. |
Definition at line 513 of file item.cpp.
References AMULET, buf, FLAG_BEEN_APPLIED, FLAG_IDENTIFIED, object::inv, is_identified(), is_magical(), object::level, object::magic, object::name, object::name_pl, object::nrof, QUERY_FLAG, RING, ring_desc(), ROD, safe_strcat(), SCROLL, SKILL, SPELLBOOK, stringbuffer_finish(), strlcpy(), object::title, object::type, WAND, and object::weight.
Referenced by cast_item_curse_or_bless(), cfapi_object_get_property(), command_lock_item(), dragon_ability_gain(), follower_remove_given_items(), god_gives_present(), lock_item_cmd(), object_matches_string(), player_attack_door(), query_name(), remove_force(), spellbook_type_apply(), transmute_item_to_flower(), and write_note().
void query_weight | ( | const object * | op, |
char * | buf, | ||
size_t | size | ||
) |
Formats the item's weight.
op | object we want the weight of. | |
[out] | buf | buffer to write to. |
size | buffer size. |
Definition at line 415 of file item.cpp.
References buf, object::carrying, NROF(), and object::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 42 of file utils.cpp.
References llevError, LOG(), living::luck, MAX, MIN, PLAYER, RANDOM, object::stats, and object::type.
Referenced by alchemy_failure_effect(), apply_check_personalized_blessings(), attack_ob_simple(), attempt_do_alchemy(), attempt_steal(), become_follower(), cast_detection(), cast_heal(), cast_smite_spell(), cast_spell(), charge_mana_effect(), cure_disease(), deathstrike_living(), did_make_save(), do_harvest(), do_hidden_move(), do_symptoms(), flee_player(), gate_type_process(), god_examines_priest(), god_intervention(), hit_with_drain(), hit_with_one_attacktype(), infect_object(), kill_player_not_permadeath(), learn_skill(), mood_change(), pets_summon_object(), potion_type_apply(), pray_at_altar(), push_ob(), recharge(), roll_ob(), scroll_failure(), singing(), slow_living(), spellbook_type_apply(), trap_disarm(), trap_see(), try_leave_cult(), use_oratory(), and write_scroll().
int64_t random_roll64 | ( | int64_t | min, |
int64_t | max, | ||
const object * | op, | ||
int | goodbad | ||
) |
This is a 64 bit version of random_roll() above.
This is needed for exp loss calculations for players changing religions.
Definition at line 77 of file utils.cpp.
References FMT64, llevError, LOG(), living::luck, MAX, MIN, PLAYER, RANDOM, object::stats, and object::type.
Referenced by try_leave_cult().
const char* re_cmp | ( | const char * | str, |
const char * | regexp | ||
) |
re-cmp - get regular expression match.
str | string that will be matched against the regexp. |
regexp | regular expression. |
Definition at line 68 of file re-cmp.cpp.
References Boolean, False, re_cmp(), re_cmp_step(), re_get_token(), re_init(), re_init_done, re_match_token(), re_substr, re_token, re_token_depth, rep_null_or_more, rep_null_or_once, rep_once, rep_once_or_more, and True.
Referenced by cfapi_system_re_cmp(), matches(), and re_cmp().
mapstruct* ready_map_name | ( | const char * | name, |
int | flags | ||
) |
Makes sure the given map is loaded and swapped in.
name | path name of the map. |
flags |
|
Definition at line 1780 of file map.cpp.
References buf, clean_tmp_map(), decay_objects(), delete_map(), EVENT_MAPREADY, events_execute_global_event(), flags, has_been_loaded(), load_overlay_map(), load_temporary_map(), load_unique_objects(), Settings::localdir, m, MAP_FLUSH, MAP_IN_MEMORY, MAP_LOADING, MAP_OVERLAY, MAP_PLAYER_UNIQUE, map_reset_swap(), mapfile_load(), MAX_BUF, name, Settings::playerdir, seconds(), set_darkness_map(), and settings.
Referenced by cast_create_town_portal(), cfapi_map_get_map(), enter_exit(), enter_fixed_template_map(), enter_player_maplevel(), enter_random_template_map(), enter_unique_map(), init_dynamic(), is_legal_2ways_exit(), load_and_link_tiled_map(), place_exits(), process_map(), and town_portal_destroy_existing().
const char* recipe_get_difficulty_string | ( | int | difficulty | ) |
A method to produce a difficulty adjective to describe alchemy projects.
difficulty | the base difficulty of the recipe |
Definition at line 962 of file recipe.cpp.
Referenced by knowledge_alchemy_detail(), and make_formula_book().
Return the best face associated with a recipe.
rp | recipe to get the face of. |
Definition at line 920 of file recipe.cpp.
References recipe::arch_name, recipe::arch_names, arch_to_object(), blank_face, archetype::clone, face(), object::face, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, give_artifact_abilities(), artifact::item, locate_recipe_artifact(), object_free(), object_give_identified_properties(), recipe::title, and try_find_archetype().
Referenced by knowledge_alchemy_face().
Checks if a region is a child of another.
child | region we want to test. |
r | potential parent. |
Definition at line 182 of file region.cpp.
References region::name, region::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 62 of file ob_types.cpp.
References ob_methods::apply, and type_methods.
Referenced by init_type_armour_improver(), init_type_book(), init_type_cf_handle(), init_type_clock(), init_type_converter(), init_type_dragon_focus(), init_type_exit(), init_type_food(), init_type_lamp(), init_type_lightable(), init_type_lighter(), init_type_mimic(), init_type_poison(), init_type_potion(), init_type_power_crystal(), init_type_savebed(), init_type_scroll(), init_type_shop_inventory(), init_type_sign(), init_type_skillscroll(), init_type_spellbook(), init_type_transport(), init_type_treasure(), init_type_trigger(), and init_type_weapon_improver().
void register_describe | ( | int | ob_type, |
describe_func | method | ||
) |
Registers the describe method for the given type.
ob_type | The type of object to register this method to |
method | The method to link |
Definition at line 80 of file ob_types.cpp.
References ob_methods::describe, and type_methods.
Referenced by init_type_lamp(), init_type_power_crystal(), and init_type_spellbook().
void register_move_on | ( | int | ob_type, |
move_on_func | method | ||
) |
Registers the move_on method for the given type.
ob_type | The type of object to register this method to |
method | The method to link |
Definition at line 89 of file ob_types.cpp.
References ob_methods::move_on, and type_methods.
Referenced by init_type_altar(), init_type_arrow(), init_type_button(), init_type_check_inv(), init_type_container(), init_type_converter(), init_type_deep_swamp(), init_type_director(), init_type_exit(), init_type_hole(), init_type_identify_altar(), init_type_pedestal(), init_type_player_mover(), init_type_rune(), init_type_shop_mat(), init_type_sign(), init_type_spell_effect(), init_type_spinner(), init_type_thrown_object(), init_type_trap(), init_type_trapdoor(), init_type_trigger_altar(), init_type_trigger_button(), and init_type_trigger_pedestal().
void register_process | ( | int | ob_type, |
process_func | method | ||
) |
Registers the process method for the given type.
ob_type | The type of object to register this method to |
method | The method to link |
Definition at line 71 of file ob_types.cpp.
References ob_methods::process, and type_methods.
Referenced by init_type_arrow(), init_type_blindness(), init_type_creator(), init_type_deep_swamp(), init_type_detector(), init_type_director(), init_type_gate(), init_type_marker(), init_type_mood_floor(), init_type_peacemaker(), init_type_player_changer(), init_type_poisoning(), init_type_rune(), init_type_spell_effect(), init_type_teleporter(), init_type_thrown_object(), init_type_transport(), init_type_trap(), and init_type_trigger().
void register_trigger | ( | int | ob_type, |
trigger_func | method | ||
) |
Registers the trigger method for the given type.
ob_type | The type of object to register this method to |
method | The method to link |
Definition at line 98 of file ob_types.cpp.
References ob_methods::trigger, and type_methods.
Referenced by init_type_creator(), init_type_duplicator(), init_type_marker(), init_type_mood_floor(), and init_type_teleporter().
void remove_button_link | ( | object * | op | ) |
Remove the object from the linked lists of buttons in the map.
This is only needed by editors.
op | object to remove. Must be on a map, and linked. |
Definition at line 693 of file button.cpp.
References mapstruct::buttons, CLEAR_FLAG, FLAG_IS_LINKED, oblinkpt::link, llevError, LOG(), object::map, objectlink::next, oblinkpt::next, objectlink::ob, and QUERY_FLAG.
Referenced by apply_builder_remove(), clean_object(), and delete_unique_items().
int remove_depletion | ( | object * | op, |
int | level | ||
) |
Remove depletion from op, if present, and warn player of such restorations.
op | who to remove depletion from. |
level | maximum depletion level to remove, if -1 no maximum. |
Definition at line 755 of file living.cpp.
References ARCH_DEPLETION, arch_present_in_ob(), draw_ext_info, find_archetype(), fix_object(), get_attr_value(), level, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END, NDI_UNIQUE, NUM_STATS, object_free_drop_inventory(), object_remove(), restore_msg, and object::stats.
Referenced by cfapi_object_remove_depletion(), god_intervention(), and potion_type_apply().
void remove_directory | ( | const char * | path | ) |
This function removes everything in the directory, and the directory itself.
Errors are LOG() to error level.
path | directory to remove. |
Definition at line 117 of file porting.cpp.
References buf, closedir(), llevError, LOG(), opendir(), path(), readdir(), and remove_directory().
Referenced by delete_character(), and remove_directory().
void remove_friendly_object | ( | object * | op | ) |
Removes the specified object from the linked list of friendly objects.
op | object to remove from list. |
Definition at line 52 of file friend.cpp.
References CLEAR_FLAG, object::count, FLAG_FRIENDLY, friends, llevError, LOG(), and object::name.
Referenced by cfapi_object_set_property(), change_object(), command_cast_spell(), command_kill_pets(), do_mood_floor(), enter_map(), hit_player(), kill_object(), kill_player_permadeath(), monster_move(), mood_change(), object_clear(), object_free(), pets_attempt_follow(), pets_get_enemy(), pets_move(), pets_move_golem(), pets_terminate_all(), polymorph_living(), receive_play_again(), and use_oratory().
void remove_statbonus | ( | object * | op | ) |
Subtracts stat-bonuses given by the class which the player has chosen.
op | object which must be a player with contr not NULL. |
Definition at line 845 of file living.cpp.
References object::arch, living::Cha, archetype::clone, living::Con, object::contr, living::Dex, living::Int, player::orig_stats, living::Pow, object::stats, living::Str, and living::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 327 of file utils.cpp.
References strlcpy().
Referenced by compilePython(), enter_fixed_template_map(), and enter_random_template_map().
void replace_unprintable_chars | ( | char * | buf | ) |
Replaces any unprintable character in the given buffer with a space.
buf | the buffer to modify |
Definition at line 447 of file utils.cpp.
References buf.
Referenced by party_form(), party_set_password(), and player_set_own_title().
void reset_sleep | ( | void | ) |
Initialise all variables used in the timing routines.
Definition at line 134 of file time.cpp.
References game_time, PBUFLEN, process_max_utime, process_min_utime, process_tot_mtime, process_utime_save, psaveind, and pticks.
Referenced by command_speed(), and init().
int rndm | ( | int | min, |
int | max | ||
) |
Returns a number between min and max.
It is suggested one use these functions rather than RANDOM()%, as it would appear that a number of off-by-one-errors exist due to improper use of %. This should also prevent SIGFPE.
Definition at line 162 of file utils.cpp.
References RANDOM.
Referenced by adjust_dir(), adjust_product(), alchemy_failure_effect(), alchemy_object(), apply_changes_to_player(), attack_message(), attack_ob_simple(), cancellation(), cast_change_ability(), cast_spell(), cast_wonder(), cauldron_sound(), check_spell_knockback(), choose_cult_monster(), command_cointoss(), common_process_projectile(), common_trap_type_process(), compute_price_variation_with_bargaining(), counterspell(), decay_objects(), deep_swamp_type_process(), determine_holy_arch(), did_make_save_item(), do_harvest(), do_item_conversion(), find_recipe(), fix_generated_item(), fix_stopped_arrow(), forklightning(), generate_monster(), generate_monster_arch(), generate_monster_inv(), get_random_dir(), hit_player(), hit_with_one_attacktype(), identify_object_with_skill(), level_for_item(), move_ball_spell(), move_bolt(), move_creator(), move_swarm_spell(), peacemaker_type_process(), place_monsters(), polymorph(), polymorph_item(), polymorph_living(), races_get_random_monster(), reflwall(), resurrection_fails(), save_throw_object(), scroll_type_apply(), shuffle_attack(), spellbook_type_apply(), swap_map(), swap_random_stats(), transmute_item_to_flower(), and trap_adjust().
int save_map | ( | mapstruct * | m, |
int | flag | ||
) |
Saves a map to file.
If flag is SAVE_MODE_INPLACE, it is saved into the same file it was (originally) loaded from. Otherwise a temporary filename will be genarated, and the file will be stored there. The temporary filename will be stored in the mapstructure. If the map is unique, we also save to the filename in the map (this should have been updated when first loaded)
m | map to save. |
flag | One of SAVE_MODE_xxx values. |
Definition at line 1407 of file map.cpp.
References create_items_path(), create_overlay_pathname(), create_pathname(), FMT64U, free_all_objects(), llevDebug, llevError, Settings::localdir, LOG(), m, make_path_to_file(), MAP_IN_MEMORY, MAP_SAVING, maps_saved_total, MAX_BUF, name, of_cancel(), of_close(), of_open(), Settings::playerdir, print_shop_string(), PROFILE_BEGIN, PROFILE_END, SAVE_ERROR_CLOSE, SAVE_ERROR_NO_PATH, SAVE_ERROR_OK, SAVE_ERROR_RCREATION, SAVE_ERROR_UCREATION, SAVE_ERROR_URENAME, SAVE_FLAG_NO_REMOVE, SAVE_MODE, SAVE_MODE_NORMAL, SAVE_MODE_OVERLAY, save_objects(), settings, strlcpy(), and Settings::tmpdir.
Referenced by clean_tmp_files(), command_overlay_save(), generate_map(), and swap_map().
int save_object | ( | FILE * | fp, |
object * | op, | ||
int | flag | ||
) |
Dumps all variables in an object to a file.
fp | file to write to. |
op | object to save. |
flag | combination of SAVE_FLAG_xxx flags. |
Definition at line 5397 of file object.cpp.
References SAVE_ERROR_OK, SAVE_ERROR_WRITE, save_object_in_sb(), stringbuffer_finish(), and stringbuffer_new().
Referenced by save_player().
void save_object_in_sb | ( | StringBuffer * | sb, |
object * | op, | ||
const int | flag | ||
) |
Store a string representation of op in sb.
Suitable for saving an object to a file.
Definition at line 5311 of file object.cpp.
References ADD_STRINGLINE_ENTRY(), object::arch, arch_to_object(), artifact, object::artifact, archetype::clone, empty_archetype, FAST_SAVE_LONG(), find_archetype(), find_artifact(), FLAG_NO_SAVE, FLAG_UNPAID, FOR_INV_FINISH, FOR_INV_PREPARE, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, get_ob_diff(), give_artifact_abilities(), living::grace, living::hp, artifact::item, llevError, LOG(), archetype::name, object_free(), object_get_owner(), QUERY_FLAG, archetype::reference_count, SAVE_FLAG_SAVE_UNPAID, save_object_in_sb(), living::sp, object::stats, stringbuffer_append_string(), object::type, object::x, and object::y.
Referenced by save_object(), save_object_in_sb(), and save_objects().
long seconds | ( | void | ) |
Return wall clock time in seconds.
Definition at line 348 of file time.cpp.
Referenced by cftimer_create(), cftimer_process_timers(), command_statistics(), flush_old_maps(), generate_random_map(), map_info(), metaserver2_thread(), read_map_log(), ready_map_name(), set_map_reset_time(), swap_map(), and tick_length().
void set_abs_magic | ( | object * | op, |
int | magic | ||
) |
Sets magical bonus in an object, and recalculates the effect on the armour variable, and the effect on speed of armour.
This function doesn't work properly, should add use of archetypes to make it truly absolute.
Patched to utilize settings values for the speed/weight adjustments, rather than hardcoded ones. Neila Hawkins 2021-01-19
op | object we're modifying. |
magic | magic modifier. |
Definition at line 618 of file treasure.cpp.
References object::arch, Settings::armor_speed_improvement, Settings::armor_speed_linear, Settings::armor_weight_linear, Settings::armor_weight_reduction, ARMOUR, ARMOUR_SPEED, archetype::clone, object::magic, RANDOM, settings, object::type, and object::weight.
Referenced by add_abilities(), command_create(), improve_armour(), and set_magic().
void set_attr_value | ( | living * | stats, |
int | attr, | ||
int8_t | value | ||
) |
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW).
stats | item to modify. Must not be NULL. |
attr | attribute to change. |
value | new value. |
Definition at line 218 of file living.cpp.
References CHARISMA, CONSTITUTION, DEXTERITY, INTELLIGENCE, POWER, stats, STRENGTH, and WISDOM.
Referenced by apply_changes_to_player(), apply_race_and_class(), cast_change_ability(), change_abil(), check_race_and_class(), check_stat_bounds(), create_player_cmd(), do_symptoms(), eat_special_food(), fix_object(), set_ring_bonus(), swap_random_stats(), and swap_stat().
Set the new dragon name after gaining levels or changing ability focus (later this can be extended to eventually change the player's face and animation)
Note that the title is written to 'own_title' in the player struct. This should be changed to 'ext_title' as soon as clients support this! Please, anyone, write support for 'ext_title'.
pl | player's object to change. |
abil | dragon's innate abilities. |
skin | dragon's skin. |
Definition at line 1688 of file living.cpp.
References atnr_is_dragon_enabled(), attacks, object::contr, living::exp, level, NROFATTACKS, player_set_dragon_title(), object::resist, and object::stats.
Referenced by check_login(), and dragon_level_gain().
void set_map_reset_time | ( | mapstruct * | map | ) |
Updates the map's timeout.
map | map to update. |
Definition at line 2245 of file map.cpp.
References MAP_DEFAULTRESET, MAP_MAXRESET, MAP_RESET_TIMEOUT, MAP_WHEN_RESET, and seconds().
Referenced by map_info(), mapfile_load(), and swap_map().
void set_materialname | ( | object * | op | ) |
Set the material name and type for an item, if not set.
op | item to set the material for. |
Definition at line 297 of file utils.cpp.
References add_string(), object::material, object::materialname, and materials.
Referenced by check_loaded_object(), fix_generated_item(), and object_get_materialtype().
void set_tick_duration | ( | long | t | ) |
Sets the tick duration.
Can be called by a DM through the speed command.
t | new duration. |
Definition at line 209 of file time.cpp.
References t, and tick_duration.
Referenced by command_speed().
int set_variable | ( | object * | op, |
const char * | buf | ||
) |
This takes a buffer, scans it for variables, and sets those variables as appropriate in op.
This function appears to be used in only 2 places - in crossedit to override values and in c_wiz to mutate values.
op | object to alter. |
buf | modifications to apply. |
Definition at line 39047 of file loader.cpp.
References buf, INITIAL, lorebuf, MAXDEPTH, msgbuf, msglen, total_msglen, YY_CURRENT_BUFFER, yy_delete_buffer(), yy_pop_state(), yy_push_state(), yy_scan_string(), and yy_switch_to_buffer().
Referenced by command_create(), command_patch(), and Archetypes::recursive_update().
void share_exp | ( | object * | op, |
int64_t | exp, | ||
const char * | skill, | ||
int | flag | ||
) |
Gives experience to a player/monster, sharing it with party if applicable.
This does bounds checking to make sure we don't overflow the max exp.
The exp passed is typically not modified much by this function - it is assumed the caller has modified the exp as needed.
This is merely a wrapper for change_exp().
op | victim to alter. |
exp | experience to gain (positive) or lose (negative). |
skill | skill to change. Can be NULL. |
flag |
|
Definition at line 2323 of file living.cpp.
References change_exp(), object::contr, first_player, given, object::level, player::next, player::ob, on_same_map(), player::party, PLAYER, SK_EXP_TOTAL, skill, and object::type.
Referenced by kill_object(), and mood_change().
size_t split_string | ( | char * | str, |
char * | array[], | ||
size_t | array_size, | ||
char | sep | ||
) |
Splits a string delimited by passed in sep value into characters into an array of strings.
str | the string to be split; will be modified |
array | the string array; will be filled with pointers into str |
array_size | the number of elements in array; if str contains more fields excess fields are not split but included into the last element |
sep | separator to use. |
array_size
Definition at line 473 of file utils.cpp.
Referenced by account_char_load_from_file(), accounts_load(), assets_pack(), get_score(), FacesetLoader::load(), PngLoader::load(), load_bells(), load_citylife(), map_info(), read_map_log(), and spell_consume_items().
void stringbuffer_append_multiline_block | ( | StringBuffer * | sb, |
const char * | start, | ||
const char * | content, | ||
const char * | end | ||
) |
Definition at line 196 of file stringbuffer.cpp.
void stringbuffer_append_printf | ( | StringBuffer * | sb, |
const char * | format, | ||
... | |||
) |
Definition at line 138 of file stringbuffer.cpp.
void stringbuffer_append_string | ( | StringBuffer * | sb, |
const char * | str | ||
) |
Definition at line 95 of file stringbuffer.cpp.
void stringbuffer_append_stringbuffer | ( | StringBuffer * | sb, |
const StringBuffer * | sb2 | ||
) |
Definition at line 165 of file stringbuffer.cpp.
void stringbuffer_delete | ( | StringBuffer * | sb | ) |
Definition at line 71 of file stringbuffer.cpp.
char* stringbuffer_finish | ( | StringBuffer * | sb | ) |
Definition at line 76 of file stringbuffer.cpp.
sstring stringbuffer_finish_shared | ( | StringBuffer * | sb | ) |
Definition at line 85 of file stringbuffer.cpp.
size_t stringbuffer_length | ( | StringBuffer * | sb | ) |
Definition at line 218 of file stringbuffer.cpp.
StringBuffer* stringbuffer_new | ( | void | ) |
Definition at line 57 of file stringbuffer.cpp.
void strip_endline | ( | char * | buf | ) |
Removes endline from buffer (modified in place).
Definition at line 314 of file utils.cpp.
Referenced by parse_shop_string(), and send_news().
int strtoint | ( | const char * | buf | ) |
Convert buf into an integer equal to the coadded sum of the (lowercase) character.
ASCII values in buf (times prepended integers).
buf | buffer we want to convert. Can contain an initial number. |
Definition at line 709 of file recipe.cpp.
References buf, ingred_name(), numb_ingred(), and tolower.
Referenced by add_book_to_list(), content_recipe_value(), dump_alchemy(), find_title(), and init_formulae().
char* strtoktolin | ( | const char * | buf1, |
const char * | buf2, | ||
char * | retbuf, | ||
size_t | size | ||
) |
Takes a string in buf1 and separates it into a list of strings delimited by buf2.
Then returns a comma separated string w/ decent punctuation.
buf1 | buffer to split. |
buf2 | what to split buf1 by. |
retbuf | where to write the resulting string. |
size | length of retbuf. |
Definition at line 684 of file readable.cpp.
References buf, MAX_BUF, nstrtok(), strlcpy(), and trim().
Referenced by describe_god().
void tailor_readable_ob | ( | object * | book, |
int | msg_type | ||
) |
The main routine.
This chooses a random message to put in given readable object (type==BOOK) which will be referred hereafter as a 'book'. We use the book level to de- termine the value of the information we will insert. Higher values mean the book will (generally) have better/more info. See individual cases as to how this will be utilized. "Book" name/content length are based on the weight of the document. If the value of msg_type is negative, we will randomly choose the kind of message to generate. -b.t. thoma s@as tro.p su.e du
book | the object we are creating into. Must be a book, can have a level. |
msg_type | if it is a positive value, we use that to determine the message type - otherwise a random value is used. |
Definition at line 1892 of file readable.cpp.
References arraysize, artifact_msg(), BOOK, BOOK_BUF, BOOKSIZE, change_book(), god_info_msg(), object::level, level, make_formula_book(), max_titles, message, mon_info_msg(), msgfile_msg(), MSGTYPE_ALCHEMY, MSGTYPE_ARTIFACT, MSGTYPE_GODS, MSGTYPE_LIB, MSGTYPE_MONSTER, MSGTYPE_SPELLPATH, object_set_msg(), RANDOM, spellpath_msg(), stringbuffer_append_string(), stringbuffer_finish(), and object::type.
Referenced by fix_generated_item().
FILE* tempnam_secure | ( | const char * | dir, |
const char * | pfx, | ||
char ** | filename | ||
) |
A replacement for the tempnam_local() function since that one is not very secure.
This one will open the file in an atomic way on platforms where it is possible.
dir | Directory where to create the file. Can be NULL, in which case NULL is returned. |
pfx | Prefix to create unique name. Can be NULL. |
filename | This should be a pointer to a char*, the function will overwrite the char* with the name of the resulting file. Must be freed by caller. Value is unchanged if the function returns NULL. |
Definition at line 71 of file porting.cpp.
References llevError, LOG(), S_IRUSR, and S_IWUSR.
Referenced by save_player().
void tick_game_time | ( | void | ) |
Definition at line 184 of file time.cpp.
References game_time, pticks, tick_duration, and timespec_add().
Referenced by server_main().
unsigned int tick_length | ( | float | seconds | ) |
Calculate the number of ticks that correspond to real time.
Definition at line 382 of file time.cpp.
References seconds(), and tick_duration.
Referenced by connection_alive().
float ticks_to_seconds | ( | int | ticks | ) |
Definition at line 386 of file time.cpp.
References tick_duration.
Referenced by map_info().
const char* time_format_time | ( | const timeofday_t * | tod, |
char * | buf, | ||
size_t | bufsize | ||
) |
Formats a timestamp in Crossfire time.
tod | the timestamp to format |
buf | the buffer to fill |
bufsize | the size of buf in bytes |
Definition at line 369 of file time.cpp.
References buf, timeofday_t::hour, and timeofday_t::minute.
Referenced by clock_type_apply(), and print_tod().
void time_info | ( | object * | op | ) |
Players wants to know the time.
Called through the 'time' command.
op | player who requested time. |
Definition at line 298 of file time.cpp.
References draw_ext_info_format(), FLAG_WIZ, MIN, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DEBUG, NDI_UNIQUE, PBUFLEN, print_tod(), process_max_utime, process_min_utime, process_tot_mtime, process_utime_long_count, process_utime_save, pticks, QUERY_FLAG, and tick_duration.
Referenced by command_time().
long timespec_diff | ( | struct timespec * | end, |
struct timespec * | start | ||
) |
Return the difference between two timespec's in microseconds.
Definition at line 166 of file time.cpp.
Referenced by get_sleep_remaining().
When doing transmutation of objects, we have to recheck the resistances, as some that did not apply previously, may apply now.
Only works on armors.
Definition at line 263 of file utils.cpp.
References object::arch, CLOAK, GIRDLE, GLOVES, IS_ARMOR, IS_SHIELD, llevError, LOG(), object::materialname, materialtype_t::mod, object::name, archetype::name, name_to_material(), NROFATTACKS, object::resist, and object::type.
Referenced by cfapi_object_transmute(), and make_item_from_recipe().
void treasure_free | ( | treasure * | t | ) |
Frees a treasure, including its yes, no and next items.
t | treasure to free. Pointer is free()d too, so becomes invalid. |
Definition at line 1401 of file treasure.cpp.
References free_string(), t, and treasure_free().
Referenced by asset_destroy(), Treasures::replace(), treasure_free(), and treasure_remove_item().
treasure* treasure_insert | ( | treasurelist * | list, |
int | position | ||
) |
Insert a new treasure in the treasure list, at a specific position in the children list.
list | list to insert the new treasure into. |
position | if less than the number of items then before this item, else at end of list. |
Definition at line 1422 of file treasure.cpp.
References get_empty_treasure(), list, and treasure::next.
void treasure_remove_item | ( | treasurelist * | list, |
int | position | ||
) |
Remove the treasure at the specified position from the list.
list | list to remove the treasure from. |
position | index of the treasure to remove, 0-based, negative value is ignored. |
Definition at line 1445 of file treasure.cpp.
References list, treasure::next, and treasure_free().
void trigger_connected | ( | objectlink * | ol, |
object * | cause, | ||
const int | state | ||
) |
Trigger every object in an objectlink.
This was originally part of push_button but has been extracted to make it possible to trigger the connected object on a map from a plugin without requiring a source object. This method will take care of calling EVENT_TRIGGER of all elligible object in list (see state parameter)
ol | the objectlink to trigger. This can be acquire from map |
cause | the object that cause this path to trigger, may be NULL |
state | which object to apply. 0=all object with FLAG_ACTIVATE_ON_PUSH other=all object with FLAG_ACTIVATE_ON_RELEASE |
Definition at line 41 of file button.cpp.
References ALTAR, animate_turning(), object::arch, BUTTON, CF_HANDLE, archetype::clone, object::count, object::direction, DIRECTOR, EVENT_TRIGGER, events_execute_object_event(), ext_info_map(), FIREWALL, FLAG_ACTIVATE_ON_PUSH, FLAG_ACTIVATE_ON_RELEASE, FLAG_ANIMATE, FLAG_FREED, living::food, GATE, HOLE, living::hp, objectlink::id, object::last_eat, llevError, LOG(), object::map, living::maxhp, living::maxsp, object::more, move_firewall(), object::msg, MSG_SUBTYPE_NONE, MSG_TYPE_SIGN, object::name, NDI_NAVY, NDI_UNIQUE, objectlink::next, objectlink::ob, ob_trigger(), object_update(), object_update_speed(), PEDESTAL, QUERY_FLAG, SCRIPT_FIX_ALL, SET_ANIMATION, SIGN, living::sp, object::speed, object::stats, TIMED_GATE, object::type, UP_OBJ_FACE, and object::value.
Referenced by cfapi_map_trigger_connected(), and push_button().
Animations* try_find_animation | ( | const char * | name | ) |
Definition at line 277 of file assets.cpp.
References AssetsManager::animations(), AssetsCollection< T, Key >::find(), manager, and name.
Referenced by add_abilities(), apply_anim_suffix(), apply_changes_to_player(), cfapi_object_set_property(), cfapi_system_find_animation(), move_aura(), object_give_identified_properties(), and write_rune().
archetype* try_find_archetype | ( | const char * | name | ) |
Definition at line 269 of file assets.cpp.
References AssetsManager::archetypes(), AssetsCollection< T, Key >::find(), manager, and name.
Referenced by alchemy_object(), annotate_ob(), artifact_describe(), artifact_get_face(), cast_consecrate(), cast_create_missile(), cast_heal(), cfapi_map_find_by_archetype_name(), cfapi_object_create(), cfapi_object_find_archetype_inside(), check_formulae(), check_probe(), check_recipe(), command_create(), create_archetype(), create_player_cmd(), do_harvest(), dump_alchemy(), dump_alchemy_costs(), fix_walls(), get_npc(), knowledge_alchemy_can_use_item(), knowledge_alchemy_detail(), knowledge_alchemy_summary(), knowledge_god_face(), knowledge_monster_detail(), knowledge_monster_face(), knowledge_monster_summary(), knowledge_monster_validate(), magic_wall(), perceive_self(), pick_joined_wall(), place_exits(), put_a_monster(), recipe_get_face(), retrofit_joined_wall(), send_arch_info(), send_class_info(), send_race_info(), and town_portal_destroy_existing().
Definition at line 285 of file assets.cpp.
References AssetsManager::faces(), AssetsCollection< T, Key >::find(), is_valid_types_gen::found, manager, and name.
Referenced by add_abilities(), cfapi_object_set_property(), cfapi_system_find_face(), fix_flesh_item(), knowledge_process_incremental(), knowledge_send_info(), object_give_identified_properties(), send_account_players(), set_object_face_main(), set_object_face_other(), transport_type_apply(), and write_rune().
void update_all_los | ( | const mapstruct * | map, |
int | x, | ||
int | y | ||
) |
This function makes sure that update_los() will be called for all players on the given map within the next frame.
It is triggered by removal or inserting of objects which blocks the sight in the map. Modified by MSW 2001-07-12 to take a coordinate of the changed position, and to also take map tiling into account. This change means that just being on the same map is not sufficient - the space that changes must be withing your viewable area.
map | map that changed. |
x | |
y | coordinates of the change. |
Definition at line 595 of file los.cpp.
References player::do_los, first_player, object::map, MAP_HEIGHT, MAP_WIDTH, socket_struct::mapx, socket_struct::mapy, player::next, player::ob, player::socket, mapstruct::tile_map, object::x, and object::y.
Referenced by cfapi_object_set_property(), do_turn(), gate_type_process(), kill_object(), magic_wall(), object_insert_in_map(), object_insert_in_ob(), object_remove(), and tear_down_wall().
void update_all_map_los | ( | mapstruct * | map | ) |
update all_map_los is like update_all_los() below, but updates everyone on the map, no matter where they are.
This generally should not be used, as a per specific map change doesn't make much sense when tiling is considered (lowering darkness would certainly be a strange effect if done on a tile map, as it makes the distinction between maps much more obvious to the players, which is should not be. Currently, this function is called from the change_map_light function
map | map on which affected players are. |
Definition at line 567 of file los.cpp.
References player::do_los, first_player, object::map, player::next, and player::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 162 of file button.cpp.
References BUTTON, object::count, FOR_ABOVE_FINISH, FOR_ABOVE_PREPARE, get_button_links(), object::head, objectlink::id, llevDebug, LOG(), object::move_on, object::move_type, object::name, objectlink::next, NROF(), objectlink::ob, object_update(), PEDESTAL, PLAYER, push_button(), object::race, SET_ANIMATION, object::slaying, SPECIAL_KEY, object::type, UP_OBJ_FACE, object::value, and object::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 227 of file button.cpp.
References BUTTON, object::count, objectlink::id, oblinkpt::link, llevError, LOG(), m, object::name, objectlink::next, oblinkpt::next, objectlink::ob, PEDESTAL, object::type, update_button(), oblinkpt::value, object::x, and object::y.
Referenced by mapfile_load().
void update_los | ( | object * | op | ) |
Recalculates the array which specifies what is visible for the given player-object.
op | player's object for which to compute. |
Definition at line 509 of file los.cpp.
References blinded_sight(), player::blocked_los, check_wall(), clear_los(), object::contr, expand_sight(), FLAG_BLIND, FLAG_REMOVED, FLAG_WIZ, FLAG_XRAYS, LOS_NO_DARKNESS, MAP_CLIENT_X, MAP_CLIENT_Y, socket_struct::mapx, socket_struct::mapy, QUERY_FLAG, player::socket, and XRAY_RADIUS.
Referenced by command_nowiz(), draw_client_map(), and set_up_cmd().
void update_position | ( | mapstruct * | m, |
int | x, | ||
int | y | ||
) |
This function updates various attributes about a specific space on the map (what it looks like, whether it blocks magic, has a living creatures, prevents people from passing through, etc)
m | map considered |
x | |
y | coordinates to update |
Definition at line 2130 of file map.cpp.
References add_face_layer(), blank_face, blocks_prayer, FLAG_ALIVE, FLAG_BLOCKSVIEW, FLAG_CAN_ROLL, FLAG_DAMNED, FLAG_IS_FLOOR, FLAG_MONSTER, FLAG_NO_MAGIC, FLAG_NO_PICK, FLAG_WIZ, flags, FOR_MAP_FINISH, FOR_MAP_PREPARE, GET_MAP_FACE_OBJS, GET_MAP_FLAGS, Map_Layer_Info::high_layer, Map_Layer_Info::honor_visibility, llevDebug, llevError, LOG(), m, MAP_LAYER_FLOOR, MAP_LAYER_FLY1, MAP_LAYER_FLY2, map_layer_info, MAP_LAYER_ITEM1, MAP_LAYER_ITEM3, MAP_LAYER_LIVING1, MAP_LAYER_LIVING2, MAP_LAYER_NO_PICK1, MAP_LAYER_NO_PICK2, MAP_LAYERS, MOVE_FLYING, object_value_set_shared(), P_BLOCKSVIEW, P_IS_ALIVE, P_NEED_UPDATE, P_NO_CLERIC, P_NO_ERROR, P_NO_MAGIC, P_PLAYER, PLAYER, QUERY_FLAG, SET_MAP_FLAGS, SET_MAP_LIGHT, SET_MAP_MOVE_BLOCK, SET_MAP_MOVE_OFF, SET_MAP_MOVE_ON, SET_MAP_MOVE_SLOW, and SET_MAP_PLAYER.
Referenced by cfapi_map_update_position(), cfapi_object_set_property(), do_turn(), draw_client_map(), object_insert_in_ob(), object_remove(), and object_update().
void use_trigger | ( | object * | op | ) |
Toggles the state of specified button.
op | object to toggle. |
Definition at line 254 of file button.cpp.
References push_button(), and object::value.
Referenced by check_inv(), monster_do_talk_npc(), spring_trap(), and trigger_move().
long usec_elapsed | ( | struct timespec | first, |
struct timespec | second | ||
) |
Return the number of microseconds between two timespec structures.
This function was copied from common/time.c since linking is too hard.
Definition at line 1149 of file cfanim.cpp.
Referenced by animate().
void write_book_archive | ( | void | ) |
Write out the updated book archive to bookarch file.
Definition at line 2005 of file readable.cpp.
References title::archname, title::authour, titlelist::first_book, get_titlelist(), title::level, llevDebug, llevError, Settings::localdir, LOG(), MAX_BUF, title::msg_index, title::name, need_to_write_bookarchive, title::next, titlelist::next, of_close(), of_open(), SAVE_MODE, settings, and title::size.
Referenced by cleanup(), and do_specials().
void write_todclock | ( | void | ) |
Write out the current time to the file so time does not reset every time the server reboots.
Definition at line 517 of file init.cpp.
References Settings::localdir, MAX_BUF, of_close(), of_open(), settings, and todtick.
Referenced by clean_tmp_files(), init_clocks(), and tick_the_clock().
void yyfree | ( | void * | ptr | ) |
Definition at line 38872 of file loader.cpp.
Referenced by yy_delete_buffer(), and yylex_destroy().
int yyget_debug | ( | void | ) |
Definition at line 38761 of file loader.cpp.
References yy_flex_debug.
FILE* yyget_in | ( | void | ) |
int yyget_lineno | ( | void | ) |
FILE* yyget_out | ( | void | ) |
char* yyget_text | ( | void | ) |
int yylex_destroy | ( | void | ) |
Definition at line 38804 of file loader.cpp.
References yy_buffer_stack, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_delete_buffer(), yy_init_globals(), yy_start_stack, yyfree(), and yypop_buffer_state().
void yypop_buffer_state | ( | void | ) |
Removes and deletes the top of the stack, if present.
The next element becomes the new top.
Definition at line 38483 of file loader.cpp.
References yy_buffer_stack_top, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_delete_buffer(), yy_did_buffer_switch_on_eof, and yy_load_buffer_state().
Referenced by yylex_destroy().
void yyrestart | ( | FILE * | input_file | ) |
Immediately switch to a different input stream.
input_file | A readable stream. |
INITIAL
. Definition at line 38287 of file loader.cpp.
References YY_BUF_SIZE, yy_create_buffer(), YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_init_buffer(), yy_load_buffer_state(), yyensure_buffer_stack(), and yyin.
Referenced by yy_get_next_buffer().
void yyset_debug | ( | int | bdebug | ) |
Definition at line 38766 of file loader.cpp.
References yy_flex_debug.
void yyset_in | ( | FILE * | _in_str | ) |
Set the input stream.
This does not discard the current input buffer.
_in_str | A readable stream. |
Definition at line 38751 of file loader.cpp.
References yyin.
void yyset_lineno | ( | int | _line_number | ) |
Set the current line number.
_line_number | line number |
Definition at line 38739 of file loader.cpp.
References yylineno.
void yyset_out | ( | FILE * | out_str | ) |
Definition at line 38756 of file loader.cpp.
References yyout.