Crossfire Server, Trunk  R20513
Functions
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)
 Handle accountaddplayer from server (add a character to this account). More...
 
void account_login_cmd (char *buf, int len, socket_struct *ns)
 Handles the account login. More...
 
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. More...
 
void account_password (char *buf, int len, socket_struct *ns)
 Handles the account password change. More...
 
void account_play_cmd (char *buf, int len, socket_struct *ns)
 We have received an accountplay command. More...
 
void add_me_cmd (char *buf, int len, socket_struct *ns)
 The client has requested to be added to the game. More...
 
void apply_cmd (char *buf, int len, player *pl)
 Client wants to apply some object. More...
 
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. More...
 
void create_player_cmd (char *buf, int len, socket_struct *ns)
 We have received a createplayer command. More...
 
void do_server (void)
 This checks the sockets for input and exceptions, does the right thing. More...
 
void draw_client_map (object *pl)
 Draws client map. More...
 
void draw_client_map2 (object *pl)
 
void draw_ext_info (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
 Sends message to player(s). More...
 
void draw_ext_info_format (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
 Sends message to player(s). More...
 
void draw_magic_map (object *pl)
 Creates and sends magic map to player. More...
 
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. More...
 
void esrv_del_item (player *pl, object *ob)
 Tells the client to delete an item. More...
 
void esrv_draw_look (object *pl)
 Send the look window. More...
 
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. More...
 
void esrv_new_player (player *pl, uint32_t weight)
 Tells the client that here is a player it should start using. More...
 
void esrv_remove_spell (player *pl, object *spell)
 
void esrv_send_animation (socket_struct *ns, short anim_num)
 Need to send an animation sequence to the client. More...
 
void esrv_send_face (socket_struct *ns, uint16_t face_num, int nocache)
 Sends a face to a client if they are in pixmap mode, nothing gets sent in bitmap mode. More...
 
void esrv_send_inventory (object *pl, object *op)
 Sends inventory of a container. More...
 
void esrv_send_item (object *pl, object *op)
 Sends item's info to player. More...
 
void esrv_send_pickup (player *pl)
 Sends the "pickup" state to pl if client wants it requested. More...
 
void esrv_update_item (int flags, object *pl, object *op)
 Updates object *op for player *pl. More...
 
void esrv_update_spells (player *pl)
 This looks for any spells the player may have that have changed their stats. More...
 
void esrv_update_stats (player *pl)
 Sends a statistics update. More...
 
void examine_cmd (char *buf, int len, player *pl)
 Client wants to examine some object. More...
 
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. More...
 
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. More...
 
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. More...
 
void final_free_player (player *pl)
 Sends the 'goodbye' command to the player, and closes connection. More...
 
void free_all_newserver (void)
 Free's all the memory that ericserver allocates. More...
 
void free_newsocket (socket_struct *ns)
 Frees a socket. More...
 
int GetInt_String (const unsigned char *data)
 Basically does the reverse of SockList_AddInt, but on strings instead. More...
 
short GetShort_String (const unsigned char *data)
 
void handle_client (socket_struct *ns, player *pl)
 Handle commands from a client. More...
 
void init_connection (socket_struct *ns, const char *from_ip)
 Initializes a connection. More...
 
void init_listening_socket (socket_struct *ns)
 This opens *ns for listening to connections. More...
 
void init_server (void)
 This sets up the socket and reads all the image information into memory. More...
 
void inscribe_scroll_cmd (char *buf, int len, player *pl)
 
int is_valid_faceset (int fsn)
 Checks specified faceset is valid. More...
 
void lock_item_cmd (uint8_t *data, int len, player *pl)
 Client wants to apply some object. More...
 
void look_at (object *op, int dx, int dy)
 Prints items on the specified square. More...
 
void look_at_cmd (char *buf, int len, player *pl)
 Client wants to look at some object. More...
 
void magic_mapping_mark (object *pl, char *map_mark, int strength)
 Creates magic map for player. More...
 
void map_newmap_cmd (socket_struct *ns)
 Sound related function. More...
 
void mark_item_cmd (uint8_t *data, int len, player *pl)
 Client wants to mark some object. More...
 
int metaserver2_init (void)
 This initializes the metaserver2 logic - it reads the metaserver2 file, storing the values away. More...
 
void * metaserver2_thread (void *junk)
 metserver2_thread is the function called from pthread_create. More...
 
void metaserver_init (void)
 
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. More...
 
void move_cmd (char *buf, int len, player *pl)
 Moves an object (typically, container to inventory). More...
 
void new_player_cmd (uint8_t *buf, int len, player *pl)
 This handles the commands issued by the player (ie, north, fire, cast, etc.). More...
 
void play_sound_map (int8_t sound_type, object *emitter, int dir, const char *action)
 Plays a sound on a map. More...
 
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. More...
 
void player_update_bg_music (object player[static 1])
 
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. More...
 
void rangetostring (const object *pl, char *obuf, size_t len)
 Get player's current range attack in obuf. More...
 
void reply_cmd (char *buf, int len, player *pl)
 This is a reply to a previous query. More...
 
void request_info_cmd (char *buf, int len, socket_struct *ns)
 request_info_cmd is sort of a meta command. More...
 
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. More...
 
void send_background_music (player *pl, const char *music)
 Sends background music to client. More...
 
void send_class_info (socket_struct *ns, char *params)
 Send information on the specified class. More...
 
void send_class_list (socket_struct *ns, char *params)
 Sends the list of classes to the client. More...
 
void send_exp_table (socket_struct *ns, char *params)
 This sends the experience table the sever is using. More...
 
void send_face_cmd (char *buff, int len, socket_struct *ns)
 Client has requested pixmap that it somehow missed getting. More...
 
void send_file (socket_struct *ns, const char *file)
 Sends the desired file to the client. More...
 
void send_image_info (socket_struct *ns)
 Sends the number of images, checksum of the face file, and the image_info file information. More...
 
void send_image_sums (socket_struct *ns, char *params)
 Sends requested face information. More...
 
void send_map_info (socket_struct *ns)
 Send information on the specified class. More...
 
void send_new_char_info (socket_struct *ns)
 Sends information related to creating a new character to the client. More...
 
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. More...
 
void send_query (socket_struct *ns, uint8_t flags, const char *text)
 Asks the client to query the user. More...
 
void send_race_info (socket_struct *ns, char *params)
 Sends information on specified race to the client. More...
 
void send_race_list (socket_struct *ns, char *params)
 Send the list of player races to the client. More...
 
void send_skill_info (socket_struct *ns, char *params)
 This sends the skill number to name mapping. More...
 
void send_spell_paths (socket_struct *ns, char *params)
 This sends the spell path to name mapping. More...
 
void send_tick (player *pl)
 
void Send_With_Handling (socket_struct *ns, SockList *sl)
 Calls Write_To_Socket to send data to the client. More...
 
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)
 Sets player title. More...
 
void set_up_cmd (char *buf, int len, socket_struct *ns)
 This is the Setup cmd - easy first implementation. More...
 
void SockList_AddChar (SockList *sl, char c)
 Adds an 8 bit value. More...
 
void SockList_AddData (SockList *sl, const void *data, size_t len)
 Adds a data block. More...
 
void SockList_AddInt (SockList *sl, uint32_t data)
 Adds a 32 bit value. More...
 
void SockList_AddInt64 (SockList *sl, uint64_t data)
 Adds a 64 bit value. More...
 
void SockList_AddLen16Data (SockList *sl, const void *data, size_t len)
 Adds a data block prepended with an 16 bit length field. More...
 
void SockList_AddLen8Data (SockList *sl, const void *data, size_t len)
 Adds a data block prepended with an 8 bit length field. More...
 
void SockList_AddPrintf (SockList *sl, const char *format,...)
 Adds a printf like formatted string. More...
 
void SockList_AddShort (SockList *sl, uint16_t data)
 Adds a 16 bit value. More...
 
void SockList_AddString (SockList *sl, const char *data)
 Adds a string without length. More...
 
void SockList_AddStringBuffer (SockList *sl, StringBuffer *sb)
 Deallocates string buffer instance and appends its contents. More...
 
size_t SockList_Avail (const SockList *sl)
 Returns the available bytes in a SockList instance. More...
 
void SockList_Init (SockList *sl)
 Initializes the SockList instance. More...
 
void SockList_NullTerminate (SockList *sl)
 Adds a NUL byte without changing the length. More...
 
int SockList_ReadPacket (int fd, SockList *sl, int len)
 This reads from fd and puts the data in sl. More...
 
void SockList_Reset (SockList *sl)
 Resets the length of the stored data for writing. More...
 
void SockList_ResetRead (SockList *sl)
 Resets the length of the stored data for reading. More...
 
void SockList_Term (SockList *sl)
 Frees all resources allocated by a SockList instance. More...
 
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)
 Client tells its version. More...
 
void watchdog (void)
 
void write_cs_stats (void)
 
void write_socket_buffer (socket_struct *ns)
 Writes data to socket. More...
 

Function Documentation

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

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

Here is the call graph for this function:

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

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

Here is the call graph for this function:

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

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

Here is the call graph for this function:

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

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

Here is the call graph for this function:

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

The client has requested to be added to the game.

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

Todo:
can ns->status not be Ns_Add?

Definition at line 347 of file request.c.

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

Here is the call graph for this function:

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

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

Definition at line 423 of file request.c.

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

Here is the call graph for this function:

void create_player_cmd ( char *  buf,
int  len,
socket_struct ns 
)
void do_server ( void  )
void draw_client_map ( object pl)

Draws client map.

Definition at line 1438 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_client_map2 ( object pl)
void draw_ext_info ( int  flags,
int  pri,
const object pl,
uint8_t  type,
uint8_t  subtype,
const char *  txt 
)

Sends message to player(s).

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

Sends message to player(s).

Added as part of glue cleaning. Ryo 2005-07-15

Sends message to player(s).

Definition at line 310 of file main.c.

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

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

Here is the call graph for this function:

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

Sends message to player(s).

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

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

Definition at line 315 of file main.c.

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

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

Here is the call graph for this function:

void draw_magic_map ( object pl)

Creates and sends magic map to player.

@ param pl The player to send the magic map to

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

Mark Wedel

Definition at line 440 of file info.c.

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

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Referenced by check_login(), and do_learn_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

void esrv_del_item ( player pl,
object ob 
)

Tells the client to delete an item.

Uses the item command with a -1 location.

Definition at line 355 of file main.c.

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

Referenced by object_remove(), and transmute_item_to_flower().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Referenced by move_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

void esrv_new_player ( player pl,
uint32_t  weight 
)

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

Definition at line 856 of file request.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void esrv_remove_spell ( player pl,
object spell 
)

Definition at line 1603 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 883 of file request.c.

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

Referenced by add_object_to_socklist(), and map2_add_ob().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Sends a face to a client if they are in pixmap mode, nothing gets sent in bitmap mode.

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

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

Definition at line 70 of file image.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void esrv_send_inventory ( object pl,
object op 
)

Sends inventory of a container.

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

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

Definition at line 307 of file item.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void esrv_send_item ( object pl,
object op 
)
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 1625 of file request.c.

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

Referenced by check_login(), and display_new_pickup().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Updates object *op for player *pl.

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

Definition at line 342 of file main.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void esrv_update_spells ( player pl)

This looks for any spells the player may have that have changed their stats.

It then sends an updspell packet for each spell that has changed in this way.

Definition at line 358 of file main.c.

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

Referenced by fix_player().

Here is the call graph for this function:

Here is the caller graph for this function:

void esrv_update_stats ( player pl)

Sends a statistics update.

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

Definition at line 725 of file request.c.

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

Referenced by do_server().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Client wants to examine some object.

So lets do so.

Definition at line 612 of file item.c.

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

Here is the call graph for this function:

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

Writes to everyone on the specified map.

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

Definition at line 325 of file main.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Writes to everyone on the map except *op.

This is useful for emotions.

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

Definition at line 185 of file info.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Writes to everyone on the map except op1 and op2.

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

Definition at line 211 of file info.c.

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

Referenced by basic_emote().

Here is the call graph for this function:

Here is the caller graph for this function:

void final_free_player ( player pl)

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

Definition at line 444 of file init.c.

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

Referenced by check_login(), and do_server().

Here is the call graph for this function:

Here is the caller graph for this function:

void free_all_newserver ( void  )

Free's all the memory that ericserver allocates.

Definition at line 395 of file init.c.

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

Referenced by cleanup().

Here is the call graph for this function:

Here is the caller graph for this function:

void free_newsocket ( socket_struct ns)

Frees a socket.

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

Definition at line 413 of file init.c.

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

Referenced by do_server(), and final_free_player().

Here is the call graph for this function:

Here is the caller graph for this function:

int GetInt_String ( const unsigned char *  data)

Basically does the reverse of SockList_AddInt, but on strings instead.

Same for the GetShort, but for 16 bits.

Definition at line 246 of file lowlevel.c.

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

Here is the caller graph for this function:

short GetShort_String ( const unsigned char *  data)

Definition at line 250 of file lowlevel.c.

Referenced by new_player_cmd().

Here is the caller graph for this function:

void handle_client ( socket_struct ns,
player pl 
)

Handle commands from a client.

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

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

Definition at line 234 of file loop.c.

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

Referenced by do_server(), and handle_newcs_player().

Here is the call graph for this function:

Here is the caller graph for this function:

void init_connection ( socket_struct ns,
const char *  from_ip 
)

Initializes a connection.

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

Definition at line 63 of file init.c.

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

Referenced by new_connection().

Here is the call graph for this function:

Here is the caller graph for this function:

void init_listening_socket ( socket_struct ns)

This opens *ns for listening to connections.

The structure must be allocated already and ns->listen must be initialized. No other variable is changed.

Definition at line 171 of file init.c.

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

Referenced by do_server(), and init_server().

Here is the call graph for this function:

Here is the caller graph for this function:

void init_server ( void  )

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

Todo:
fix socket_info.max_filedescriptor hack.

Definition at line 262 of file init.c.

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

Referenced by init().

Here is the call graph for this function:

Here is the caller graph for this function:

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

References FALSE, MAX_FACE_SETS, and TRUE.

Referenced by main(), and set_up_cmd().

Here is the caller graph for this function:

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

Client wants to apply some object.

Lets do so.

Definition at line 671 of file item.c.

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

Here is the call graph for this function:

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

Prints items on the specified square.

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

Definition at line 754 of file item.c.

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

Referenced by look_at_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Client wants to look at some object.

Lets do so.

Definition at line 819 of file item.c.

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

Here is the call graph for this function:

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

Creates magic map for player.

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

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

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

Definition at line 393 of file info.c.

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

Referenced by draw_magic_map().

Here is the call graph for this function:

Here is the caller graph for this function:

void map_newmap_cmd ( socket_struct ns)

Sound related function.

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

Newmap command

Definition at line 615 of file request.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Client wants to mark some object.

Lets do so.

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

Definition at line 723 of file item.c.

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

Here is the call graph for this function:

int metaserver2_init ( void  )

This initializes the metaserver2 logic - it reads the metaserver2 file, storing the values away.

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

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

Definition at line 163 of file metaserver.c.

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

Referenced by init().

Here is the call graph for this function:

Here is the caller graph for this function:

void* metaserver2_thread ( void *  junk)

metserver2_thread is the function called from pthread_create.

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

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

Definition at line 503 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  )
void metaserver_update ( void  )

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

Definition at line 49 of file metaserver.c.

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

Referenced by block_until_new_connection(), and do_specials().

Here is the caller graph for this function:

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

Moves an object (typically, container to inventory).

syntax is: move (to) (tag) (nrof)

Definition at line 636 of file request.c.

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

Here is the call graph for this function:

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

This handles the commands issued by the player (ie, north, fire, cast, etc.).

This is called with the 'ncom' method which gives more information back to the client so it can throttle.

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

Definition at line 447 of file request.c.

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

Here is the call graph for this function:

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

Plays a sound on a map.

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

Definition at line 101 of file sounds.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Plays a sound for specified player only.

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

Definition at line 51 of file sounds.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void player_update_bg_music ( object  player[static 1])

Definition at line 152 of file sounds.c.

References obj::contr, obj::map, pick_bg_music(), PLAYER, send_background_music(), and obj::type.

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

Here is the call graph for this function: