Crossfire Server, Trunk  R20911
sockproto.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void account_add_player_cmd (char *buf, int len, socket_struct *ns)
 
void account_login_cmd (char *buf, int len, socket_struct *ns)
 
void account_new_cmd (char *buf, int len, socket_struct *ns)
 
void account_password (char *buf, int len, socket_struct *ns)
 
void account_play_cmd (char *buf, int len, socket_struct *ns)
 
void add_me_cmd (char *buf, int len, socket_struct *ns)
 
void apply_cmd (char *buf, int len, player *pl)
 
void ask_smooth_cmd (char *buf, int len, socket_struct *ns)
 
void create_player_cmd (char *buf, int len, socket_struct *ns)
 
void do_server (void)
 
void draw_client_map (object *pl)
 
void draw_client_map2 (object *pl)
 
void draw_ext_info (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
 
void draw_ext_info_format (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
 
void draw_magic_map (object *pl)
 
void esrv_add_spells (player *pl, object *spell)
 
void esrv_del_item (player *pl, object *ob)
 
void esrv_draw_look (object *pl)
 
void esrv_map_scroll (socket_struct *ns, int dx, int dy)
 
void esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof)
 
void esrv_new_player (player *pl, uint32_t weight)
 
void esrv_remove_spell (player *pl, object *spell)
 
void esrv_send_animation (socket_struct *ns, short anim_num)
 
void esrv_send_face (socket_struct *ns, uint16_t face_num, int nocache)
 
void esrv_send_inventory (object *pl, object *op)
 
void esrv_send_item (object *pl, object *op)
 
void esrv_send_pickup (player *pl)
 
void esrv_update_item (int flags, object *pl, object *op)
 
void esrv_update_spells (player *pl)
 
void esrv_update_stats (player *pl)
 
void examine_cmd (char *buf, int len, player *pl)
 
void ext_info_map (int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1)
 
void ext_info_map_except (int color, const mapstruct *map, const object *op, uint8_t type, uint8_t subtype, const char *str1)
 
void ext_info_map_except2 (int color, const mapstruct *map, const object *op1, const object *op2, int type, int subtype, const char *str1)
 
void final_free_player (player *pl)
 
void free_all_newserver (void)
 
void free_newsocket (socket_struct *ns)
 
int GetInt_String (const unsigned char *data)
 
short GetShort_String (const unsigned char *data)
 
void handle_client (socket_struct *ns, player *pl)
 
void init_connection (socket_struct *ns, const char *from_ip)
 
void init_listening_socket (socket_struct *ns)
 
void init_server (void)
 
void inscribe_scroll_cmd (char *buf, int len, player *pl)
 
int is_valid_faceset (int fsn)
 
void lock_item_cmd (uint8_t *data, int len, player *pl)
 
void look_at (object *op, int dx, int dy)
 
void look_at_cmd (char *buf, int len, player *pl)
 
void magic_mapping_mark (object *pl, char *map_mark, int strength)
 
void map_newmap_cmd (socket_struct *ns)
 
void mark_item_cmd (uint8_t *data, int len, player *pl)
 
int metaserver2_init (void)
 
void * metaserver2_thread (void *junk)
 
void metaserver_init (void)
 
void metaserver_update (void)
 
void move_cmd (char *buf, int len, player *pl)
 
void new_player_cmd (uint8_t *buf, int len, player *pl)
 
void play_sound_map (int8_t sound_type, object *emitter, int dir, const char *action)
 
void play_sound_player_only (player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
 
void player_update_bg_music (object *player)
 
void print_ext_msg (socket_struct *ns, int color, uint8_t type, uint8_t subtype, const char *message)
 
void rangetostring (const object *pl, char *obuf, size_t len)
 
void reply_cmd (char *buf, int len, player *pl)
 
void request_info_cmd (char *buf, int len, socket_struct *ns)
 
void send_account_players (socket_struct *ns)
 
void send_background_music (player *pl, const char *music)
 
void send_class_info (socket_struct *ns, char *params)
 
void send_class_list (socket_struct *ns, char *params)
 
void send_exp_table (socket_struct *ns, char *params)
 
void send_face_cmd (char *buff, int len, socket_struct *ns)
 
void send_file (socket_struct *ns, const char *file)
 
void send_image_info (socket_struct *ns)
 
void send_image_sums (socket_struct *ns, char *params)
 
void send_map_info (socket_struct *ns)
 
void send_new_char_info (socket_struct *ns)
 
void send_plugin_custom_message (object *pl, char *buf)
 
void send_query (socket_struct *ns, uint8_t flags, const char *text)
 
void send_race_info (socket_struct *ns, char *params)
 
void send_race_list (socket_struct *ns, char *params)
 
void send_skill_info (socket_struct *ns, char *params)
 
void send_spell_paths (socket_struct *ns, char *params)
 
void send_tick (player *pl)
 
void Send_With_Handling (socket_struct *ns, SockList *sl)
 
void set_face_mode_cmd (char *buf, int len, socket_struct *ns)
 
void set_sound_cmd (char *buf, int len, socket_struct *ns)
 
void set_title (const object *pl, char *buf, size_t len)
 
void set_up_cmd (char *buf, int len, socket_struct *ns)
 
void SockList_AddChar (SockList *sl, char c)
 
void SockList_AddData (SockList *sl, const void *data, size_t len)
 
void SockList_AddInt (SockList *sl, uint32_t data)
 
void SockList_AddInt64 (SockList *sl, uint64_t data)
 
void SockList_AddLen16Data (SockList *sl, const void *data, size_t len)
 
void SockList_AddLen8Data (SockList *sl, const void *data, size_t len)
 
void SockList_AddPrintf (SockList *sl, const char *format,...)
 
void SockList_AddShort (SockList *sl, uint16_t data)
 
void SockList_AddString (SockList *sl, const char *data)
 
void SockList_AddStringBuffer (SockList *sl, StringBuffer *sb)
 
size_t SockList_Avail (const SockList *sl)
 
void SockList_Init (SockList *sl)
 
void SockList_NullTerminate (SockList *sl)
 
int SockList_ReadPacket (int fd, SockList *sl, int len)
 
void SockList_Reset (SockList *sl)
 
void SockList_ResetRead (SockList *sl)
 
void SockList_Term (SockList *sl)
 
void toggle_extended_infos_cmd (char *buf, int len, socket_struct *ns)
 
void toggle_extended_text_cmd (char *buf, int len, socket_struct *ns)
 
void version_cmd (char *buf, int len, socket_struct *ns)
 
void watchdog (void)
 
void write_cs_stats (void)
 
void write_socket_buffer (socket_struct *ns)
 

Function Documentation

◆ account_add_player_cmd()

void account_add_player_cmd ( char *  buf,
int  len,
socket_struct ns 
)

Handle accountaddplayer from server (add a character to this account). We check to see if character exists, if password is correct, if character is associated with other account.

Parameters
bufsocket data to process
lenlength of socket data.
nssocket of incoming request.

Definition at line 2284 of file request.c.

References account_char_free(), account_char_load(), account_char_remove(), account_char_save(), socket_struct::account_chars, account_get_account_for_char(), account_is_logged_in(), account_link(), socket_struct::account_name, account_remove_player(), decode_name_password(), socket_struct::host, llevDebug, LOG(), MAX_BUF, send_account_players(), Send_With_Handling(), SockList_AddString(), SockList_Init(), SockList_Term(), and verify_player().

+ Here is the call graph for this function:

◆ account_login_cmd()

void account_login_cmd ( char *  buf,
int  len,
socket_struct ns 
)

Handles the account login

Parameters
bufremaining socket data - from this we need to extract name & password
lenlength of this buffer
nspointer to socket structure.

Definition at line 2050 of file request.c.

References account_exists(), account_get_logged_in_init_socket(), account_get_logged_in_player(), account_login(), socket_struct::account_name, decode_name_password(), socket_struct::host, llevDebug, LOG(), MAX_BUF, Ns_Dead, send_account_players(), Send_With_Handling(), pl::socket, SockList_AddString(), SockList_Init(), SockList_Term(), socket_struct::status, and strdup_local.

+ Here is the call graph for this function:

◆ account_new_cmd()

void account_new_cmd ( char *  buf,
int  len,
socket_struct ns 
)

Handles the account creation This function shares a fair amount of the same logic as account_login_cmd() above.

Parameters
bufremaining socket data - from this we need to extract name & password
lenlength of this buffer
nspointer to socket structure.

Definition at line 2176 of file request.c.

References account_block_create(), account_check_string(), account_exists(), socket_struct::account_name, account_new(), accounts_save(), decode_name_password(), socket_struct::host, llevDebug, llevInfo, LOG(), MAX_BUF, send_account_players(), Send_With_Handling(), SockList_AddString(), SockList_Init(), SockList_Term(), and strdup_local.

+ Here is the call graph for this function:

◆ account_password()

void account_password ( char *  buf,
int  len,
socket_struct ns 
)

Handles the account password change.

Parameters
bufremaining socket data - from this we need to extract old & new password
lenlength of this buffer
nspointer to socket structure.

Definition at line 2875 of file request.c.

References account_change_password(), account_check_string(), socket_struct::account_name, decode_name_password(), socket_struct::host, llevDebug, LOG(), MAX_BUF, send_account_players(), Send_With_Handling(), SockList_AddString(), SockList_Init(), and SockList_Term().

+ Here is the call graph for this function:

◆ account_play_cmd()

◆ add_me_cmd()

void add_me_cmd ( char *  buf,
int  len,
socket_struct ns 
)

The client has requested to be added to the game. This is what takes care of it. We tell the client how things worked out. I am not sure if this file is the best place for this function. However, it either has to be here or init_sockets needs to be exported.

Todo:
can ns->status not be Ns_Add?

Definition at line 347 of file request.c.

References add_player(), socket_struct::cs_version, find_player_socket(), MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_VERSION, NDI_RED, Ns_Add, Ns_Avail, print_ext_msg(), socket_struct::sc_version, Send_With_Handling(), settings, SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::status.

+ Here is the call graph for this function:

◆ apply_cmd()

void apply_cmd ( char *  buf,
int  len,
player pl 
)

◆ ask_smooth_cmd()

void ask_smooth_cmd ( char *  buf,
int  len,
socket_struct ns 
)

Tells client the picture it has to use to smooth a picture number given as argument.

Definition at line 423 of file request.c.

References socket_struct::host, llevDebug, LOG(), and send_smooth().

+ Here is the call graph for this function:

◆ create_player_cmd()

void create_player_cmd ( char *  buf,
int  len,
socket_struct ns 
)

◆ do_server()

◆ draw_client_map()

void draw_client_map ( object pl)

Draws client map.

Definition at line 1449 of file request.c.

References obj::contr, pl::do_los, draw_client_map2(), get_map_flags(), mapdef::in_memory, llevError, LOG(), obj::map, MAP_IN_MEMORY, socket_struct::mapx, socket_struct::mapy, P_NEED_UPDATE, P_NEW_MAP, P_OUT_OF_MAP, PLAYER, pl::socket, mapdef::timeout, pl::transport, obj::type, update_los(), update_position(), obj::x, and obj::y.

Referenced by do_server().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_client_map2()

◆ draw_ext_info()

void draw_ext_info ( int  flags,
int  pri,
const object pl,
uint8_t  type,
uint8_t  subtype,
const char *  txt 
)

Sends message to player(s).

Parameters
flagsVarious flags - mostly color, plus a few specials. If NDI_ALL or NDI_ALL_DMS is set, pl is ignored and the message is resent to all players or all DMs individually.
priPriority. The lower the value, the more important it is. Thus, 0 gets sent no matter what. Otherwise, the value must be less than the listening level that the player has set. Unfortunately, there is no clear guideline on what each level does what.
plWho to send the message to. pl may be NULL, particularly if flags has NDI_ALL or NDI_DMS set since it is ignored in that case. If NDI_ALL and NDI_DMS are not set, when pl is NULL, nobody gets the message. This is sometimes useful when a function that can be invoked by a player is automatically called by some other mechanism. For example, if a player tries to put something in a container, they should get a message that tells them they cannot put it in an unsuitable container, but when auto-pickup is at work, all containers are tried, even unsuitable ones, and so messages should not be sent to the player.
typeThe type MSG_TYPE for the type of message.
subtypeThe subtype of the message.
messageThe message to send.

Those are dummy functions defined to resolve all symboles. Added as part of glue cleaning. Ryo 2005-07-15

Dummy functions to link the library.

Definition at line 310 of file main.c.

References obj::contr, first_player, FLAG_WIZ, pl::listening, llevInfo, LOG(), logfile, NDI_ALL, NDI_ALL_DMS, NDI_COLOR_MASK, pl::next, pl::ob, PLAYER, print_ext_msg(), QUERY_FLAG, pl::socket, and obj::type.

Referenced by adj_stealchance(), adjust_sign_msg(), alchemy_failure_effect(), animate_weapon(), apply_builder_floor(), apply_builder_item(), apply_builder_remove(), apply_builder_wall(), apply_builder_window(), apply_by_living(), apply_check_apply_restrictions(), apply_check_item_power(), apply_check_owner(), apply_manual(), apply_map_builder(), apply_sign(), apply_special(), armour_improver_type_apply(), attack_hth(), attack_melee_weapon(), attack_message(), attack_ob_simple(), attempt_do_alchemy(), attempt_jump(), attempt_recipe(), attempt_steal(), basic_emote(), blocked_link(), book_type_apply(), can_pay(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_change_map_lightlevel(), cast_cone(), cast_consecrate(), cast_create_food(), cast_create_obj(), cast_create_town_portal(), cast_curse(), cast_heal(), cast_identify(), cast_invisible(), cast_item_curse_or_curse(), cast_light(), cast_raise_dead_spell(), cast_smite_spell(), cast_spell(), cast_transfer(), cast_word_of_recall(), cf_handle_type_apply(), cfapi_player_message(), change_abil(), change_spell(), charge_mana_effect(), check_login(), check_name(), check_pick(), command_abil(), command_addexp(), command_afk(), command_arrest(), command_banish(), command_body(), command_bowmode(), command_brace(), command_create(), command_diff(), command_drop(), command_dropall(), command_dump(), command_dumpbelow(), command_empty(), command_fire(), command_follow(), command_forget_spell(), command_free(), command_freeze(), command_goto(), command_gsay(), command_help(), command_insert_into(), command_inventory(), command_invisible(), command_kill_pets(), command_language(), command_learn_spell_or_prayer(), command_loadplugin(), command_loadtest(), command_lock_item(), command_mark(), command_mon_aggr(), command_nowiz(), command_overlay_reset(), command_overlay_save(), command_party(), command_passwd(), command_patch(), command_peaceful(), command_pickup(), command_possess(), command_purge_quest(), command_purge_quest_definitions(), command_quest(), command_quit(), command_remove(), command_rename_item(), command_reply(), command_reset(), command_resistances(), command_rskill(), command_run(), command_save(), command_search_items(), command_setgod(), command_settings(), command_showpets(), command_shutdown(), command_sound(), command_stack_clear(), command_stack_list(), command_statistics(), command_stats(), command_strings(), command_style_map_info(), command_summon(), command_take(), command_teleport(), command_tell_all(), command_throw(), command_title(), command_toggle_shout(), command_unloadplugin(), command_use(), command_uskill(), command_whereabouts(), command_wizcast(), command_wizpass(), confuse_living(), create_aura(), create_bomb(), cure_disease(), current_map_info(), dimension_door(), dispel_rune(), display_motd(), display_new_pickup(), display_who_entry(), dm_stack_peek(), dm_stack_pop(), dm_stack_push(), do_hidden_move(), do_skill(), do_skill_attack(), do_tell(), do_throw(), do_turn(), do_wizard_dm(), do_wizard_hide(), dragon_ability_gain(), dragon_eat_flesh(), drain_specific_stat(), draw_ext_info_format(), drop(), drop_object(), eat_special_food(), emergency_save(), enter_map(), examine(), examine_monster(), execute_word_of_recall(), exit_type_apply(), exit_type_move_on(), ext_info_map(), ext_info_map_except(), ext_info_map_except2(), find_or_create_connection_for_map(), find_traps(), fire(), fire_arch_from_position(), fire_bow(), fire_misc_object(), food_type_apply(), get_other_player_from_name(), god_enchants_weapon(), god_intervention(), god_removes_curse(), handle_newcs_player(), help_topics(), hide(), hiscore_check(), hiscore_display(), hole_type_move_on(), identify_altar_type_move_on(), improve_armour(), improve_weapon(), improve_weapon_magic(), improve_weapon_stat(), infect_object(), inscribe_scroll_cmd(), inventory(), jump(), key_change_class(), key_confirm_quit(), key_roll_stat(), kill_object(), kill_player(), kill_player_not_permadeath(), kill_player_permadeath(), knowledge_alchemy_attempt(), knowledge_display(), knowledge_do_attempt(), knowledge_do_display(), knowledge_give(), knowledge_item_can_be_used_alchemy(), knowledge_show(), knowledge_show_monster_detail(), knowledge_write_player_data(), lighter_type_apply(), list_players(), lock_item_cmd(), look_at(), magic_wall(), map_info(), mark_item_cmd(), meditate(), mimic_type_apply(), monster_can_see_enemy(), monster_communicate(), move_marker(), move_player_attack(), move_symptom(), paralyze_living(), party_help(), party_send_message(), perceive_self(), pets_follow_owner(), pets_move(), pets_move_golem(), pets_summon_golem(), pets_summon_object(), pick_lock(), pick_up(), pick_up_object(), player_attack_door(), player_lvl_adj(), plugins_display_list(), poison_living(), poison_type_apply(), poisoning_type_process(), potion_type_apply(), power_crystal_type_apply(), pray(), pray_at_altar(), prayer_failure(), prepare_weapon(), print_los(), probe(), put_object_in_sack(), quest_help(), quest_info(), quest_set_state(), quest_write_player_data(), receive_party_password(), receive_play_again(), receive_player_name(), receive_player_password(), recharge(), remove_curse(), remove_depletion(), remove_force(), save_player(), scroll_failure(), scroll_type_apply(), send_rules(), server_check_shutdown(), set_pickup_mode(), shop_describe(), shop_inventory_type_apply(), shop_mat_type_move_on(), show_commands(), show_matching_spells(), show_skills(), skill_attack(), skill_ident(), slow_living(), spell_failure(), spellbook_type_apply(), spring_trap(), tailor_god_spell(), trap_disarm(), trapdoor_type_move_on(), treasure_type_apply(), trigger_type_apply(), unapply_for_ob(), use_alchemy(), use_oratory(), weapon_improver_type_apply(), write_mark(), write_note(), write_on_item(), write_rune(), write_scroll(), and wrong_password().

+ Here is the call graph for this function:

◆ draw_ext_info_format()

void draw_ext_info_format ( int  flags,
int  pri,
const object pl,
uint8_t  type,
uint8_t  subtype,
const char *  format,
  ... 
)

Sends message to player(s).

This function is the same as draw_ext_info, but takes varargs format. Otherwise, the meaning of all the fields is the same. This is perhaps not the most efficient as we do vsnprintf on both the old and newbuf, but it simplifies the code greatly since we can just call draw_ext_info.

Parameters
flagsVarious flags - mostly color, plus a few specials.
priPriority. It is a little odd - the lower the value, the more important it is. Thus, 0 gets sent no matter what. Otherwise, the value must be less than the listening level that the player has set. Unfortunately, there is no clear guideline on what each level does what.
plCan be passed as NULL - in fact, this will be done if NDI_ALL is set in the flags.
typeThe type MSG_TYPE for the type of message.
subtypeThe type MSG_TYPE for the subtype of message.
formatThe message to send, with optional format specifiers.

Definition at line 315 of file main.c.

References draw_ext_info(), HUGE_BUF, logfile, and vsnprintf.

Referenced by action_makes_visible(), alchemy_failure_effect(), altar_type_move_on(), animate_weapon(), apply_builder_item(), apply_builder_remove(), apply_by_living(), apply_check_apply_restrictions(), apply_check_personalized_blessings(), apply_check_race_restrictions(), apply_container(), apply_savebed(), apply_special(), apply_update_ranged_skill(), arch_info(), attack_hth(), attack_message(), attack_ob_simple(), attempt_do_alchemy(), attempt_jump(), attempt_recipe(), attempt_steal(), basic_emote(), become_follower(), blind_living(), book_type_apply(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_consecrate(), cast_create_missile(), cast_curse(), cast_dust(), cast_identify(), cast_item_curse_or_curse(), cast_raise_dead_spell(), cast_smite_spell(), cast_spell(), change_abil(), change_spell(), check_login(), check_name(), check_pick(), check_sacrifice(), check_spell_expiry(), choose_cult_monster(), clock_type_apply(), command_abil(), command_addexp(), command_apply(), command_applymode(), command_arrest(), command_banish(), command_body(), command_bowmode(), command_cast_spell(), command_cointoss(), command_create(), command_debug(), command_drop(), command_examine(), command_follow(), command_forget_spell(), command_freeze(), command_goto(), command_help(), command_insert_into(), command_kick2(), command_kill_pets(), command_language(), command_learn_spell_or_prayer(), command_listen(), command_loadplugin(), command_loadtest(), command_lock_item(), command_mark(), command_nowiz(), command_party(), command_party_rejoin(), command_patch(), command_petmode(), command_pickup(), command_players(), command_quest(), command_remove(), command_rename_item(), command_reply(), command_reset(), command_resistances(), command_rskill(), command_search_items(), command_setgod(), command_settings(), command_showpets(), command_shutdown(), command_speed(), command_stack_list(), command_statistics(), command_stats(), command_strings(), command_style_map_info(), command_summon(), command_take(), command_teleport(), command_tell_all(), command_toggle_shout(), command_unarmed_skill(), command_unloadplugin(), command_use(), command_usekeys(), command_version(), command_whereabouts(), command_wimpy(), converter_type_move_on(), cure_disease(), current_map_info(), current_region_info(), deep_swamp_type_move_on(), deep_swamp_type_process(), display_new_pickup(), dm_stack_pop(), dm_stack_push(), do_forget_spell(), do_harvest(), do_learn_spell(), do_skill_attack(), do_tell(), do_throw(), do_turn(), do_wizard_hide(), dragon_ability_gain(), dragon_eat_flesh(), dragon_level_gain(), drop_object(), empty_container(), enter_exit(), enter_fixed_template_map(), enter_player_maplevel(), enter_unique_map(), examine(), execute_newserver_command(), exit_type_apply(), find_best_player_hth_skill(), find_key(), find_throw_ob(), fire_bow(), fire_misc_object(), follower_remove_given_items(), food_type_apply(), gate_type_process(), get_dm_object(), get_spell_by_name(), god_enchants_weapon(), god_examines_item(), god_examines_priest(), god_gives_present(), god_intervention(), hit_with_one_attacktype(), i18n_list_languages(), identify_altar_type_move_on(), identify_object_with_skill(), improve_weapon(), improve_weapon_stat(), inventory(), key_change_class(), key_confirm_quit(), key_roll_stat(), kill_object(), kill_player_not_permadeath(), knowledge_alchemy_attempt(), knowledge_display(), knowledge_do_display(), lamp_type_apply(), leave(), lighter_type_apply(), list_players(), look_at(), magic_wall(), malloc_info(), map_info(), mark_item_cmd(), monster_can_detect_enemy(), monster_communicate(), new_player_cmd(), party_form(), party_join(), party_leave(), peacemaker_type_process(), perceive_self(), pets_move_golem(), pets_summon_golem(), pets_summon_object(), pick_up(), player_attack_door(), plugins_display_list(), poison_living(), polymorph_melt(), potion_type_apply(), pray_at_altar(), prayer_failure(), prepare_weapon(), print_tod(), process_object(), process_players1(), push_ob(), put_object_in_sack(), quest_display(), quest_info(), quest_list(), quest_set_state(), quest_start(), recharge(), recursive_roll(), remove_force(), remove_special_prayers(), resurrect_player(), sack_can_hold(), save_life(), save_player(), save_throw_object(), scroll_type_apply(), sell_item(), send_news(), server_check_shutdown(), shop_describe(), shop_inventory_type_apply(), shop_pay_unpaid(), show_matching_spells(), show_skills(), singing(), skillscroll_type_apply(), spell_consume_items(), spellbook_type_apply(), swap_map(), swap_random_stats(), swap_stat(), time_info(), transmute_item_to_flower(), transport_type_apply(), trap_disarm(), trap_see(), treasure_type_apply(), unapply_for_ob(), unapply_special(), use_alchemy(), use_oratory(), use_skill(), worship_forbids_use(), write_note(), write_on_item(), write_rune(), and write_scroll().

+ Here is the call graph for this function:

◆ draw_magic_map()

void draw_magic_map ( object pl)

Creates and sends magic map to player.

@ param pl The player to send the magic map to

The following function is a lot messier than it really should be, but there is no real easy solution.

Mark Wedel

Definition at line 440 of file info.c.

References obj::contr, FACE_FLOOR, llevError, LOG(), MAGIC_MAP_HALF, MAGIC_MAP_SIZE, magic_mapping_mark(), MAX, MIN, PLAYER, Send_With_Handling(), pl::socket, SockList_AddChar(), SockList_AddPrintf(), SockList_Init(), SockList_Term(), and obj::type.

Referenced by cast_spell().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_add_spells()

void esrv_add_spells ( player pl,
object spell 
)

This tells the client to add the spell *spell, if spell is NULL, then add all spells in the player's inventory.

Todo:
casting_requirements should be a constant somewhere

Definition at line 1751 of file request.c.

References append_spell(), FOR_INV_FINISH, FOR_INV_PREPARE, llevError, LOG(), socket_struct::monitor_spells, obj::msg, obj::name, pl::ob, object_get_value(), Send_With_Handling(), pl::socket, SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), SockList_Term(), SPELL, and obj::type.

Referenced by check_login(), and do_learn_spell().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_del_item()

void esrv_del_item ( player pl,
object ob 
)

Tells the client to delete an item. Uses the item command with a -1 location.

Definition at line 355 of file main.c.

References obj::container, obj::count, obj::env, pl::ob, Send_With_Handling(), pl::socket, SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::update_inventory.

Referenced by object_remove(), and transmute_item_to_flower().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_draw_look()

◆ esrv_map_scroll()

void esrv_map_scroll ( socket_struct ns,
int  dx,
int  dy 
)

◆ esrv_move_object()

void esrv_move_object ( object pl,
tag_t  to,
tag_t  tag,
long  nrof 
)

Move an object to a new location

Definition at line 843 of file item.c.

References CONTAINER, obj::contr, pl::count, obj::count, drop_object(), obj::env, esrv_get_ob_from_count(), esrv_update_item(), FLAG_APPLIED, FOR_INV_FINISH, FOR_INV_PREPARE, obj::inv, llevDebug, LOG(), obj::map, obj::name, object_can_pick(), pick_up(), put_object_in_sack(), QUERY_FLAG, sack_can_hold(), pl::transport, transport_can_hold(), obj::type, and UPD_WEIGHT.

Referenced by move_cmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_new_player()

void esrv_new_player ( player pl,
uint32_t  weight 
)

Tells the client that here is a player it should start using.

Definition at line 856 of file request.c.

References obj::count, esrv_send_face(), obj::face, socket_struct::faces_sent, FLAG_CLIENT_SENT, pl::last_weight, obj::name, NS_FACESENT_FACE, new_face_struct::number, pl::ob, Send_With_Handling(), SET_FLAG, pl::socket, SockList_AddInt(), SockList_AddLen8Data(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by apply_race_and_class(), check_login(), command_possess(), key_change_class(), and roll_again().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_remove_spell()

void esrv_remove_spell ( player pl,
object spell 
)

Definition at line 1614 of file request.c.

References obj::count, obj::env, llevError, LOG(), socket_struct::monitor_spells, pl::ob, Send_With_Handling(), pl::socket, SockList_AddInt(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by do_forget_spell().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_send_animation()

void esrv_send_animation ( socket_struct ns,
short  anim_num 
)

Need to send an animation sequence to the client. We will send appropriate face commands to the client if we haven't sent them the face yet (this can become quite costly in terms of how much we are sending - on the other hand, this should only happen when the player logs in and picks stuff up.

Definition at line 883 of file request.c.

References animations, socket_struct::anims_sent, esrv_send_face(), animations_struct::faces, socket_struct::faces_sent, llevError, LOG(), NS_FACESENT_FACE, animations_struct::num_animations, num_animations, new_face_struct::number, Send_With_Handling(), SockList_AddShort(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by add_object_to_socklist(), and map2_add_ob().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_send_face()

void esrv_send_face ( socket_struct ns,
uint16_t  face_num,
int  nocache 
)

Sends a face to a client if they are in pixmap mode, nothing gets sent in bitmap mode. If nocache is true (nonzero), ignore the cache setting from the client - this is needed for the askface, in which we really do want to send the face (and askface is the only place that should be setting it). Otherwise, we look at the facecache, and if set, send the image name.

Parameters
nssocket to send the date to.
face_numface number to send.
nocacheif 1 then send a 'image2', else depending on client cache setting.

Definition at line 70 of file image.c.

References socket_struct::facecache, socket_struct::faces_sent, socket_struct::faceset, facesets, get_face_fallback(), llevError, LOG(), new_faces, nrofpixmaps, NS_FACESENT_FACE, Send_With_Handling(), SockList_AddChar(), SockList_AddData(), SockList_AddInt(), SockList_AddShort(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by add_object_to_socklist(), append_spell(), esrv_draw_look(), esrv_new_player(), esrv_send_animation(), esrv_update_item(), knowledge_process_incremental(), knowledge_send_info(), map2_add_ob(), quest_send_initial_states(), quest_set_state(), send_account_players(), send_face_cmd(), send_skill_info(), and send_smooth().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_send_inventory()

void esrv_send_inventory ( object pl,
object op 
)

Sends inventory of a container. If pl == op, then the whole contents are sent, else the contents is sent with "next group" and "prev group" arrows if required.

Parameters
plwho to send to.
opwhat item's contents to send.

Definition at line 307 of file item.c.

References add_object_to_socklist(), socket_struct::container_position, obj::contr, obj::count, empty_face, FOR_INV_FINISH, FOR_INV_PREPARE, HEAD, LOOK_OBJ, MAX, MAX_BUF, MAXITEMLEN, MIN, socket_struct::num_look_objects, new_face_struct::number, Send_With_Handling(), snprintf, pl::socket, SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), and SockList_Term().

Referenced by apply_cmd(), apply_container(), apply_race_and_class(), check_login(), command_possess(), do_server(), key_change_class(), player_changer_type_process(), save_player(), and use_alchemy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_send_item()

void esrv_send_item ( object pl,
object op 
)

◆ esrv_send_pickup()

void esrv_send_pickup ( player pl)

Sends the "pickup" state to pl if client wants it requested.

Parameters
plplayer that just logged in.

Definition at line 1637 of file request.c.

References pl::mode, Send_With_Handling(), pl::socket, SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::want_pickup.

Referenced by check_login(), and display_new_pickup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_update_item()

void esrv_update_item ( int  flags,
object pl,
object op 
)

Updates object *op for player *pl.

flags is a list of values to update to the client (as defined in newclient.h - might as well use the same value both places.

Definition at line 342 of file main.c.

References obj::anim_speed, obj::animation_id, obj::contr, obj::count, obj::custom_name, obj::env, esrv_send_face(), FABS, obj::face, socket_struct::faces_sent, FLAG_ANIMATE, FLAG_CLIENT_SENT, FLAG_NO_PICK, HEAD, pl::last_weight, llevDebug, LOG(), LOOK_OBJ, MAX_BUF, obj::name, obj::nrof, NS_FACESENT_FACE, new_face_struct::number, query_base_name(), QUERY_FLAG, query_flags(), Send_With_Handling(), snprintf, pl::socket, SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), obj::speed, UPD_ANIM, UPD_ANIMSPEED, UPD_FACE, UPD_FLAGS, UPD_LOCATION, UPD_NAME, UPD_NROF, UPD_WEIGHT, and WEIGHT.

Referenced by animate_weapon(), apply_container(), apply_race_and_class(), apply_special(), book_type_apply(), cancellation(), cast_identify(), cast_item_curse_or_curse(), cfapi_object_set_property(), command_dropall(), command_insert_into(), command_lock_item(), command_rename_item(), detect_curse_on_item(), detect_magic_on_item(), do_server(), drain_wand_charge(), drop_object(), empty_container(), esrv_move_object(), god_enchants_weapon(), god_removes_curse(), hit_with_one_attacktype(), identify(), improve_armour(), improve_weapon(), improve_weapon_magic(), insert_objects(), key_change_class(), lock_item_cmd(), object_decrease_nrof(), object_increase_nrof(), object_update(), pick_up_object(), player_changer_type_process(), power_crystal_type_apply(), prepare_weapon(), put_object_in_sack(), remove_curse(), sell_item(), send_changed_object(), shop_pay_unpaid(), spellbook_type_apply(), unapply_special(), and weapon_improver_type_apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_update_spells()

void esrv_update_spells ( player pl)

This looks for any spells the player may have that have changed their stats. It then sends an updspell packet for each spell that has changed in this way.

Definition at line 358 of file main.c.

References flags, FOR_INV_FINISH, FOR_INV_PREPARE, get_client_spell_state(), client_spell::last_dam, client_spell::last_grace, client_spell::last_sp, socket_struct::monitor_spells, pl::ob, Send_With_Handling(), pl::socket, SockList_AddChar(), SockList_AddInt(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), SP_level_dam_adjust(), SP_level_spellpoint_cost(), SPELL, SPELL_GRACE, SPELL_MANA, pl::spell_state, UPD_SP_DAMAGE, UPD_SP_GRACE, and UPD_SP_MANA.

Referenced by fix_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_update_stats()

void esrv_update_stats ( player pl)

Sends a statistics update. We look at the old values, and only send what has changed. Stat mapping values are in newclient.h Since this gets sent a lot, this is actually one of the few binary commands for now.

Definition at line 725 of file request.c.

References liv::ac, AddIfFloat, AddIfInt, AddIfInt64, AddIfShort, AddIfString, pl::applied_stats, obj::arch, atnr_cs_stat, ATNR_PHYSICAL, liv::Cha, archt::clone, liv::Con, obj::count, CS_STAT_AC, CS_STAT_APPLIED_CHA, CS_STAT_APPLIED_CON, CS_STAT_APPLIED_DEX, CS_STAT_APPLIED_INT, CS_STAT_APPLIED_POW, CS_STAT_APPLIED_STR, CS_STAT_APPLIED_WIS, CS_STAT_ARMOUR, CS_STAT_BASE_CHA, CS_STAT_BASE_CON, CS_STAT_BASE_DEX, CS_STAT_BASE_INT, CS_STAT_BASE_POW, CS_STAT_BASE_STR, CS_STAT_BASE_WIS, CS_STAT_CHA, CS_STAT_CON, CS_STAT_DAM, CS_STAT_DEX, CS_STAT_EXP64, CS_STAT_FLAGS, CS_STAT_FOOD, CS_STAT_GOLEM_HP, CS_STAT_GOLEM_MAXHP, CS_STAT_GRACE, CS_STAT_HP, CS_STAT_INT, CS_STAT_LEVEL, CS_STAT_MAXGRACE, CS_STAT_MAXHP, CS_STAT_MAXSP, CS_STAT_POW, CS_STAT_RACE_CHA, CS_STAT_RACE_CON, CS_STAT_RACE_DEX, CS_STAT_RACE_INT, CS_STAT_RACE_POW, CS_STAT_RACE_STR, CS_STAT_RACE_WIS, CS_STAT_RANGE, CS_STAT_SKILLINFO, CS_STAT_SP, CS_STAT_SPEED, CS_STAT_SPELL_ATTUNE, CS_STAT_SPELL_DENY, CS_STAT_SPELL_REPEL, CS_STAT_STR, CS_STAT_TITLE, CS_STAT_WC, CS_STAT_WEAP_SP, CS_STAT_WEIGHT_LIM, CS_STAT_WIS, liv::dam, liv::Dex, liv::exp, socket_struct::extended_stats, pl::fire_on, FLAG_FREED, FLAG_REMOVED, flags, liv::food, get_weight_limit(), pl::golem_count, liv::grace, liv::hp, liv::Int, pl::last_applied_stats, pl::last_flags, pl::last_golem_hp, pl::last_golem_maxhp, pl::last_level, pl::last_orig_stats, pl::last_path_attuned, pl::last_path_denied, pl::last_path_repelled, pl::last_race_stats, pl::last_resist, pl::last_skill_exp, pl::last_skill_ob, pl::last_speed, pl::last_stats, pl::last_weapon_sp, pl::last_weight_limit, SockList::len, obj::level, llevDebug, LOG(), MAX_BUF, liv::maxgrace, liv::maxhp, liv::maxsp, socket_struct::monitor_spells, NROFATTACKS, NUM_SKILLS, pl::ob, pl::orig_stats, obj::path_attuned, obj::path_denied, obj::path_repelled, liv::Pow, QUERY_FLAG, statsinfo::range, range_golem, pl::ranges, rangetostring(), obj::resist, pl::run_on, socket_struct::sc_version, Send_With_Handling(), set_title(), SF_FIREON, SF_RUNON, pl::socket, SockList_AddChar(), SockList_AddInt64(), SockList_AddString(), SockList_Init(), SockList_Term(), liv::sp, obj::speed, socket_struct::stats, obj::stats, liv::Str, statsinfo::title, liv::wc, obj::weapon_speed, and liv::Wis.

Referenced by do_server().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ examine_cmd()

void examine_cmd ( char *  buf,
int  len,
player pl 
)

Client wants to examine some object. So lets do so.

Definition at line 612 of file item.c.

References esrv_get_ob_from_count(), examine(), llevDebug, LOG(), obj::name, and pl::ob.

+ Here is the call graph for this function:

◆ ext_info_map()

void ext_info_map ( int  color,
const mapstruct map,
uint8_t  type,
uint8_t  subtype,
const char *  str1 
)

Writes to everyone on the specified map

Parameters
colorThe color of the message
mapThe map where the players receiving the message are located
typeThe message type
subtypeThe message subtype
str1The message to be sent

Definition at line 325 of file main.c.

References draw_ext_info(), first_player, logfile, obj::map, pl::next, and pl::ob.

Referenced by cfapi_map_message(), change_map_light(), command_me(), monster_do_say(), monster_do_talk_npc(), operate_altar(), and trigger_connected().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ext_info_map_except()

void ext_info_map_except ( int  color,
const mapstruct map,
const object op,
uint8_t  type,
uint8_t  subtype,
const char *  str1 
)

Writes to everyone on the map except *op. This is useful for emotions.

Parameters
colorThe color of the message
mapThe map where the players receiving the message are located
opThe player object to skip sending the message to on the map
typeThe message type
subtypeThe message subtype
str1The message to be sent

Definition at line 185 of file info.c.

References draw_ext_info(), first_player, obj::map, pl::next, and pl::ob.

Referenced by basic_emote(), command_cointoss(), and monster_communicate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ext_info_map_except2()

void ext_info_map_except2 ( int  color,
const mapstruct map,
const object op1,
const object op2,
int  type,
int  subtype,
const char *  str1 
)

Writes to everyone on the map except op1 and op2

Parameters
colorThe message color
mapThe map where the players receiving the message are located
op1The first player object to skip sending the message to
op2The second player object to skip sending the message to
typeThe message type
subtypeThe message subtype
str1The message to be sent

Definition at line 211 of file info.c.

References draw_ext_info(), first_player, obj::map, pl::next, and pl::ob.

Referenced by basic_emote().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ final_free_player()

void final_free_player ( player pl)

Sends the 'goodbye' command to the player, and closes connection.

Definition at line 444 of file init.c.

References free_newsocket(), free_player(), Send_With_Handling(), pl::socket, SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by check_login(), and do_server().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_all_newserver()

void free_all_newserver ( void  )

Free's all the memory that ericserver allocates.

Definition at line 395 of file init.c.

References Socket_Info::allocated_sockets, free_socket_images(), socket_struct::listen, llevDebug, and LOG().

Referenced by cleanup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_newsocket()

void free_newsocket ( socket_struct ns)

Frees a socket. Basically, all we need to do here is free all data structures that might be associated with the socket. It is up to the caller to update the list

Definition at line 413 of file init.c.

References account_char_free(), account_char_save(), socket_struct::account_chars, socket_struct::account_name, socket_struct::fd, FREE_AND_CLEAR, socket_struct::host, socket_struct::inbuf, llevDebug, LOG(), statsinfo::range, SockList_Term(), socket_struct::stats, and statsinfo::title.

Referenced by do_server(), and final_free_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInt_String()

int GetInt_String ( const unsigned char *  data)

Basically does the reverse of SockList_AddInt, but on strings instead. Same for the GetShort, but for 16 bits.

Definition at line 246 of file lowlevel.c.

Referenced by inscribe_scroll_cmd(), lock_item_cmd(), mark_item_cmd(), and new_player_cmd().

+ Here is the caller graph for this function:

◆ GetShort_String()

short GetShort_String ( const unsigned char *  data)

Definition at line 250 of file lowlevel.c.

Referenced by new_player_cmd().

+ Here is the caller graph for this function:

◆ handle_client()

void handle_client ( socket_struct ns,
player pl 
)

Handle commands from a client. This function should only be called when the socket is readable. If an error occurs, the socket status will be set to Ns_Dead; it is up to the caller to clean it up.

Parameters
nsSocket sending the command
plPlayer associated with this socket, or NULL

Definition at line 234 of file loop.c.

References SockList::buf, socket_struct::faces_sent, socket_struct::fd, handle_cmd(), socket_struct::inbuf, socket_struct::last_tick, SockList::len, Ns_Dead, pl::ob, SockList_NullTerminate(), SockList_ReadPacket(), SockList_ResetRead(), obj::speed_left, ST_PLAYING, pl::state, socket_struct::status, strtok_r, todtick, and watchdog().

Referenced by do_server(), and handle_newcs_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_connection()

void init_connection ( socket_struct ns,
const char *  from_ip 
)

Initializes a connection. Really, it just sets up the data structure, socket setup is handled elsewhere. We do send a version to the client.

Definition at line 63 of file init.c.

References socket_struct::account_chars, socket_struct::account_name, Socket_Info::allocated_sockets, socket_struct::anims_sent, SockList::buf, socket_struct::can_write, socket_struct::container_position, cst_lst, cst_tot, socket_struct::darkness, DEFAULT_NUM_LOOK_OBJECTS, socket_struct::extended_stats, socket_struct::facecache, socket_struct::faces_sent, socket_struct::faces_sent_len, socket_struct::faceset, socket_struct::fd, socket_struct::heartbeat, socket_struct::host, socket_struct::inbuf, socket_struct::is_bot, socket_struct::lastmap, buffer_struct::len, llevDebug, llevError, LOG(), socket_struct::login_method, socket_struct::look_position, socket_struct::map_scroll_x, socket_struct::map_scroll_y, socket_struct::mapx, socket_struct::mapy, CS_Stats::max_conn, socket_struct::monitor_spells, socket_struct::notifications, nrofpixmaps, Ns_Add, NS_FACESENT_FACE, socket_struct::num_look_objects, socket_struct::outputbuffer, socket_struct::password_fails, Send_With_Handling(), socklen_t, SockList_AddPrintf(), SockList_Init(), SockList_ResetRead(), SockList_Term(), socket_struct::sound, socket_struct::sounds_this_tick, buffer_struct::start, socket_struct::stats, socket_struct::status, strdup_local, socket_struct::tick, socket_struct::update_inventory, socket_struct::update_look, VERSION_CS, VERSION_INFO, VERSION_SC, and socket_struct::want_pickup.

Referenced by new_connection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_listening_socket()

void init_listening_socket ( socket_struct ns)

This opens *ns for listening to connections. The structure must be allocated already and ns->listen must be initialized. No other variable is changed.

Definition at line 171 of file init.c.

References listen_info::addr, listen_info::addrlen, listen_info::family, fatal(), socket_struct::fd, socket_struct::listen, llevError, LOG(), MAX_BUF, Ns_Add, Ns_Dead, listen_info::protocol, SEE_LAST_ERROR, snprintf, listen_info::socktype, and socket_struct::status.

Referenced by do_server(), and init_server().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_server()

void init_server ( void  )

This sets up the socket and reads all the image information into memory.

Todo:
fix socket_info.max_filedescriptor hack.

Definition at line 262 of file init.c.

References socket_struct::account_name, listen_info::addr, listen_info::addrlen, Socket_Info::allocated_sockets, Settings::csport, cst_lst, cst_tot, socket_struct::faces_sent, listen_info::family, fatal(), init_listening_socket(), socket_struct::listen, llevDebug, llevError, LOG(), MAX_BUF, Socket_Info::max_filedescriptor, listen_info::protocol, read_client_images(), SEE_LAST_ERROR, settings, snprintf, listen_info::socktype, CS_Stats::time_start, and Socket_Info::timeout.

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inscribe_scroll_cmd()

void inscribe_scroll_cmd ( char *  buf,
int  len,
player pl 
)

◆ is_valid_faceset()

int is_valid_faceset ( int  fsn)

Checks specified faceset is valid

Parameters
fsnfaceset number

Definition at line 563 of file image.c.

References FALSE, MAX_FACE_SETS, and TRUE.

Referenced by main(), and set_up_cmd().

+ Here is the caller graph for this function:

◆ lock_item_cmd()

void lock_item_cmd ( uint8_t data,
int  len,
player pl 
)

Client wants to apply some object. Lets do so.

Definition at line 671 of file item.c.

References CLEAR_FLAG, draw_ext_info(), obj::env, esrv_get_ob_from_count(), esrv_update_item(), FLAG_INV_LOCKED, GetInt_String(), llevDebug, LOG(), obj::map, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, pl::ob, object_merge(), SET_FLAG, and UPD_FLAGS.

+ Here is the call graph for this function:

◆ look_at()

void look_at ( object op,
int  dx,
int  dy 
)

Prints items on the specified square.

[ removed EARTHWALL check and added check for containers inventory. Tero..nosp@m.Haat.nosp@m.anen@.nosp@m.lut..nosp@m.fi ]

Definition at line 754 of file item.c.

References obj::above, CONTAINER, obj::count, draw_ext_info(), draw_ext_info_format(), FLAG_IS_FLOOR, FLAG_WIZ, FLESH, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, get_map_from_coord(), GET_MAP_OB, HEAD, inventory(), obj::invisible, obj::map, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, out_of_map(), QUERY_FLAG, query_name(), obj::type, obj::x, and obj::y.

Referenced by look_at_cmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ look_at_cmd()

void look_at_cmd ( char *  buf,
int  len,
player pl 
)

Client wants to look at some object. Lets do so.

Definition at line 819 of file item.c.

References pl::blocked_los, FABS, llevDebug, LOG(), look_at(), MAP_CLIENT_X, MAP_CLIENT_Y, socket_struct::mapx, socket_struct::mapy, obj::name, pl::ob, and pl::socket.

+ Here is the call graph for this function:

◆ magic_mapping_mark()

void magic_mapping_mark ( object pl,
char *  map_mark,
int  strength 
)

Creates magic map for player.

Parameters
plThe player making the magic map
map_markHolds flags for each tile analyzed. Should have been initialized to zero before this function is called.
strengthAn initial strength*2 rectangular area that we automatically see in/penetrate through.

Note: For improved magic mapping display, the space that blocks the view is now marked with value 2. Any dependencies of map_mark being nonzero have been changed to check for 1. Also, since map_mark is a char value, putting 2 in should cause no problems.

This function examines the map the player is on, and determines what is visible. 2 is set for walls or objects that blocks view. 1 is for open spaces.

Definition at line 393 of file info.c.

References blank_face, obj::face, FACE_FLOOR, FACE_WALL, GET_MAP_FACE_OBJ, get_map_flags(), obj::invisible, MAGIC_MAP_HALF, MAGIC_MAP_SIZE, magic_mapping_mark_recursive(), new_face_struct::magicmap, obj::map, MAP_LAYERS, P_BLOCKSVIEW, P_OUT_OF_MAP, obj::x, and obj::y.

Referenced by draw_magic_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_newmap_cmd()

void map_newmap_cmd ( socket_struct ns)

Sound related function.

Todo:
remove once clients don't try to use this - server closes connection on invalid client.

Newmap command

Definition at line 615 of file request.c.

References socket_struct::lastmap, socket_struct::map_scroll_x, socket_struct::map_scroll_y, Send_With_Handling(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by cfapi_object_teleport(), dimension_door(), enter_map(), process_players1(), set_up_cmd(), teleport(), and transfer_ob().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mark_item_cmd()

void mark_item_cmd ( uint8_t data,
int  len,
player pl 
)

Client wants to mark some object. Lets do so.

Parameters
dataobject tag (4 chars).
lendata size.
plplayer.

Definition at line 723 of file item.c.

References obj::count, draw_ext_info(), draw_ext_info_format(), esrv_get_ob_from_count(), GetInt_String(), llevDebug, LOG(), pl::mark, pl::mark_count, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, obj::name, NDI_UNIQUE, pl::ob, and query_name().

+ Here is the call graph for this function:

◆ metaserver2_init()

int metaserver2_init ( void  )

This initializes the metaserver2 logic - it reads the metaserver2 file, storing the values away. Note that it may be possible/desirable for the server to re-read the values and restart connections (for example, a new metaserver has been added and you want to start updates to it immediately and not restart the server). Because of that, there is some extra logic (has_init) to try to take that into account.

Returns
1 if we will be updating the metaserver, 0 if no metaserver updates

Definition at line 163 of file metaserver.c.

References _LocalMeta2Info::archbase, _LocalMeta2Info::codebase, Settings::confdir, Settings::csport, FALSE, _LocalMeta2Info::flags, FREE_AND_CLEAR, free_metaserver2(), _MetaServer2::hostname, _LocalMeta2Info::hostname, _LocalMeta2Info::html_comment, llevError, LOG(), _LocalMeta2Info::mapbase, MAX_BUF, metaserver2, metaserver2_thread(), ms2_info_mutex, _MetaServer2::next, _LocalMeta2Info::notification, _LocalMeta2Info::portnumber, settings, snprintf, strcasecmp(), strdup(), strdup_local, _LocalMeta2Info::text_comment, and TRUE.

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ metaserver2_thread()

void* metaserver2_thread ( void *  junk)

metserver2_thread is the function called from pthread_create. it is a trivial function - it just sleeps and calls the update function. The sleep time here is really quite arbitrary, but once a minute is probably often enough. A better approach might be to do a time() call and see how long the update takes, and sleep according to that.

Parameters
junkunused.
Returns
This function should never return/exit.

Definition at line 505 of file metaserver.c.

References metaserver2_updates(), and sleep.

Referenced by metaserver2_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ metaserver_init()

void metaserver_init ( void  )

◆ metaserver_update()

void metaserver_update ( void  )

Updates our info in the metaserver Note that this is used for both metaserver1 and metaserver2 - for metaserver2, it just copies dynamic data into private data structure, doing locking in the process.

Definition at line 49 of file metaserver.c.

References cst_tot, first_player, FLAG_AFK, FLAG_WIZ, pl::hidden, CS_Stats::ibytes, _MetaServer2_UpdateInfo::in_bytes, socket_struct::is_bot, obj::map, metaserver2_updateinfo, ms2_info_mutex, pl::next, _MetaServer2_UpdateInfo::num_players, pl::ob, CS_Stats::obytes, _MetaServer2_UpdateInfo::out_bytes, QUERY_FLAG, pl::socket, ST_GET_PARTY_PASSWORD, ST_PLAYING, pl::state, CS_Stats::time_start, and _MetaServer2_UpdateInfo::uptime.

Referenced by block_until_new_connection(), and do_specials().

+ Here is the caller graph for this function:

◆ move_cmd()

void move_cmd ( char *  buf,
int  len,
player pl 
)

Moves an object (typically, container to inventory). syntax is: move (to) (tag) (nrof)

Definition at line 636 of file request.c.

References esrv_move_object(), llevDebug, llevError, LOG(), obj::name, and pl::ob.

+ Here is the call graph for this function:

◆ new_player_cmd()

void new_player_cmd ( uint8_t buf,
int  len,
player pl 
)

This handles the commands issued by the player (ie, north, fire, cast, etc.). This is called with the 'ncom' method which gives more information back to the client so it can throttle.

Parameters
bufdata received.
lenlength of buf.
plplayer who issued the command. Mustn't be NULL.

Definition at line 447 of file request.c.

References pl::count, draw_ext_info_format(), execute_newserver_command(), FABS, GetInt_String(), GetShort_String(), llevDebug, llevError, LOG(), MAX_BUF, MAX_TIME, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, pl::ob, Send_With_Handling(), pl::socket, SockList_AddInt(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), obj::speed, obj::speed_left, ST_PLAYING, and pl::state.

+ Here is the call graph for this function:

◆ play_sound_map()

void play_sound_map ( int8_t  sound_type,
object emitter,
int  dir,
const char *  action 
)

Plays a sound on a map.

Parameters
sound_typesound type, see the sound types.
emitterobject emitting the sound. Must be on a map.
dirdirection the sound is moving.
actionsound name to play.

Definition at line 101 of file sounds.c.

References obj::env, first_player, isqrt(), obj::map, MAX_SOUND_DISTANCE, pl::next, pl::ob, play_sound_player_only(), POW2, RANDOM, obj::sound_chance, obj::x, and obj::y.

Referenced by apply_by_living(), attack_message(), cast_spell(), cf_handle_type_apply(), fire_bow(), hole_type_move_on(), kill_object(), move_player_attack(), player_attack_door(), polymorph_melt(), recharge(), save_life(), trapdoor_type_move_on(), and trigger_type_apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ play_sound_player_only()

void play_sound_player_only ( player pl,
int8_t  sound_type,
object emitter,
int  dir,
const char *  action 
)

Plays a sound for specified player only.

Parameters
plplayer to play sound to.
sound_typesound type, see the sound types.
emitterobject emitting a sound.
dirdirection the sound is moving into.
actionsound name to play.

Definition at line 51 of file sounds.c.

References obj::env, obj::map, MAX_SOUNDS_TICK, obj::name, pl::ob, PLAYER, obj::race, RANDOM, Send_With_Handling(), SND_EFFECTS, SND_MUTE, pl::socket, SockList_AddChar(), SockList_AddLen8Data(), SockList_AddString(), SockList_Init(), SockList_Term(), socket_struct::sound, obj::sound_chance, socket_struct::sounds_this_tick, obj::type, obj::x, and obj::y.

Referenced by apply_manual(), cast_spell(), clock_type_apply(), do_learn_spell(), fire_misc_object(), kill_player(), play_sound_map(), poison_type_apply(), and spellbook_type_apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ player_update_bg_music()

void player_update_bg_music ( object player)

Referenced by cfapi_object_teleport(), dimension_door(), enter_map(), move_player_attack(), process_players1(), teleport(), and transfer_ob().

+ Here is the caller graph for this function:

◆ print_ext_msg()

void print_ext_msg ( socket_struct ns,
int  color,
uint8_t  type,
uint8_t  subtype,
const char *  message 
)

Draws an extended message on the client.

Parameters
nsThe socket to send message to
colorColor informations (used mainly if client does not support message type)
typeThe type of text message
subtypeThe subtype of text message
messageThe main message

make this non-static, so other files can use this to send messages to client before player has been added.

Definition at line 49 of file info.c.

References Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().

Referenced by add_me_cmd(), and draw_ext_info().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rangetostring()

void rangetostring ( const object pl,
char *  obuf,
size_t  len 
)

Get player's current range attack in obuf.

Parameters
plThe player who is being evaluated
obufThe buffer for the range attack string
lenThe length of the buffer

Definition at line 230 of file info.c.

References obj::below, BOW, Settings::casting_time, obj::casting_time, obj::chosen_skill, obj::contr, FLAG_APPLIED, obj::inv, MAX_BUF, obj::name, query_base_name(), QUERY_FLAG, obj::race, range_bow, range_builder, range_golem, range_magic, range_misc, range_none, range_skill, pl::ranges, settings, pl::shoottype, snprintf, obj::spell, TRUE, and obj::type.

Referenced by esrv_update_stats().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reply_cmd()

◆ request_info_cmd()

void request_info_cmd ( char *  buf,
int  len,
socket_struct ns 
)

request_info_cmd is sort of a meta command. There is some specific request of information, but we call other functions to provide that information.

Parameters
bufbuffer containing the information requested.
lenlength of buf, ignored.
nssocket to write data to.

Definition at line 133 of file loop.c.

References socket_struct::host, knowledge_send_info(), llevDebug, LOG(), send_class_info(), send_class_list(), send_exp_table(), send_file(), send_image_info(), send_image_sums(), send_map_info(), send_new_char_info(), send_race_info(), send_race_list(), send_skill_info(), send_spell_paths(), Send_With_Handling(), SockList_AddString(), SockList_Init(), and SockList_Term().

+ Here is the call graph for this function:

◆ send_account_players()

void send_account_players ( socket_struct ns)

Upon successful login/account creation, we send a list of characters associated with the account to the client - in this way, it lets the client present a nice list so that the player can choose one. Note it is important that ns->account_name is set before calling this. Note 2: Some of the operations here are not especially efficient - O(n^2) or repeating same loop instead of trying to combine them. This is not a worry as MAX_CHARACTERS_PER_ACCOUNT is a fairly low value (less than 20), so even inefficient operations don't take much time. If that value as a lot larger, then some rethink may be needed. For now, having clearer code is better than trying to save a few microseconds of execution time.

Parameters
nssocket structure to send data for.

Definition at line 1874 of file request.c.

References account_char_load(), socket_struct::account_chars, account_get_players_for_account(), socket_struct::account_name, ACL_CLASS, ACL_FACE, ACL_FACE_NUM, ACL_LEVEL, ACL_MAP, ACL_NAME, ACL_PARTY, ACL_RACE, add_char_field(), account_char_struct::character_class, esrv_send_face(), account_char_struct::face, socket_struct::faces_sent, find_face(), account_char_struct::isDead, account_char_struct::level, account_char_struct::map, MAX_CHARACTERS_PER_ACCOUNT, account_char_struct::name, account_char_struct::next, NS_FACESENT_FACE, account_char_struct::party, account_char_struct::race, Send_With_Handling(), SockList_AddChar(), SockList_AddShort(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by account_add_player_cmd(), account_login_cmd(), account_new_cmd(), account_password(), key_confirm_quit(), and receive_play_again().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_background_music()

void send_background_music ( player pl,
const char *  music 
)

Sends background music to client.

Parameters
plplayer
musicbackground music name. Can be NULL.

Definition at line 132 of file sounds.c.

References Send_With_Handling(), SND_MUSIC, SND_MUTE, pl::socket, SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::sound.

Referenced by player_update_bg_music().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_class_info()

void send_class_info ( socket_struct ns,
char *  params 
)

Send information on the specified class.

Parameters
nswhere to send.
paramsclass name to send.

Definition at line 380 of file requestinfo.c.

References CLASS, send_arch_info(), Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().

Referenced by request_info_cmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_class_list()

void send_class_list ( socket_struct ns,
char *  params 
)

Sends the list of classes to the client. The reply is kept in a static buffer, as it won't change during server run.

Parameters
nsclient to send to.
paramsignored.

Definition at line 359 of file requestinfo.c.

References build_class_list_reply(), Send_With_Handling(), and SockList_Init().

Referenced by request_info_cmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_exp_table()

void send_exp_table ( socket_struct ns,
char *  params 
)

This sends the experience table the sever is using

Definition at line 121 of file requestinfo.c.

References levels, llevError, LOG(), Settings::max_level, Send_With_Handling(), settings, SockList_AddInt64(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), and SockList_Term().

Referenced by request_info_cmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_face_cmd()

void send_face_cmd ( char *  buff,
int  len,
socket_struct ns 
)

Client has requested pixmap that it somehow missed getting. This will be called often if the client is caching images.

Parameters
buffdata received from the client.
lenlength of buff, ignored.
nssocket to send data to.

Definition at line 43 of file image.c.

References esrv_send_face(), socket_struct::host, llevDebug, and LOG().

+ Here is the call graph for this function:

◆ send_file()

void send_file ( socket_struct ns,
const char *  file 
)

Sends the desired file to the client. In all three cases, we are basically just dumping file contents to the client - nothing more.

Parameters
nssocket to send to
fileWhich file to send - string of either motd, news, rules

Definition at line 443 of file requestinfo.c.

References Settings::confdir, llevError, LOG(), MAX_BUF, Settings::motd, Settings::news, Settings::rules, Send_With_Handling(), settings, snprintf, SockList_AddChar(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by request_info_cmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_image_info()

void send_image_info ( socket_struct ns)

Sends the number of images, checksum of the face file, and the image_info file information. See the doc/Developers/protocol if you want further detail.

Parameters
nssocket to send data to.

Definition at line 112 of file image.c.

References bmaps_checksum, facesets, MAX_FACE_SETS, nrofpixmaps, Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().

Referenced by request_info_cmd().

+ Here is the call graph for this function: