Crossfire Server, Trunk
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)
 
int count_players (void)
 
void create_player_cmd (char *buf, int len, socket_struct *ns)
 
void do_server (void)
 
void draw_client_map (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,...) PRINTF_ARGS(6
 
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, const Animations *anim)
 
void esrv_send_face (socket_struct *ns, const Face *face, 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 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)
 
bool 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)
 
void metaserver2_exit ()
 
int metaserver2_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 reset_stats (struct CS_Stats *stats)
 
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)
 
void send_exp_table (socket_struct *ns)
 
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)
 
void send_skill_extra (socket_struct *ns, char *params)
 
void send_skill_info (socket_struct *ns, char *params)
 
void send_spell_paths (socket_struct *ns)
 
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, unsigned 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 update_players (void)
 
void version_cmd (char *buf, int len, socket_struct *ns)
 
void watchdog (void)
 
void write_cs_stats (void)
 

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 2399 of file request.cpp.

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(), buf, decode_name_password(), dragon_attune::force, socket_struct::host, llevDebug, LOG(), MAX_BUF, give::name, send_account_players(), Send_With_Handling(), SockList_AddString(), SockList_Init(), SockList_Term(), takeitem::status, 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 2186 of file request.cpp.

References account_exists(), account_login(), socket_struct::account_name, buf, decode_name_password(), socket_struct::host, llevDebug, llevInfo, LOG(), MAX_BUF, give::name, send_account_players(), Send_With_Handling(), SockList_AddString(), SockList_Init(), SockList_Term(), takeitem::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 2285 of file request.cpp.

References account_block_create(), account_check_string(), account_exists(), socket_struct::account_name, account_new(), accounts_save(), buf, decode_name_password(), socket_struct::host, llevDebug, llevInfo, LOG(), MAX_BUF, Settings::min_name, give::name, send_account_players(), Send_With_Handling(), settings, SockList_AddString(), SockList_Init(), SockList_Term(), takeitem::status, strdup_local, and VALIDCHAR_MSG.

+ 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 3053 of file request.cpp.

References account_change_password(), account_check_string(), socket_struct::account_name, buf, decode_name_password(), report::error(), socket_struct::host, llevDebug, LOG(), MAX_BUF, send_account_players(), Send_With_Handling(), SockList_AddString(), SockList_Init(), SockList_Term(), takeitem::status, and VALIDCHAR_MSG.

Referenced by account_login(), and account_new().

+ Here is the call graph for this function:
+ Here is the caller 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 415 of file request.cpp.

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

+ Here is the call graph for this function:

◆ apply_cmd()

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

Client wants to apply some object. Lets do so.

Definition at line 668 of file item.cpp.

References apply_by_living(), buf, esrv_get_ob_from_count(), esrv_send_inventory(), FLAG_REMOVED, llevDebug, LOG(), give::op, altar_valkyrie::pl, QUERY_FLAG, and CFweardisguise::tag.

+ Here is the call graph for this function:

◆ 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 503 of file request.cpp.

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

+ Here is the call graph for this function:

◆ count_players()

int count_players ( void  )

Definition at line 49 of file metaserver.cpp.

References first_player, FLAG_AFK, FLAG_WIZ, altar_valkyrie::pl, QUERY_FLAG, ST_GET_PARTY_PASSWORD, and ST_PLAYING.

Referenced by check_shutdown(), and metaserver_update().

+ Here is the caller graph for this function:

◆ create_player_cmd()

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

We have received a createplayer command.

Parameters
bufreceived command.
lenlength of buf.
nssocket to communicate with the client.

too long, buffer overflow

Definition at line 2633 of file request.cpp.

References account_check_string(), add_player(), ADD_PLAYER_NEW, ADD_PLAYER_NO_MAP, ADD_PLAYER_NO_STATS_ROLL, apply_race_and_class(), archininventory::arch, arch_to_object(), buf, check_race_and_class(), CLASS, decode_name_password(), draw_ext_info_format(), enter_exit(), first_player, FLAG_AUTO_APPLY, FLAG_REMOVED, FREE_AND_COPY, get_archetype_by_type_subtype(), get_attr_value(), socket_struct::host, castle_read::key, llevDebug, llevError, llevInfo, LOG(), socket_struct::login_method, disinfect::map, MAP, MAP_TYPE_CHOICE, MAP_TYPE_DEFAULT, MAX_BUF, MAX_CHOICES, Settings::min_name, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_PLAYER, give::name, NDI_ALL, NDI_DK_ORANGE, NDI_UNIQUE, newhash(), Ns_Add, Ns_Avail, NUM_STATS, ob_apply(), object_get_value(), object_insert_in_ob(), object_remove(), give::op, altar_valkyrie::pl, PLAYER, player_set_state(), playername_ok(), QUERY_FLAG, safe_strncpy, Send_With_Handling(), set_attr_value(), settings, short_stat_name, SockList_AddPrintf(), SockList_AddString(), SockList_Init(), SockList_Term(), ST_PLAYING, Settings::starting_stat_max, Settings::starting_stat_min, Settings::starting_stat_points, takeitem::status, socket_struct::status, strcasecmp(), try_find_archetype(), VALIDCHAR_MSG, autojail::value, and verify_player().

+ Here is the call graph for this function:

◆ do_server()

void do_server ( void  )

This checks the sockets for input and exceptions, does the right thing.

A bit of this code is grabbed out of socket.c There are 2 lists we need to look through - init_sockets is a list

Definition at line 535 of file loop.cpp.

References Socket_Info::allocated_sockets, check_all_fds(), cst_lst, final_free_player(), first_player, free_newsocket(), get_sleep_remaining(), handle_client(), init_listening_socket(), init_sockets, jump_time(), last_time, leave(), llevError, llevInfo, LOG(), MAX, Socket_Info::max_filedescriptor, CS_Stats::max_ticktime, new_connection(), give::next, Ns_Add, Ns_Avail, Ns_Dead, altar_valkyrie::pl, save_player(), send_delayed_buffers(), send_updates(), socket_info, takeitem::status, socket_struct::status, CS_Stats::ticks, CS_Stats::ticks_overtime, Socket_Info::timeout, and CS_Stats::total_ticktime.

Referenced by server_main().

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

◆ draw_client_map()

void draw_client_map ( object pl)

Draws client map.

Definition at line 1648 of file request.cpp.

References draw_client_map2(), get_map_flags(), mapstruct::in_memory, llevError, LOG(), m, MAP_IN_MEMORY, map_reset_swap(), P_NEED_UPDATE, P_NEW_MAP, P_OUT_OF_MAP, altar_valkyrie::pl, PLAYER, update_los(), and update_position().

Referenced by send_updates().

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

◆ draw_ext_info()

void draw_ext_info ( int  ,
int  ,
const object ,
uint8_t  ,
uint8_t  ,
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.

Dummy functions to link the library.

Definition at line 308 of file main.cpp.

References do_print_ext(), first_player, FLAG_WIZ, flags, i18n(), llevInfo, LOG(), logfile, diamondslots::message, NDI_ALL, NDI_ALL_DMS, NDI_COLOR_MASK, NDI_DELAYED, NDI_NO_TRANSLATE, player::next, player::ob, altar_valkyrie::pl, PLAYER, player_get_delayed_buffer(), print_ext_msg(), QUERY_FLAG, is_valid_types_gen::type, and nlohmann::detail::void().

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_bless(), 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_heal_and_mana(), check_login(), check_name(), check_pick(), command_abil(), command_accountpasswd(), command_addexp(), command_afk(), command_arrest(), command_banish(), command_body(), command_bowmode(), command_brace(), command_create(), command_delete(), command_diff(), command_drop(), command_dropall(), command_dump(), command_empty(), command_face(), command_fire(), command_follow(), command_forget_spell(), command_free(), command_freeze(), command_goto(), command_gsay(), command_insert_into(), command_inventory(), command_invisible(), command_kill_pets(), command_language(), command_learn_spell_or_prayer(), command_list(), 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_swap(), command_take(), command_teleport(), command_tell_all(), command_title(), command_toggle_shout(), command_unloadplugin(), command_use(), command_uskill(), command_whereabouts(), command_wimpy(), command_wizcast(), command_wizpass(), confuse_living(), create_aura(), create_bomb(), cure_disease(), current_map_info(), dimension_door(), dispel_rune(), display_help_file(), display_motd(), display_new_pickup(), display_who_entry(), dm_stack_peek(), dm_stack_pop(), dm_stack_push(), do_dump(), do_hidden_move(), do_shutdown(), do_skill(), do_skill_attack(), do_skill_by_number(), 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_common(), emergency_save(), enter_map(), examine(), examine_fluff(), examine_monster(), examine_rod_charge_level(), examine_wand_charge_level(), 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_add_probe_monster(), knowledge_alchemy_attempt(), knowledge_display(), knowledge_do_attempt(), knowledge_do_display(), knowledge_item_can_be_used_alchemy(), knowledge_show(), knowledge_write_player_data(), lighter_type_apply(), list_players(), lock_item_cmd(), look_at(), look_at_cmd(), 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_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_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(), restore_player(), ring_bell(), save_player(), scroll_failure(), scroll_type_apply(), send_rules(), 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(), town_portal_destroy_existing(), town_portal_find_force(), trap_disarm(), trapdoor_type_move_on(), treasure_type_apply(), trigger_type_apply(), unapply_for_ob(), unhide(), 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,
  ... 
)

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(), 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_bless(), cast_raise_dead_spell(), cast_smite_spell(), cast_spell(), change_abil(), change_spell(), check_login(), check_name(), check_pick(), check_sacrifice(), check_shutdown(), 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_face(), command_find(), command_follow(), command_forget_spell(), command_freeze(), 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_partial_commands(), 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(), create_player_cmd(), 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_follow(), do_forget_spell(), do_harvest(), do_learn_spell(), do_light(), 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(), examine_autoidentify(), examine_fluff(), examine_weight_and_material(), 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(), hiscore_check(), hiscore_display(), 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(), knowledge_give(), lamp_type_apply(), leave(), lightable_type_apply(), lighter_type_apply(), list_players(), lock_item_cmd(), login_check_shutdown(), look_at(), magic_wall(), make_matcher(), malloc_info(), map_info(), mark_item_cmd(), mimic_type_apply(), 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(), print_tod(), process_object(), 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(), shop_describe(), shop_pay_unpaid_callback(), show_matching_spells(), show_skills(), singing(), skill_ident(), 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(), unhide(), use_alchemy(), use_oratory(), use_skill(), worship_forbids_use(), write_note(), write_on_item(), write_rune(), and write_scroll().

◆ 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 474 of file info.cpp.

References FACE_FLOOR, llevError, LOG(), MAGIC_MAP_HALF, MAGIC_MAP_SIZE, magic_mapping_mark(), MAX, MIN, altar_valkyrie::pl, PLAYER, Send_With_Handling(), SockList_AddChar(), SockList_AddPrintf(), SockList_Init(), SockList_Term(), diamondslots::x, and diamondslots::y.

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 1950 of file request.cpp.

References append_spell(), FOR_INV_FINISH, FOR_INV_PREPARE, llevError, LOG(), object::msg, object::name, object_get_value(), altar_valkyrie::pl, Send_With_Handling(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), SockList_Term(), SPELL, sstring, object::type, and autojail::value.

Referenced by apply_race_and_class(), 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 381 of file main.cpp.

References FLAG_CLIENT_SENT, guildjoin::ob, altar_valkyrie::pl, QUERY_FLAG, Send_With_Handling(), SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Term(), and nlohmann::detail::void().

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

void esrv_draw_look ( object pl)

Send the look window. Don't need to do animations here This sends all the faces to the client, not just updates. This is because object ordering would otherwise be inconsistent

Definition at line 193 of file item.cpp.

References add_object_to_socklist(), object::below, buf, empty_face, esrv_send_face(), FLAG_IS_FLOOR, FLAG_REMOVED, FLAG_WIZ, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, GET_MAP_OB, HEAD, llevDebug, LOG(), LOOK_OBJ, MAP_IN_MEMORY, MAX, MAX_BUF, MAXITEMLEN, MIN, NS_FACESENT_FACE, Face::number, out_of_map(), altar_valkyrie::pl, QUERY_FLAG, Send_With_Handling(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), SockList_Term(), and Ice::tmp.

Referenced by send_updates(), and set_up_cmd().

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

◆ esrv_map_scroll()

◆ 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 899 of file item.cpp.

References CONTAINER, replace::current, drop_object(), env, esrv_get_ob_from_count(), esrv_update_item(), FLAG_APPLIED, FOR_INV_FINISH, FOR_INV_PREPARE, llevDebug, LOG(), object_can_pick(), give::op, pick_up(), altar_valkyrie::pl, put_object_in_sack(), QUERY_FLAG, sack_can_hold(), CFweardisguise::tag, transport_can_hold(), 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 1009 of file request.cpp.

References esrv_send_face(), FLAG_CLIENT_SENT, NS_FACESENT_FACE, altar_valkyrie::pl, Send_With_Handling(), SET_FLAG, 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 1813 of file request.cpp.

References object::count, object::env, llevError, LOG(), altar_valkyrie::pl, Send_With_Handling(), 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,
const Animations anim 
)

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.

Parameters
nswhere to send the animation.
animanimation to send.

Definition at line 1039 of file request.cpp.

References animate::anim, socket_struct::anims_sent, esrv_send_face(), socket_struct::faces_sent, llevError, LOG(), NS_FACESENT_FACE, 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,
const Face face,
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.
faceface to send.
nocacheif 1 then send a 'image2', else depending on client cache setting.

Definition at line 72 of file image.cpp.

References face_info::checksum, face_info::data, face_info::datalen, socket_struct::facecache, face_sets::faces, socket_struct::faces_sent, socket_struct::faceset, find_faceset(), get_face_fallback(), face_sets::id, llevError, LOG(), Face::name, NS_FACESENT_FACE, Face::number, 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 316 of file item.cpp.

References add_object_to_socklist(), buf, empty_face, FOR_INV_FINISH, FOR_INV_PREPARE, HEAD, LOOK_OBJ, MAX, MAX_BUF, MAXITEMLEN, MIN, Face::number, give::op, altar_valkyrie::pl, Send_With_Handling(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), SockList_Term(), and Ice::tmp.

Referenced by apply_cmd(), apply_container(), apply_race_and_class(), check_login(), command_possess(), key_change_class(), player_changer_type_process(), save_player(), send_updates(), 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 
)

Sends item's info to player.

Definition at line 354 of file main.cpp.

References add_object_to_socklist(), FLAG_CLIENT_SENT, HEAD, LOOK_OBJ, guildjoin::ob, give::op, altar_valkyrie::pl, Send_With_Handling(), SET_FLAG, SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Term(), and nlohmann::detail::void().

Referenced by apply_container(), cast_detection(), dragon_ability_gain(), object_insert_in_ob(), and transmute_item_to_flower().

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

◆ 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 1836 of file request.cpp.

References altar_valkyrie::pl, Send_With_Handling(), SockList_AddInt(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by check_login(), display_new_pickup(), and kill_player_not_permadeath().

+ 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 359 of file main.cpp.

References CUSTOM_NAME_FIELD, esrv_send_face(), FABS, FLAG_ANIMATE, FLAG_CLIENT_SENT, FLAG_NO_PICK, flags, HEAD, make_face_from_files::int, LOOK_OBJ, MAX_BUF, NS_FACESENT_FACE, object_get_value(), give::op, altar_valkyrie::pl, query_base_name(), QUERY_FLAG, query_flags(), Send_With_Handling(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), sstring, strlcpy(), UPD_ANIM, UPD_ANIMSPEED, UPD_FACE, UPD_FLAGS, UPD_LOCATION, UPD_NAME, UPD_NROF, UPD_WEIGHT, nlohmann::detail::void(), and WEIGHT.

Referenced by animate_weapon(), apply_container(), apply_race_and_class(), apply_special(), book_type_apply(), cancellation(), cast_identify(), cast_item_curse_or_bless(), cfapi_object_set_property(), command_drop(), command_dropall(), command_insert_into(), command_lock_item(), command_rename_item(), command_take(), detect_curse_on_item(), detect_magic_on_item(), 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_remove(), object_update(), pick_up_object(), player_changer_type_process(), power_crystal_type_apply(), put_object_in_sack(), remove_curse(), sell_item(), send_changed_object(), send_updates(), shop_pay_unpaid_callback(), 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 386 of file main.cpp.

References flags, FOR_INV_FINISH, FOR_INV_PREPARE, get_client_spell_state(), client_spell::last_dam, client_spell::last_grace, client_spell::last_sp, altar_valkyrie::pl, Send_With_Handling(), 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, UPD_SP_DAMAGE, UPD_SP_GRACE, UPD_SP_MANA, and nlohmann::detail::void().

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 867 of file request.cpp.

References AddIfFloat, AddIfInt, AddIfInt64, AddIfShort, AddIfString, atnr_cs_stat, ATNR_PHYSICAL, buf, object::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, FLAG_FREED, FLAG_REMOVED, flags, get_skill_client_code(), get_weight_limit(), living::hp, SockList::len, llevDebug, LOG(), MAX_BUF, MAX_SKILLS, living::maxhp, NROFATTACKS, altar_valkyrie::pl, QUERY_FLAG, range_golem, rangetostring(), send_extra_stats(), Send_With_Handling(), set_title(), SF_FIREON, SF_RUNON, SockList_AddChar(), SockList_AddInt64(), SockList_AddString(), SockList_Init(), SockList_Term(), and object::stats.

Referenced by send_updates().

+ 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 646 of file item.cpp.

References buf, do_dump(), esrv_get_ob_from_count(), examine(), FLAG_WIZ, llevDebug, LOG(), give::op, altar_valkyrie::pl, QUERY_FLAG, and CFweardisguise::tag.

+ Here is the call graph for this function:

◆ ext_info_map()

void 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 334 of file main.cpp.

References smoking_pipe::color, draw_ext_info(), first_player, logfile, disinfect::map, altar_valkyrie::pl, is_valid_types_gen::type, and nlohmann::detail::void().

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 219 of file info.cpp.

References smoking_pipe::color, draw_ext_info(), first_player, disinfect::map, give::op, altar_valkyrie::pl, and is_valid_types_gen::type.

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 245 of file info.cpp.

References smoking_pipe::color, draw_ext_info(), first_player, disinfect::map, altar_valkyrie::pl, and is_valid_types_gen::type.

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 453 of file init.cpp.

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

Referenced by check_login(), do_server(), and save_and_kick_all_players().

+ 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 401 of file init.cpp.

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

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 418 of file init.cpp.

References account_char_free(), account_char_save(), socket_struct::account_chars, account_logout(), socket_struct::account_name, socket_struct::faces_sent, socket_struct::fd, FREE_AND_CLEAR, statsinfo::god, 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 254 of file lowlevel.cpp.

References navar-midane_time::data.

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 258 of file lowlevel.cpp.

References navar-midane_time::data.

Referenced by new_player_cmd().

+ Here is the caller graph for this function:

◆ handle_client()

bool 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
Returns
If the main loop should continue processing this client.

Definition at line 257 of file loop.cpp.

References SockList::buf, navar-midane_time::data, socket_struct::faces_sent, socket_struct::fd, handle_cmd(), socket_struct::inbuf, socket_struct::last_tick, SockList::len, Ns_Dead, altar_valkyrie::pl, SockList_NullTerminate(), SockList_ReadPacket(), SockList_ResetRead(), ST_PLAYING, takeitem::status, and socket_struct::status.

Referenced by do_server().

+ 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 96 of file init.cpp.

References account_char_free(), socket_struct::account_chars, socket_struct::account_name, Socket_Info::allocated_sockets, socket_struct::anims_sent, SockList::buf, 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, FREE_AND_CLEAR, get_faces_count(), socket_struct::heartbeat, socket_struct::host, socket_struct::inbuf, socket_struct::is_bot, socket_struct::lastmap, llevError, LOG(), socket_struct::login_method, socket_struct::look_position, MAP_CLIENT_X_DEFAULT, MAP_CLIENT_Y_DEFAULT, 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, Ns_Add, NS_FACESENT_FACE, socket_struct::num_look_objects, socket_struct::password_fails, Send_With_Handling(), set_output_sock_buf(), socket_info, SOCKETBUFSIZE, SockList_AddPrintf(), SockList_Init(), SockList_ResetRead(), SockList_Term(), socket_struct::sound, socket_struct::sounds_this_tick, socket_struct::stats, socket_struct::status, strdup_local, guildbuy::temp, 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 192 of file init.cpp.

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

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  )

◆ 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 117 of file image.cpp.

References find_faceset().

Referenced by main(), and set_up_cmd().

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

◆ lock_item_cmd()

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

◆ 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 798 of file item.cpp.

References CONTAINER, 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, commongive::inv, inventory(), m, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, MSG_TYPE_COMMAND_SUCCESS, give::name, NDI_UNIQUE, give::op, out_of_map(), QUERY_FLAG, query_name(), Ice::tmp, diamondslots::x, and diamondslots::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 869 of file item.cpp.

References buf, draw_ext_info(), FABS, llevDebug, LOG(), look_at(), MAP_CLIENT_X, MAP_CLIENT_Y, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, NDI_UNIQUE, altar_valkyrie::pl, and player_can_see().

+ 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 427 of file info.cpp.

References blank_face, FACE_FLOOR, FACE_WALL, GET_MAP_FACE_OBJ, get_map_flags(), banquet::l, MAGIC_MAP_HALF, MAGIC_MAP_SIZE, magic_mapping_mark_recursive(), Face::magicmap, MAP_LAYERS, guildjoin::ob, P_BLOCKSVIEW, P_OUT_OF_MAP, altar_valkyrie::pl, diamondslots::x, and diamondslots::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 687 of file request.cpp.

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 dimension_door(), do_follow(), enter_map(), object_teleport(), 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 767 of file item.cpp.

References navar-midane_time::data, draw_ext_info(), draw_ext_info_format(), esrv_get_ob_from_count(), GetInt_String(), llevDebug, LOG(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, give::name, NDI_UNIQUE, give::op, altar_valkyrie::pl, query_name(), and CFweardisguise::tag.

+ Here is the call graph for this function:

◆ metaserver2_exit()

void metaserver2_exit ( )

Stop metaserver updates.

Definition at line 493 of file metaserver.cpp.

References metaserver_thread, and ms2_signal.

Referenced by cleanup().

+ Here is the caller 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 332 of file metaserver.cpp.

References LocalMeta2Info::archbase, buf, LocalMeta2Info::codebase, Settings::confdir, Settings::csport, FALSE, LocalMeta2Info::flags, FREE_AND_CLEAR, LocalMeta2Info::hostname, LocalMeta2Info::html_comment, llevError, local_info, LOG(), LocalMeta2Info::mapbase, MAX_BUF, metaserver2_thread(), metaserver2_updateinfo, metaserver_thread, metaservers, ms2_signal, LocalMeta2Info::notification, LocalMeta2Info::portnumber, settings, strcasecmp(), 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:

◆ 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 81 of file metaserver.cpp.

References count_players(), cst_tot, CS_Stats::ibytes, MetaServer2_UpdateInfo::in_bytes, metaserver2_updateinfo, ms2_info_mutex, MetaServer2_UpdateInfo::num_players, CS_Stats::obytes, MetaServer2_UpdateInfo::out_bytes, CS_Stats::time_start, and MetaServer2_UpdateInfo::uptime.

Referenced by do_specials().

+ Here is the call graph for this function:
+ 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 708 of file request.cpp.

References buf, esrv_move_object(), llevDebug, llevError, LOG(), and altar_valkyrie::pl.

+ 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 527 of file request.cpp.

References buf, devourers::command, command_execute(), draw_ext_info_format(), FABS, GetInt_String(), GetShort_String(), make_face_from_files::int, llevDebug, llevError, LOG(), MAX_BUF, MAX_TIME, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, altar_valkyrie::pl, Send_With_Handling(), SockList_AddInt(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), and ST_PLAYING.

+ 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 113 of file sounds.cpp.

References convert::action, object::env, first_player, ihypot(), object::map, MAX_SOUND_DISTANCE, altar_valkyrie::pl, play_sound_player_only(), RANDOM, object::sound_chance, object::x, and object::y.

Referenced by apply_by_living(), attack_message(), attack_ob_simple(), button_type_move_on(), cast_spell(), cf_handle_type_apply(), fire_bow(), food_type_apply(), gate_type_process(), hole_type_move_on(), kill_object(), move_ob(), move_player_attack(), player_attack_door(), polymorph_melt(), potion_type_apply(), 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.cpp.

References convert::action, object::arch, archetype::clone, object::env, EXIT, FABS, object::map, MAX_SOUNDS_TICK, MIN, give::name, object::name, altar_valkyrie::pl, PLAYER, object::race, Send_With_Handling(), SND_EFFECTS, SND_MUTE, SockList_AddChar(), SockList_AddLen8Data(), SockList_AddString(), SockList_Init(), SockList_Term(), sstring, object::type, object::x, and object::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)

Definition at line 170 of file sounds.cpp.

References pick_bg_music(), PLAYER, and send_background_music().

Referenced by dimension_door(), do_follow(), object_teleport(), player_map_change_common(), teleport(), and transfer_ob().

+ Here is the call graph for this function:
+ 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 62 of file info.cpp.

References smoking_pipe::color, do_print_ext(), diamondslots::message, Send_With_Handling(), SockList_Term(), and is_valid_types_gen::type.

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 264 of file info.cpp.

References BOW, Settings::casting_time, FLAG_APPLIED, MAX_BUF, give::name, give::op, altar_valkyrie::pl, query_base_name(), QUERY_FLAG, range_bow, range_builder, range_golem, range_magic, range_misc, range_none, range_skill, settings, and TRUE.

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 136 of file loop.cpp.

References buf, socket_struct::host, knowledge_send_info(), llevDebug, LOG(), roll-o-matic::params, 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_extra(), send_skill_info(), send_spell_paths(), Send_With_Handling(), SockList_AddString(), SockList_Init(), and SockList_Term().

+ Here is the call graph for this function:

◆ reset_stats()

void reset_stats ( struct CS_Stats stats)

Referenced by init_server().

+ Here is the caller 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 2059 of file request.cpp.

References account_char_free(), account_char_load(), socket_struct::account_chars, account_get_additional_chars(), 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_Chars::chars, esrv_send_face(), socket_struct::faces_sent, free_charlinks(), linked_char::next, NS_FACESENT_FACE, Face::number, Send_With_Handling(), SockList_AddChar(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), and try_find_face().

Referenced by account_add_player_cmd(), account_login_cmd(), account_new_cmd(), account_password(), key_confirm_quit(), kill_player_permadeath(), 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 150 of file sounds.cpp.

References altar_valkyrie::pl, Send_With_Handling(), SND_MUSIC, SND_MUTE, SockList_AddString(), SockList_Init(), and SockList_Term().

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 413 of file requestinfo.cpp.

References CLASS, archetype::clone, socket_struct::host, llevError, LOG(), roll-o-matic::params, send_arch_info(), Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), SockList_Term(), try_find_archetype(), and object::type.

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)

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.

Definition at line 392 of file requestinfo.cpp.

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)

This sends the experience table the sever is using.

Parameters
nswhere to write the information.

Definition at line 158 of file requestinfo.cpp.

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 45 of file image.cpp.

References esrv_send_face(), get_face_by_id(), 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 479 of file requestinfo.cpp.

References buf, Settings::confdir, mad_mage_user::file, llevError, LOG(), MAX_BUF, Settings::motd, Settings::news, Settings::rules, Send_With_Handling(), settings, 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 113 of file image.cpp.

References checksum(), face_sets::comment, AssetsCollection< T, Key >::each(), face_sets::extension, dragon_attune::faces, AssetsManager::facesets(), face_sets::fallback, face_sets::fullname, get_faces_count(), getManager(), face_sets::id, face_sets::prefix, Send_With_Handling(), face_sets::size, 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_image_sums()

void send_image_sums ( socket_struct ns,
char *  params 
)

Sends requested face information.

Parameters
nssocket to send to
paramscontains first and last index of face

For each image in [start..stop] sends

  • checksum
  • name

Definition at line 138 of file image.cpp.

References face_info::checksum, face_sets::faces, socket_struct::faces_sent, socket_struct::faceset, find_faceset(), get_face_by_id(), get_face_fallback(), get_faces_count(), face_sets::id, llevError, LOG(), Face::name, NS_FACESENT_FACE, Face::number, roll-o-matic::params, Send_With_Handling(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_Avail(), SockList_Init(), SockList_Reset(), SockList_Term(), and roll-o-matic::stop().

Referenced by request_info_cmd().

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

◆ send_map_info()

void send_map_info ( socket_struct ns)

Send information on available start maps.

Parameters
nswhere to send.

Definition at line 441 of file requestinfo.cpp.

References AssetsManager::archetypes(), AssetsCollection< T, Key >::each(), getManager(), m, MAP, MAP_TYPE_CHOICE, SockList_AddPrintf(), 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_new_char_info()

void send_new_char_info ( socket_struct ns)

Sends information related to creating a new character to the client.

Parameters
nssocket to send to

Definition at line 520 of file requestinfo.cpp.

References buf, MAX_BUF, NUM_STATS, safe_strcat(), Send_With_Handling(), settings, short_stat_name, SockList_AddLen8Data(), SockList_AddString(), SockList_Init(), SockList_Term(), Settings::starting_stat_max, Settings::starting_stat_min, and Settings::starting_stat_points.

Referenced by request_info_cmd().

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

◆ send_plugin_custom_message()

void send_plugin_custom_message ( object pl,
char *  buf 
)

GROS: The following one is used to allow a plugin to send a generic cmd to a player. Of course, the client need to know the command to be able to manage it !

Definition at line 1747 of file request.cpp.

References buf, altar_valkyrie::pl, Send_With_Handling(), SockList_AddString(), SockList_Init(), and SockList_Term().

+ Here is the call graph for this function:

◆ send_query()

void send_query ( socket_struct ns,
uint8_t  flags,
const char *  text 
)

Asks the client to query the user. This way, the client knows it needs to send something back (vs just printing out a message)

Definition at line 746 of file request.cpp.

References flags, Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), SockList_Term(), and guild_entry::text.

Referenced by command_delete(), command_passwd(), confirm_password(), get_name(), get_party_password(), get_password(), key_change_class(), key_roll_stat(), play_again(), receive_player_password(), and roll_again().

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

◆ send_race_info()

void send_race_info ( socket_struct ns,
char *  params 
)

Sends information on specified race to the client.

Parameters
nswhere to send.
paramsrace name to send.

Definition at line 347 of file requestinfo.cpp.

References archetype::clone, socket_struct::host, llevError, LOG(), roll-o-matic::params, PLAYER, send_arch_info(), Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), SockList_Term(), try_find_archetype(), and object::type.

Referenced by request_info_cmd().

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

◆ send_race_list()

void send_race_list ( socket_struct ns)

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

Parameters
nswhere to send.

Definition at line 326 of file requestinfo.cpp.

References build_race_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_skill_extra()

void send_skill_extra ( socket_struct ns,
char *  params 
)

Send extra skill information.

Parameters
nswhere to write the information.
paramsignored.

Definition at line 102 of file requestinfo.cpp.

References CS_STAT_SKILLINFO, llevError, LOG(), MAX_SKILLS, roll-o-matic::params, Send_With_Handling(), skill_messages, skill_names, SockList_AddLen16Data(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Term(), and nlohmann::detail::void().

Referenced by request_info_cmd().

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

◆ send_skill_info()

void send_skill_info ( socket_struct ns,
char *  params 
)

This sends the skill number to name mapping.

Parameters
nswhere to write the information.
paramsif '1', then send the face along the skill, else just send the skill name.

Definition at line 71 of file requestinfo.cpp.

References CS_STAT_SKILLINFO, esrv_send_face(), socket_struct::faces_sent, llevError, LOG(), MAX_SKILLS, NS_FACESENT_FACE, Face::number, roll-o-matic::params, Send_With_Handling(), skill_faces, skill_names, SockList_AddPrintf(), 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_spell_paths()

void send_spell_paths ( socket_struct ns)

This sends the spell path to name mapping.

Parameters
nswhere to write the information.

Definition at line 132 of file requestinfo.cpp.

References llevError, LOG(), NRSPELLPATHS, Send_With_Handling(), SockList_AddPrintf(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Term(), and spellpathnames.

Referenced by request_info_cmd().

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

◆ send_tick()

void send_tick ( player pl)

Definition at line 2004 of file request.cpp.

References altar_valkyrie::pl, pticks, Send_With_Handling(), SockList_AddInt(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by update_players().

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

◆ Send_With_Handling()

◆ set_face_mode_cmd()

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

◆ set_sound_cmd()

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

◆ set_title()

void set_title ( const object pl,
char *  buf,
size_t  len 
)

Sets player title.

Definition at line 334 of file info.cpp.

References buf, altar_valkyrie::pl, and player_get_title().

Referenced by esrv_update_stats().

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

◆ set_up_cmd()

◆ SockList_AddChar()

◆ SockList_AddData()

void SockList_AddData ( SockList sl,
const void *  data,
size_t  len 
)

Adds a data block.

Parameters
slthe SockList instance to add to
datathe value to add
lenthe length in byte

Definition at line 167 of file lowlevel.cpp.

References SockList::buf, navar-midane_time::data, SockList::len, and SockList_Ensure().

Referenced by append_spell(), esrv_send_face(), send_arch_info(), SockList_AddLen16Data(), SockList_AddLen8Data(), and SockList_AddString().

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

◆ SockList_AddInt()

void SockList_AddInt ( SockList sl,
uint32_t  data 
)

◆ SockList_AddInt64()

void SockList_AddInt64 ( SockList sl,
uint64_t  data 
)

Adds a 64 bit value.

Parameters
slthe SockList instance to add to
datathe value to add

Definition at line 140 of file lowlevel.cpp.

References SockList::buf, navar-midane_time::data, SockList::len, and SockList_Ensure().

Referenced by esrv_update_stats(), and send_exp_table().

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

◆ SockList_AddLen16Data()

void SockList_AddLen16Data ( SockList sl,
const void *  data,
size_t  len 
)

Adds a data block prepended with an 16 bit length field.

Parameters
slthe SockList instance to add to
datathe value to add
lenthe length in byte; must not exceed 65535

Definition at line 191 of file lowlevel.cpp.

References navar-midane_time::data, SockList_AddData(), and SockList_AddShort().

Referenced by knowledge_process_incremental(), quest_send_initial_states(), quest_set_state(), and send_skill_extra().

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

◆ SockList_AddLen8Data()

void SockList_AddLen8Data ( SockList sl,
const void *  data,
size_t  len 
)

Adds a data block prepended with an 8 bit length field.

Parameters
slthe SockList instance to add to
datathe value to add
lenthe length in byte; must not exceed 255

Definition at line 179 of file lowlevel.cpp.

References navar-midane_time::data, SockList_AddChar(), and SockList_AddData().

Referenced by add_object_to_socklist(), append_spell(), esrv_draw_look(), esrv_new_player(), esrv_send_inventory(), esrv_update_item(), play_sound_player_only(), send_arch_info(), send_image_sums(), and send_new_char_info().

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

◆ SockList_AddPrintf()

void SockList_AddPrintf ( SockList sl,
const char *  format,
  ... 
)

Adds a printf like formatted string.

Parameters
slthe SockList instance to add to
formatthe format specifier

Definition at line 202 of file lowlevel.cpp.

References SockList::buf, SockList::len, llevError, and LOG().

Referenced by account_play_cmd(), create_player_cmd(), do_print_ext(), draw_magic_map(), esrv_draw_look(), esrv_send_inventory(), init_connection(), knowledge_send_info(), send_class_info(), send_image_info(), send_image_sums(), send_map_info(), send_query(), send_race_info(), send_skill_info(), send_spell_paths(), and set_up_cmd().

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

◆ SockList_AddShort()

◆ SockList_AddString()

◆ SockList_AddStringBuffer()

void SockList_AddStringBuffer ( SockList sl,
StringBuffer sb 
)

Deallocates string buffer instance and appends its contents. The passed StringBuffer must not be accessed afterwards.

Parameters
slthe SockList instance to add to
sbthe StringBuffer to deallocate

Definition at line 225 of file lowlevel.cpp.

References SockList_AddString(), and stringbuffer_finish().

+ Here is the call graph for this function:

◆ SockList_Avail()

size_t SockList_Avail ( const SockList sl)

Returns the available bytes in a SockList instance.

Returns
the available bytes

Definition at line 246 of file lowlevel.cpp.

References SockList::buf, and SockList::len.

Referenced by esrv_add_spells(), esrv_draw_look(), esrv_send_inventory(), knowledge_process_incremental(), quest_send_initial_states(), send_exp_table(), send_image_sums(), send_skill_extra(), send_skill_info(), and send_spell_paths().

+ Here is the caller graph for this function:

◆ SockList_Init()

◆ SockList_NullTerminate()

void SockList_NullTerminate ( SockList sl)

Adds a NUL byte without changing the length.

Parameters
slthe SockList instance to add to

Definition at line 237 of file lowlevel.cpp.

References SockList::buf, SockList::len, and SockList_Ensure().

Referenced by handle_client().

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

◆ SockList_ReadPacket()

int SockList_ReadPacket ( int  fd,
SockList sl,
int  len 
)

This reads from fd and puts the data in sl. We return true if we think we have a full packet, 0 if we have a partial packet, or -1 if an error occurred. The only processing we do is remove the initial size value. len (As passed) is the size of the buffer allocated in the socklist. We make the assumption the buffer is at least 2 bytes long.

Definition at line 275 of file lowlevel.cpp.

References SockList::buf, cst_lst, cst_tot, CS_Stats::ibytes, if(), SockList::len, llevDebug, llevError, LOG(), and nlohmann::detail::void().

Referenced by handle_client().

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

◆ SockList_Reset()

void SockList_Reset ( SockList sl)

Resets the length of the stored data for writing. Does not free or re-allocate resources.

Parameters
slthe SockList instance to reset

Definition at line 74 of file lowlevel.cpp.

References SockList::len.

Referenced by build_class_list_reply(), esrv_add_spells(), esrv_draw_look(), esrv_send_inventory(), knowledge_process_incremental(), quest_send_initial_states(), send_image_sums(), and SockList_Init().

+ Here is the caller graph for this function:

◆ SockList_ResetRead()

void SockList_ResetRead ( SockList sl)

Resets the length of the stored data for reading. Does not free or re-allocate resources.

Parameters
slthe SockList instance to reset

Definition at line 83 of file lowlevel.cpp.

References SockList::len.

Referenced by account_play_cmd(), handle_client(), init_connection(), and set_player_socket().

+ Here is the caller graph for this function:

◆ SockList_Term()

◆ toggle_extended_infos_cmd()

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

◆ toggle_extended_text_cmd()

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

◆ update_players()

void update_players ( )

Send updates to players. Called once per tick.

Definition at line 681 of file loop.cpp.

References connection_alive(), first_player, llevDebug, LOG(), give::next, altar_valkyrie::pl, send_tick(), send_updates(), and ST_PLAYING.

Referenced by server_main().

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

◆ version_cmd()

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

Client tells its version. If there is a mismatch, we close the socket. In real life, all we should care about is the client having something older than the server. If we assume the client will be backwards compatible, having it be a later version should not be a problem.

Definition at line 651 of file request.cpp.

References buf, socket_struct::cs_version, socket_struct::host, llevDebug, llevError, llevInfo, LOG(), ring_occidental_mages::rest, socket_struct::sc_version, VERSION_CS, VERSION_SC, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ watchdog()

void watchdog ( void  )

Referenced by do_specials().

+ Here is the caller graph for this function:

◆ write_cs_stats()

void write_cs_stats ( void  )

Referenced by do_specials().

+ Here is the caller graph for this function: