Crossfire Server, Trunk
|
Go to the source code of this file.
Functions | |
int | atnr_is_dragon_enabled (int attacknr) |
void | clear_player (player *pl) |
void | commit_crime (object *op, const char *description) |
void | free_player (player *pl) |
client_spell * | get_client_spell_state (player *pl, object *spell) |
bool | is_criminal (object *op) |
int | is_dragon_pl (const object *op) |
int | is_old_wraith_pl (object *op) |
int | is_wraith_pl (object *op) |
void | link_player_skills (object *op) |
const char * | player_get_own_title (const struct pl *pl) |
void | player_get_title (const struct pl *pl, char *buf, size_t bufsize) |
int | player_has_own_title (const struct pl *pl) |
void | player_set_dragon_title (struct pl *pl, int level, const char *attack, int skin_resist) |
void | player_set_own_title (struct pl *pl, const char *title) |
Player-structure related functions.
Definition in file player.c.
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.c.
References ATNR_ACID, ATNR_COLD, ATNR_ELECTRICITY, ATNR_FIRE, ATNR_MAGIC, and ATNR_POISON.
Referenced by command_resistances(), describe_item(), describe_resistance(), dragon_eat_flesh(), dragon_level_gain(), perceive_self(), and set_dragon_name().
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.c.
References pl::delayed_buffers, pl::delayed_buffers_allocated, pl::delayed_buffers_used, FREE_AND_CLEAR, FREE_AND_CLEAR_STR, FREE_OBJ_NO_DESTROY_CALLBACK, pl::last_exit, give::next, client_spell::next, object_free(), pl::spell_state, pl::stack_items, pl::stack_position, and pl::unarmed_skill.
Referenced by free_player(), and get_player().
void commit_crime | ( | object * | op, |
const char * | description | ||
) |
Definition at line 307 of file player.c.
References add_force(), dragon_attune::force, object_set_msg(), and give::op.
Referenced by save_throw_object().
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.c.
References clear_player(), first_player, FLAG_REMOVED, llevError, LOG(), pl::next, pl::ob, object_free_drop_inventory(), object_remove(), and QUERY_FLAG.
Referenced by final_free_player().
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.c.
References fatal(), client_spell::next, OUT_OF_MEMORY, client_spell::spell, and pl::spell_state.
Referenced by append_spell(), and esrv_update_spells().
bool is_criminal | ( | object * | op | ) |
Definition at line 312 of file player.c.
References find_force(), and give::op.
Referenced by attack_ob_simple(), and get_nearest_criminal().
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.c.
References give::op, and PLAYER.
Referenced by check_login(), command_resistances(), command_title(), describe_item(), describe_monster(), dragon_eat_flesh(), dragon_focus_type_apply(), find_best_player_hth_skill(), food_type_apply(), old_describe_monster(), perceive_self(), and player_lvl_adj().
int is_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.c.
References is_wraith_pl(), object_find_by_name(), give::op, and PLAYER.
Referenced by food_type_apply().
int is_wraith_pl | ( | object * | op | ) |
Tests if a player is a wraith.
op | player to check. |
Definition at line 173 of file player.c.
References object_find_by_name(), give::op, and PLAYER.
Referenced by check_heal_and_mana(), food_type_apply(), hit_with_one_attacktype(), and is_old_wraith_pl().
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.c.
References FOR_INV_FINISH, FOR_INV_PREPARE, MAX_SKILLS, give::op, SKILL, and Ice::tmp.
Referenced by adjust_skill_tool(), apply_race_and_class(), become_follower(), check_login(), food_type_apply(), give_initial_items(), give_skill_by_name(), key_change_class(), and learn_skill().
const char* player_get_own_title | ( | const struct pl * | 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.c.
References pl::own_title.
Referenced by save_player().
void player_get_title | ( | const struct pl * | pl, |
char * | buf, | ||
size_t | bufsize | ||
) |
Returns the player's title. The returned title is never empty and includes a "the" prefix if necessary.
pl | the player to return the title of |
buf | returns the title |
bufsize | the size of buf in byte |
Definition at line 232 of file player.c.
References buf, pl::own_title, strlcpy(), and pl::title.
Referenced by cfapi_object_get_property(), command_title(), get_who_escape_code_value(), hiscore_check(), and set_title().
int player_has_own_title | ( | const struct pl * | pl | ) |
Returns whether the player has a custom title.
pl | the player to check |
Definition at line 247 of file player.c.
References pl::own_title.
Referenced by command_title(), and save_player().
void player_set_dragon_title | ( | struct pl * | pl, |
int | level, | ||
const char * | attack, | ||
int | skin_resist | ||
) |
Updates the title of a dragon player to reflect the current level, attack type, and resistances.
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.c.
References pl::own_title, and pl::title.
Referenced by set_dragon_name().
void player_set_own_title | ( | struct pl * | 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.c.
References pl::own_title, replace_unprintable_chars(), and strlcpy().
Referenced by cfapi_object_set_property(), check_login(), command_title(), key_confirm_quit(), and kill_player_permadeath().