Crossfire Server, Branches 1.12  R18729
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 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 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 type, uint8 subtype, const char *message, const char *oldmessage)
 
void draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
 
void draw_magic_map (object *pl)
 
void esrv_add_spells (player *pl, object *spell)
 
void esrv_del_item (player *pl, int tag)
 
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 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, short 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 type, uint8 subtype, const char *str1, const char *str2)
 
void ext_info_map_except (int color, const mapstruct *map, const object *op, uint8 type, uint8 subtype, const char *str1, const char *str2)
 
void ext_info_map_except2 (int color, const mapstruct *map, const object *op1, const object *op2, int type, int subtype, const char *str1, const char *str2)
 
void final_free_player (player *pl)
 
void flush_output_element (const object *pl, Output_Buf *outputs)
 
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_server (void)
 
void inscribe_scroll_cmd (char *buf, int len, player *pl)
 
int is_valid_faceset (int fsn)
 
void lock_item_cmd (uint8 *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 map_redraw_cmd (char *buf, int len, player *pl)
 
void mark_item_cmd (uint8 *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 *buf, int len, player *pl)
 
void play_sound_map (sint8 sound_type, object *emitter, int dir, const char *action)
 
void play_sound_player_only (player *pl, sint8 sound_type, object *emitter, int dir, const char *action)
 
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_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_image_info (socket_struct *ns, char *params)
 
void send_image_sums (socket_struct *ns, char *params)
 
void send_plugin_custom_message (object *pl, char *buf)
 
void send_query (socket_struct *ns, uint8 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 data)
 
void SockList_AddInt64 (SockList *sl, uint64 data)
 
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 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

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 320 of file request.c.

References add_player(), socket_struct::cs_version, Socket_Info::nconns, Ns_Add, Ns_Avail, socket_struct::sc_version, Send_With_Handling(), settings, socket_info, SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::status.

+ Here is the call graph for this function:

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

Client wants to apply some object. Lets do so.

Definition at line 581 of file item.c.

References esrv_get_ob_from_count(), FLAG_REMOVED, llevDebug, LOG(), socket_struct::look_position, obj::name, pl::ob, player_apply(), QUERY_FLAG, pl::socket, and socket_struct::update_look.

+ Here is the call graph for this function:

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 473 of file request.c.

References send_smooth().

+ Here is the call graph for this function:

void draw_client_map ( object pl)

Draws client map.

Definition at line 1371 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:

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

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

Sends message to player(s).

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.

If message is black, and not NDI_UNIQUE, gets sent through output buffers. If the client supports the new readables, this is sent to the client without processing in the output buffers.

Parameters
typeThe type MSG_TYPE for the type of message.
subtypeThe type MSG_TYPE for the type of message.
messageThe message to send for clients that support draw_ext_info.
oldmessageis for clients that do not support it. oldmessage can be NULL, in which case this function will strip out the tags of message.

Dummy functions to link the library.

Definition at line 171 of file standalone.c.

References check_output_buffers(), CLIENT_SUPPORT_READABLES, obj::contr, esrv_print_ext_msg(), first_player, FLAG_WIZ, pl::listening, llevError, LOG(), logfile, NDI_ALL, NDI_ALL_DMS, NDI_BLACK, NDI_COLOR_MASK, NDI_UNIQUE, pl::next, pl::ob, PLAYER, print_message(), QUERY_FLAG, pl::socket, strdup_local(), strip_media_tag(), 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_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(), can_see_enemy(), 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(), check_score(), command_abil(), command_addexp(), command_afk(), command_arrest(), command_banish(), command_body(), command_bowmode(), command_brace(), command_cast_spell(), command_cointoss(), command_create(), command_debug(), command_diff(), command_drop(), command_dropall(), command_dump(), command_dumpbelow(), command_empty(), command_explore(), 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_learn_spell_or_prayer(), command_loadplugin(), command_loadtest(), command_lock_item(), command_mark(), command_mon_aggr(), command_nowiz(), command_output_count(), command_output_sync(), command_overlay_reset(), command_overlay_save(), command_party(), command_patch(), command_peaceful(), command_pickup(), command_possess(), command_remove(), command_rename_item(), command_reply(), command_reset(), command_resistances(), command_rskill(), command_run(), command_save(), command_search_items(), command_setgod(), command_showpets(), 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(), describe_shop(), dimension_door(), dispel_rune(), display_high_score(), 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_talk_npc(), 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(), follow_owner(), food_type_apply(), get_other_player_from_name(), god_enchants_weapon(), god_intervention(), god_removes_curse(), handle_newcs_player(), help_topics(), hide(), 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(), lighter_type_apply(), list_players(), lock_item_cmd(), look_at(), magic_wall(), manual_apply(), map_info(), mark_item_cmd(), meditate(), move_golem(), move_marker(), move_player_attack(), move_symptom(), party_help(), perceive_self(), pet_move(), pick_lock(), pick_up(), pick_up_object(), player_apply(), player_attack_door(), player_lvl_adj(), plugins_display_list(), poison_living(), poison_type_apply(), poisoning_type_process(), potion_type_apply(), pray(), pray_at_altar(), prayer_failure(), prepare_weapon(), print_los(), probe(), put_object_in_sack(), receive_party_password(), receive_play_again(), receive_player_name(), receive_player_password(), recharge(), remove_curse(), remove_force(), save_player(), scroll_failure(), scroll_type_apply(), send_party_message(), send_rules(), set_pickup_mode(), 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(), start_info(), summon_golem(), summon_object(), tailor_god_spell(), time_info(), trap_disarm(), trapdoor_type_move_on(), treasure_type_apply(), trigger_type_apply(), unapply_for_ob(), use_oratory(), version(), 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:

void draw_ext_info_format ( int  flags,
int  pri,
const object pl,
uint8  type,
uint8  subtype,
const char *  new_format,
const char *  old_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. Also, hopefully at some point, need for old_format will go away.

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.

If message is black, and not NDI_UNIQUE, gets sent through output buffers. If the client supports the new readables, this is sent to the client without processing in the output buffers.

Parameters
typeThe type MSG_TYPE for the type of message.
subtypeThe type MSG_TYPE for the type of message.
new_format
old_format

Definition at line 175 of file standalone.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_container(), apply_savebed(), apply_special(), 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_race_restrictions(), check_sacrifice(), check_score(), check_special_prayers(), 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_create(), command_debug(), command_drop(), command_examine(), command_follow(), command_forget_spell(), command_freeze(), command_goto(), command_help(), command_insert_into(), command_kick(), command_kill_pets(), command_language(), command_learn_spell_or_prayer(), command_listen(), command_loadplugin(), command_loadtest(), command_lock_item(), command_mark(), command_nowiz(), command_output_count(), command_output_sync(), command_party(), command_party_rejoin(), command_patch(), command_petmode(), command_pickup(), command_players(), command_remove(), command_rename_item(), command_reply(), command_reset(), command_resistances(), command_rskill(), command_search_items(), command_setgod(), command_showpets(), 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_unloadplugin(), command_use(), command_usekeys(), 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(), describe_shop(), display_new_pickup(), dm_stack_pop(), dm_stack_push(), do_forget_spell(), do_harvest(), do_learn_spell(), do_skill_attack(), do_skill_ident2(), do_talk_npc(), 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_unique_map(), examine(), execute_newserver_command(), exit_type_apply(), find_key(), find_throw_ob(), fire_bow(), fire_misc_object(), follower_remove_given_items(), food_type_apply(), form_party(), gate_type_process(), get_dm_object(), get_payment(), get_spell_by_name(), god_enchants_weapon(), god_examines_item(), god_examines_priest(), god_gives_present(), god_intervention(), hit_with_one_attacktype(), identify_altar_type_move_on(), improve_weapon(), improve_weapon_stat(), inventory(), key_confirm_quit(), key_roll_stat(), kill_object(), kill_player(), lamp_type_apply(), leave(), lighter_type_apply(), list_players(), look_at(), magic_wall(), malloc_info(), map_info(), mark_item_cmd(), move_golem(), new_player_cmd(), peacemaker_type_process(), perceive_self(), pick_up(), player_apply(), player_attack_door(), player_lvl_adj(), plugins_display_list(), poison_living(), polymorph_melt(), pray_at_altar(), prayer_failure(), print_tod(), process_players1(), push_ob(), put_object_in_sack(), receive_party_password(), recharge(), recursive_roll(), remove_force(), resurrect_player(), sack_can_hold(), save_life(), save_player(), scroll_type_apply(), sell_item(), send_news(), shop_inventory_type_apply(), show_matching_spells(), show_skills(), singing(), skillscroll_type_apply(), spellbook_type_apply(), start_info(), summon_golem(), summon_object(), 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(), version(), worship_forbids_use(), write_note(), write_on_item(), write_rune(), and write_scroll().

+ Here is the call graph for this function:

void draw_magic_map ( object pl)

Creates and sends magic map to player.

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

Mark Wedel

Definition at line 542 of file info.c.

References obj::contr, FACE_FLOOR, llevError, LOG(), MAGIC_MAP_HALF, MAGIC_MAP_SIZE, magic_mapping_mark(), obj::map, MAP_WIDTH, 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:

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.

Definition at line 1812 of file request.c.

References append_spell(), obj::below, obj::inv, llevError, LOG(), socket_struct::monitor_spells, obj::msg, obj::name, pl::ob, 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:

void esrv_del_item ( player pl,
int  tag 
)

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

Definition at line 213 of file standalone.c.

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

Referenced by remove_ob(), and transmute_item_to_flower().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Move an object to a new location

Definition at line 773 of file item.c.

References obj::below, can_pick(), CONTAINER, obj::contr, obj::count, pl::count, drop_object(), obj::env, esrv_get_ob_from_count(), esrv_update_item(), FLAG_APPLIED, obj::inv, llevDebug, LOG(), obj::map, obj::name, 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:

void esrv_new_player ( player pl,
uint32  weight 
)

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

Definition at line 868 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 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:

void esrv_remove_spell ( player pl,
object spell 
)

Definition at line 1725 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:

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 895 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, 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:

void esrv_send_face ( socket_struct ns,
short  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.

Definition at line 96 of file image.c.

References socket_struct::facecache, socket_struct::faces_sent, socket_struct::faceset, facesets, get_face_fallback(), llevError, LOG(), bmappair::name, 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(), map2_add_ob(), send_face_cmd(), and send_smooth().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void esrv_send_inventory ( object pl,
object op 
)
void esrv_send_item ( object pl,
object op 
)

Sends item's info to player.

Definition at line 197 of file standalone.c.

References add_object_to_socklist(), obj::contr, obj::count, obj::env, FLAG_CLIENT_SENT, obj::head, LOOK_OBJ, Send_With_Handling(), SET_FLAG, pl::socket, SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::update_look.

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 200 of file standalone.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, obj::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(), 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_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(), decrease_ob_nr(), do_server(), do_skill_detect_curse(), do_skill_detect_magic(), drain_wand_charge(), drop_object(), empty_container(), esrv_move_object(), get_payment(), god_enchants_weapon(), god_removes_curse(), hit_with_one_attacktype(), identify(), improve_armour(), improve_weapon_magic(), increase_ob_nr(), insert_objects(), key_change_class(), lock_item_cmd(), pick_up_object(), player_attack_door(), player_changer_type_process(), power_crystal_type_apply(), put_object_in_sack(), remove_curse(), sell_item(), send_changed_object(), spellbook_type_apply(), unapply_special(), update_object(), and weapon_improver_type_apply().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 216 of file standalone.c.

References obj::below, obj::count, liv::dam, flags, get_client_spell_state(), obj::inv, 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, obj::stats, obj::type, UPD_SP_DAMAGE, UPD_SP_GRACE, and UPD_SP_MANA.

Referenced by fix_object(), and player_lvl_adj().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 779 of file request.c.

References liv::ac, AddIfFloat, AddIfInt, AddIfInt64, AddIfShort, AddIfString, atnr_cs_stat, ATNR_PHYSICAL, liv::Cha, liv::Con, CS_STAT_AC, CS_STAT_ARMOUR, CS_STAT_CHA, CS_STAT_CON, CS_STAT_DAM, CS_STAT_DEX, CS_STAT_EXP64, CS_STAT_FLAGS, CS_STAT_FOOD, 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_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, pl::fire_on, flags, liv::food, liv::grace, liv::hp, liv::Int, pl::last_flags, pl::last_level, pl::last_path_attuned, pl::last_path_denied, pl::last_path_repelled, 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, obj::path_attuned, obj::path_denied, obj::path_repelled, liv::Pow, statsinfo::range, 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, pl::weapon_sp, weight_limit, and liv::Wis.

Referenced by do_server().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Definition at line 562 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:

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

Writes to everyone on the specified map

Definition at line 184 of file standalone.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(), communicate(), do_talk_npc(), npc_say(), operate_altar(), and trigger_connected().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Definition at line 318 of file info.c.

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

Referenced by basic_emote(), and command_cointoss().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Writes to everyone on the map except op1 and op2

Definition at line 330 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:

void final_free_player ( player pl)

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

Definition at line 328 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:

void flush_output_element ( const object pl,
Output_Buf outputs 
)

Prints out the contents of specified buffer structures, and clears the string.

Definition at line 108 of file info.c.

References Output_Buf::buf, Output_Buf::count, Output_Buf::first_update, free_string(), MAX_BUF, NDI_BLACK, print_message(), and snprintf().

Referenced by check_output_buffers(), and do_some_living().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void free_all_newserver ( void  )

Free's all the memory that ericserver allocates.

Definition at line 292 of file init.c.

References free_socket_images(), llevDebug, and LOG().

Referenced by cleanup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 305 of file init.c.

References 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:

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 239 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:

short GetShort_String ( const unsigned char *  data)

Definition at line 243 of file lowlevel.c.

Referenced by new_player_cmd().

+ Here is the caller graph for this function:

void handle_client ( socket_struct ns,
player pl 
)

Handle client commands.

We only get here once there is input, and only do basic connection checking.

Parameters
nssocket sending the command. Will be set to Ns_Dead if read error.
plplayer associated to the socket. If NULL, only commands in client_cmd_mapping will be checked.

Definition at line 200 of file loop.c.

References SockList::buf, client_cmd_mapping::cmdname, player_cmd_mapping::cmdname, client_cmd_mapping::cmdproc, player_cmd_mapping::cmdproc, socket_struct::fd, player_cmd_mapping::flag, socket_struct::inbuf, SockList::len, llevDebug, LOG(), obj::name, Ns_Dead, pl::ob, SockList_NullTerminate(), SockList_ReadPacket(), SockList_ResetRead(), obj::speed_left, ST_PLAYING, pl::state, and socket_struct::status.

Referenced by do_server(), and handle_newcs_player().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void init_connection ( socket_struct ns,
const char *  from_ip 
)
void init_server ( void  )

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

Definition at line 173 of file init.c.

References Socket_Info::allocated_sockets, Settings::csport, cst_lst, cst_tot, socket_struct::faces_sent, socket_struct::fd, llevDebug, llevError, LOG(), MAX_BUF, Socket_Info::max_filedescriptor, Socket_Info::nconns, Ns_Add, read_client_images(), settings, socket_struct::status, strerror_local(), 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:

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

Checks specified faceset is valid

Parameters
fsnfaceset number

Definition at line 575 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:

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

Client wants to apply some object. Lets do so.

Definition at line 615 of file item.c.

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

+ Here is the call graph for this function:

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 687 of file item.c.

References obj::above, obj::below, CONTAINER, obj::count, draw_ext_info(), draw_ext_info_format(), FLAG_IS_FLOOR, FLAG_WIZ, FLESH, get_map_from_coord(), GET_MAP_OB, obj::head, obj::inv, 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:

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

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

Definition at line 754 of file item.c.

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

+ Here is the call graph for this function:

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

Creates magic map for player.

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. map_mark should already have been initialized to zero before this is called. strength is an initial strength*2 rectangular area that we automatically see in/penetrate through.

Definition at line 497 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:

void map_newmap_cmd ( socket_struct ns)

Newmap command

Definition at line 672 of file request.c.

References socket_struct::lastmap, socket_struct::map_scroll_x, socket_struct::map_scroll_y, socket_struct::newmapcmd, 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:

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

client wants the map resent

Todo:
remove

Definition at line 662 of file request.c.

void mark_item_cmd ( uint8 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 655 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:

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 255 of file metaserver.c.

References _LocalMeta2Info::archbase, close_and_delete(), _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(), _MetaServer2::next, _LocalMeta2Info::notification, open_and_uncompress(), _LocalMeta2Info::portnumber, settings, snprintf(), 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:

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.

Returns
This function should never return/exit.

Definition at line 586 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:

void metaserver_init ( void  )

Connects to metaserver.

Its only called once. If we are not trying to contact the metaserver of the connection attempt fails, metafd will be set to -1. We use this instead of messing with the settings.meta_on so that that can be examined to at least see what the user was trying to do.

Definition at line 68 of file metaserver.c.

References llevDebug, LOG(), MAX_BUF, Settings::meta_host, Settings::meta_on, Settings::meta_port, Settings::meta_server, metafd, settings, and sock.

Referenced by init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 134 of file metaserver.c.

References cst_tot, first_player, FLAG_AFK, FLAG_WIZ, FULL_VERSION, pl::hidden, CS_Stats::ibytes, _MetaServer2_UpdateInfo::in_bytes, socket_struct::is_bot, llevDebug, LOG(), obj::map, MAX_BUF, Settings::meta_comment, Settings::meta_host, metafd, metaserver2_updateinfo, ms2_info_mutex, pl::next, _MetaServer2_UpdateInfo::num_players, pl::ob, CS_Stats::obytes, _MetaServer2_UpdateInfo::out_bytes, QUERY_FLAG, settings, snprintf(), sock, 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 call graph for this function:

+ Here is the caller graph for this function:

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 694 of file request.c.

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

+ Here is the call graph for this function:

void new_player_cmd ( uint8 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 492 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:

void play_sound_map ( sint8  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 90 of file sounds.c.

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

Referenced by attack_message(), cast_spell(), cf_handle_type_apply(), fire_bow(), hole_type_move_on(), kill_object(), move_player_attack(), player_apply(), 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:

void play_sound_player_only ( player pl,
sint8  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 40 of file sounds.c.

References obj::env, obj::map, MAX_SOUNDS_TICK, obj::name, pl::ob, PLAYER, obj::race, 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 attack_message(), cast_spell(), clock_type_apply(), do_learn_spell(), fire_misc_object(), kill_player(), manual_apply(), 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:

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

Get player's current range attack in obuf.

Definition at line 343 of file info.c.

References obj::below, BOW, obj::casting_time, Settings::casting_time, obj::chosen_skill, obj::contr, FLAG_APPLIED, obj::inv, MAX_BUF, bmappair::name, 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:

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.

Definition at line 146 of file loop.c.

References send_class_info(), send_class_list(), send_exp_table(), send_image_info(), send_image_sums(), 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:

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 121 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 enter_map().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void send_class_info ( socket_struct ns,
char *  params 
)

Send information on the specified class.

Parameters
nswhere to send.
paramsclass name to send.
Todo:
finish writing

Definition at line 1664 of file request.c.

Referenced by request_info_cmd().

+ Here is the caller graph for this function:

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 1642 of file request.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:

void send_exp_table ( socket_struct ns,
char *  params 
)

This sends the experience table the sever is using

Definition at line 1482 of file request.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:

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.

Definition at line 80 of file image.c.

References esrv_send_face().

+ Here is the call graph for this function:

void send_image_info ( socket_struct ns,
char *  params 
)

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.

Definition at line 138 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:

+ Here is the caller graph for this function:

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 165 of file image.c.

References socket_struct::faces_sent, socket_struct::faceset, facesets, get_face_fallback(), llevError, LOG(), bmappair::name, new_faces, nrofpixmaps, NS_FACESENT_FACE, Send_With_Handling(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_Avail(), SockList_Init(), SockList_Reset(), and SockList_Term().

Referenced by request_info_cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 1470 of file request.c.

References obj::contr, Send_With_Handling(), pl::socket, SockList_AddString(), SockList_Init(), and SockList_Term().

+ Here is the call graph for this function:

void send_query ( socket_struct ns,
uint8  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 727 of file request.c.

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

Referenced by command_passwd(), command_quit(), 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:

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.
Todo:
finish writing

Definition at line 1600 of file request.c.

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

Referenced by request_info_cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void send_race_list ( socket_struct ns,
char *  params 
)

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.
paramsignored.

Definition at line 1578 of file request.c.

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:

void send_skill_info ( socket_struct ns,
char *  params 
)

This sends the skill number to name mapping. We ignore the params - we always send the same info no matter what.

Definition at line 1505 of file request.c.

References CS_STAT_SKILLINFO, llevError, LOG(), NUM_SKILLS, Send_With_Handling(), 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:

void send_spell_paths ( socket_struct ns,
char *  params 
)

This sends the spell path to name mapping. We ignore the params - we always send the same info no matter what.

Definition at line 1530 of file request.c.

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:

void send_tick ( player pl)

Definition at line 1863 of file request.c.

References socket_struct::fd, llevError, LOG(), pticks, Send_With_Handling(), pl::socket, SockList_AddInt(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by do_server().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Client tells us what type of faces it wants. Also sets the caching attribute.

Definition at line 53 of file image.c.

References CF_FACE_CACHE, CF_FACE_NONE, CF_FACE_PNG, socket_struct::facecache, llevDebug, LOG(), NDI_RED, Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().

+ Here is the call graph for this function:

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

Sound related function.

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

Definition at line 656 of file request.c.

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

Sets player title.

Definition at line 415 of file info.c.

References obj::contr, obj::name, pl::own_title, snprintf(), and pl::title.

Referenced by esrv_update_stats().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SockList_AddChar ( SockList sl,
char  data 
)

Adds an 8 bit value. sl the SockList instance to add to

Parameters
cthe value to add

Definition at line 103 of file lowlevel.c.

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

Referenced by add_object_to_socklist(), append_spell(), check_space_for_heads(), draw_client_map2(), draw_magic_map(), esrv_draw_look(), esrv_send_face(), esrv_update_item(), esrv_update_spells(), esrv_update_stats(), map2_add_ob(), map2_delete_layer(), play_sound_player_only(), send_image_sums(), and SockList_AddLen8Data().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 164 of file lowlevel.c.

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SockList_AddInt ( SockList sl,
uint32  data 
)

Adds a 32 bit value. sl the SockList instance to add to

Parameters
datathe value to add

Definition at line 124 of file lowlevel.c.

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

Referenced by add_object_to_socklist(), append_spell(), esrv_del_item(), esrv_draw_look(), esrv_new_player(), esrv_remove_spell(), esrv_send_face(), esrv_send_inventory(), esrv_send_item(), esrv_send_pickup(), esrv_update_item(), esrv_update_spells(), new_player_cmd(), send_image_sums(), and send_tick().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SockList_AddInt64 ( SockList sl,
uint64  data 
)

Adds a 64 bit value. sl the SockList instance to add to

Parameters
datathe value to add

Definition at line 137 of file lowlevel.c.

References SockList::buf, 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:

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 176 of file lowlevel.c.

References SockList_AddChar(), and SockList_AddData().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 187 of file lowlevel.c.

References SockList::buf, fatal(), SockList::len, OUT_OF_MEMORY, and vsnprintf.

Referenced by build_class_list_reply(), build_race_list_reply(), draw_magic_map(), esrv_draw_look(), esrv_print_ext_msg(), esrv_print_msg(), esrv_send_inventory(), init_connection(), send_image_info(), send_image_sums(), send_query(), send_race_info(), send_skill_info(), send_spell_paths(), set_face_mode_cmd(), set_up_cmd(), and toggle_extended_text_cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SockList_AddShort ( SockList sl,
uint16  data 
)

Adds a 16 bit value. sl the SockList instance to add to

Parameters
datathe value to add

Definition at line 113 of file lowlevel.c.

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

Referenced by add_object_to_socklist(), append_spell(), check_space_for_heads(), draw_client_map2(), esrv_draw_look(), esrv_send_animation(), esrv_send_face(), esrv_update_item(), esrv_update_spells(), map2_add_ob(), map2_delete_layer(), new_player_cmd(), send_exp_table(), send_image_sums(), and send_smooth().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 210 of file lowlevel.c.

References SockList_AddString(), and stringbuffer_finish().

+ Here is the call graph for this function:

size_t SockList_Avail ( const SockList sl)

Returns the available bytes in a SockList instance.

Returns
the available bytes

Definition at line 231 of file lowlevel.c.

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

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

+ Here is the caller graph for this function:

void SockList_NullTerminate ( SockList sl)

Adds a NUL byte without changing the length.

Parameters
slthe SockList instance to add to

Definition at line 222 of file lowlevel.c.

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:

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 260 of file lowlevel.c.

References SockList::buf, cst_lst, cst_tot, CS_Stats::ibytes, SockList::len, llevDebug, llevError, LOG(), MAX_BUF, and strerror_local().

Referenced by handle_client().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 85 of file lowlevel.c.

References SockList::len.

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

+ Here is the caller graph for this function:

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 94 of file lowlevel.c.

References SockList::len.

Referenced by add_player(), handle_client(), and init_connection().

+ Here is the caller graph for this function:

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

Reply to ExtendedInfos command

Definition at line 359 of file request.c.

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

+ Here is the call graph for this function:

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

Reply to ExtendedInfos command

Definition at line 398 of file request.c.

References MSG_TYPE_LAST, Send_With_Handling(), SockList_AddPrintf(), SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::supported_readables.

+ Here is the call graph for this function:

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 621 of file request.c.

References socket_struct::cs_version, socket_struct::host, llevDebug, llevError, LOG(), socket_struct::sc_version, VERSION_CS, and VERSION_SC.

+ Here is the call graph for this function:

void watchdog ( void  )

Referenced by block_until_new_connection(), and do_specials().

+ Here is the caller graph for this function:

void write_cs_stats ( void  )

Referenced by do_server().

+ Here is the caller graph for this function:

void write_socket_buffer ( socket_struct ns)

Writes data to socket.

When the socket is clear to write, and we have backlogged data, this is called to write it out.

Definition at line 418 of file lowlevel.c.

References socket_struct::can_write, cst_lst, cst_tot, buffer_struct::data, socket_struct::fd, buffer_struct::len, llevDebug, llevError, LOG(), MAX_BUF, Ns_Dead, CS_Stats::obytes, socket_struct::outputbuffer, SOCKETBUFSIZE, buffer_struct::start, socket_struct::status, and strerror_local().

Referenced by do_server().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: