Crossfire Server, Branches 1.12  R18729
request.c File Reference
#include <assert.h>
#include <global.h>
#include <sproto.h>
#include <newclient.h>
#include <newserver.h>
#include <living.h>
#include <commands.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include "sounds.h"
+ Include dependency graph for request.c:

Go to the source code of this file.

Macros

#define AddIfFloat(Old, New, Type)
 
#define AddIfInt(Old, New, Type)
 
#define AddIfInt64(Old, New, Type)
 
#define AddIfShort(Old, New, Type)
 
#define AddIfString(Old, New, Type)
 
#define MAX_HEAD_POS   MAX(MAX_CLIENT_X, MAX_CLIENT_Y)
 

Functions

void add_me_cmd (char *buf, int len, socket_struct *ns)
 
static void append_spell (player *pl, SockList *sl, object *spell)
 
void ask_smooth_cmd (char *buf, int len, socket_struct *ns)
 
static void build_class_list_reply (SockList *sl)
 
static void build_race_list_reply (SockList *sl)
 
static void check_space_for_heads (int ax, int ay, SockList *sl, socket_struct *ns)
 
void draw_client_map (object *pl)
 
void draw_client_map2 (object *pl)
 
void esrv_add_spells (player *pl, object *spell)
 
void esrv_map_scroll (socket_struct *ns, int dx, int dy)
 
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_pickup (player *pl)
 
void esrv_update_spells (player *pl)
 
void esrv_update_stats (player *pl)
 
static int map2_add_ob (int ax, int ay, int layer, object *ob, SockList *sl, socket_struct *ns, int *has_obj, int is_head)
 
static int map2_delete_layer (int ax, int ay, int layer, SockList *sl, socket_struct *ns)
 
static void map_clearcell (struct map_cell_struct *cell, int face, int count)
 
void map_newmap_cmd (socket_struct *ns)
 
void map_redraw_cmd (char *buf, int len, player *pl)
 
void move_cmd (char *buf, int len, player *pl)
 
void new_player_cmd (uint8 *buf, int len, player *pl)
 
void reply_cmd (char *buf, int len, player *pl)
 
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_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)
 
static void send_smooth (socket_struct *ns, uint16 face)
 
void send_spell_paths (socket_struct *ns, char *params)
 
void send_tick (player *pl)
 
void set_sound_cmd (char *buf, int len, socket_struct *ns)
 
void set_up_cmd (char *buf, int len, socket_struct *ns)
 
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)
 

Variables

static const short atnr_cs_stat [NROFATTACKS]
 
static objectheads [MAX_HEAD_POS][MAX_HEAD_POS][MAP_LAYERS]
 

Detailed Description

Client handling.

Date
2003-12-02

This file implements all of the goo on the server side for handling clients. It's got a bunch of global variables for keeping track of each of the clients.

Note: All functions that are used to process data from the client have the prototype of (char *data, int datalen, int client_num). This way, we can use one dispatch table.

esrv_map_new starts updating the map

esrv_map_setbelow allows filling in all of the faces for the map. if a face has not already been sent to the client, it is sent now.

compactstack, perform the map compressing operations

esrv_map_scroll tells the client to scroll the map, and does similarily for the locally cached copy.

Todo:
smoothing should be automatic for latest clients. Remove some stuff we can assume is always on. fix comments for this file.

Definition in file request.c.

Macro Definition Documentation

#define AddIfFloat (   Old,
  New,
  Type 
)
Value:
if (Old != New) { \
Old = New; \
SockList_AddChar(&sl, Type); \
SockList_AddInt(&sl, (long)(New*FLOAT_MULTI));\
}
#define FLOAT_MULTI
Definition: newclient.h:89
void SockList_AddChar(SockList *sl, char c)
Definition: lowlevel.c:103
void SockList_AddInt(SockList *sl, uint32 data)
Definition: lowlevel.c:124

Definition at line 757 of file request.c.

Referenced by esrv_update_stats().

#define AddIfInt (   Old,
  New,
  Type 
)
Value:
if (Old != New) { \
Old = New; \
SockList_AddChar(&sl, Type); \
SockList_AddInt(&sl, New); \
}
void SockList_AddChar(SockList *sl, char c)
Definition: lowlevel.c:103
void SockList_AddInt(SockList *sl, uint32 data)
Definition: lowlevel.c:124

Definition at line 743 of file request.c.

Referenced by esrv_update_stats().

#define AddIfInt64 (   Old,
  New,
  Type 
)
Value:
if (Old != New) { \
Old = New; \
SockList_AddChar(&sl, Type); \
SockList_AddInt64(&sl, New); \
}
void SockList_AddInt64(SockList *sl, uint64 data)
Definition: lowlevel.c:137
void SockList_AddChar(SockList *sl, char c)
Definition: lowlevel.c:103

Definition at line 736 of file request.c.

Referenced by esrv_update_stats().

#define AddIfShort (   Old,
  New,
  Type 
)
Value:
if (Old != New) { \
Old = New; \
SockList_AddChar(&sl, Type); \
SockList_AddShort(&sl, New); \
}
void SockList_AddShort(SockList *sl, uint16 data)
Definition: lowlevel.c:113
void SockList_AddChar(SockList *sl, char c)
Definition: lowlevel.c:103

Definition at line 750 of file request.c.

Referenced by esrv_update_stats().

#define AddIfString (   Old,
  New,
  Type 
)
Value:
if (Old == NULL || strcmp(Old, New)) { \
if (Old) \
free(Old); \
Old = strdup_local(New); \
SockList_AddChar(&sl, Type); \
SockList_AddLen8Data(&sl, New, strlen(New));\
}
char * strdup_local(const char *str)
Definition: porting.c:310
void SockList_AddChar(SockList *sl, char c)
Definition: lowlevel.c:103
void SockList_AddLen8Data(SockList *sl, const void *data, size_t len)
Definition: lowlevel.c:176

Definition at line 764 of file request.c.

Referenced by esrv_update_stats().

#define MAX_HEAD_POS   MAX(MAX_CLIENT_X, MAX_CLIENT_Y)

Definition at line 938 of file request.c.

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

static void build_class_list_reply ( SockList sl)
static

Creates the appropriate reply to the 'class_list' request info.

Parameters
slreply.

Definition at line 1620 of file request.c.

References CLASS, archt::clone, first_archetype, archt::name, archt::next, SockList_AddPrintf(), SockList_AddString(), SockList_Reset(), and obj::type.

Referenced by send_class_list().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void build_race_list_reply ( SockList sl)
static

Creates the appropriate reply to the 'race_list' request info.

Parameters
slsuitable reply.

Definition at line 1557 of file request.c.

References archt::clone, first_archetype, archt::name, archt::next, PLAYER, SockList_AddPrintf(), SockList_AddString(), and obj::type.

Referenced by send_race_list().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void check_space_for_heads ( int  ax,
int  ay,
SockList sl,
socket_struct ns 
)
static

Definition at line 1148 of file request.c.

References Map::cells, socket_struct::lastmap, SockList::len, map2_add_ob(), MAP2_COORD_ENCODE, map2_delete_layer(), map_clearcell(), MAP_LAYERS, SockList_AddChar(), and SockList_AddShort().

Referenced by draw_client_map2().

+ Here is the call graph for this function:

+ Here is the caller 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 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_map_scroll ( socket_struct ns,
int  dx,
int  dy 
)
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_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_spells ( player pl)
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:

static int map2_add_ob ( int  ax,
int  ay,
int  layer,
object ob,
SockList sl,
socket_struct ns,
int *  has_obj,
int  is_head 
)
static

object 'ob' at 'ax,ay' on 'layer' is visible to the client. This function does the following things: If is_head head is set, this means this is from the heads[] array, so don't try to store it away again - just send it and update our look faces.

1) If a multipart object and we are not at the lower right corner, store this info away for later use. 2) Check to see if this face has been sent to the client. If not, we add data to the socklist, update the last map, and send any other data the client will need (smoothing table, image data, etc) 3) Return 1 if function increased socket. 4) has_obj is increased by one if there are visible objects on this this space, whether or not we sent them. Basically, if has_obj is 0, we can clear info about this space. It could be set to 1 with the function returning zero - this means there are objects on the space we have already sent to the client.

Definition at line 974 of file request.c.

References ANIM_RANDOM, obj::anim_speed, ANIM_SYNC, obj::animation_id, animations, socket_struct::anims_sent, obj::arch, Map::cells, archt::clone, esrv_send_animation(), esrv_send_face(), FABS, obj::face, animations_struct::faces, map_cell_struct::faces, socket_struct::faces_sent, FLAG_CLIENT_ANIM_RANDOM, FLAG_CLIENT_ANIM_SYNC, obj::head, socket_struct::lastmap, llevError, LOG(), obj::map, MAP_LAYERS, MAP_NOSMOOTH, NS_FACESENT_FACE, NS_FACESENT_SMOOTH, NUM_ANIMATIONS, new_face_struct::number, QUERY_FLAG, send_smooth(), obj::smoothlevel, SockList_AddChar(), SockList_AddShort(), obj::speed, archt::tail_x, archt::tail_y, obj::x, and obj::y.

Referenced by check_space_for_heads(), and draw_client_map2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int map2_delete_layer ( int  ax,
int  ay,
int  layer,
SockList sl,
socket_struct ns 
)
static

Definition at line 1119 of file request.c.

References Map::cells, map_cell_struct::faces, socket_struct::lastmap, SockList_AddChar(), and SockList_AddShort().

Referenced by check_space_for_heads(), and draw_client_map2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void map_clearcell ( struct map_cell_struct cell,
int  face,
int  count 
)
static

Clears a map cell

Definition at line 933 of file request.c.

References map_cell_struct::darkness, and map_cell_struct::faces.

Referenced by check_space_for_heads(), and draw_client_map2().

+ 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 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 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_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:

static void send_smooth ( socket_struct ns,
uint16  face 
)
static

A lot like the old AskSmooth (in fact, now called by AskSmooth). Basically, it makes no sense to wait for the client to request a a piece of data from us that we know the client wants. So if we know the client wants it, might as well push it to the client.

Definition at line 442 of file request.c.

References esrv_send_face(), socket_struct::faces_sent, find_smooth(), llevError, LOG(), new_face_struct::name, NS_FACESENT_FACE, NS_FACESENT_SMOOTH, new_face_struct::number, Send_With_Handling(), smooth_face, SockList_AddShort(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by ask_smooth_cmd(), and map2_add_ob().

+ 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_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 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:

Variable Documentation

const short atnr_cs_stat[NROFATTACKS]
static
Initial value:
= {
-1 , -1 ,
-1,
-1,
-1
}
#define CS_STAT_RES_MAG
Definition: newclient.h:129
#define CS_STAT_RES_PARA
Definition: newclient.h:139
#define CS_STAT_RES_BLIND
Definition: newclient.h:145
#define CS_STAT_RES_FEAR
Definition: newclient.h:141
#define CS_STAT_RES_PHYS
Definition: newclient.h:128
#define CS_STAT_RES_POISON
Definition: newclient.h:137
#define CS_STAT_RES_DEPLETE
Definition: newclient.h:142
#define CS_STAT_RES_DEATH
Definition: newclient.h:143
#define CS_STAT_RES_COLD
Definition: newclient.h:132
#define CS_STAT_RES_DRAIN
Definition: newclient.h:135
#define CS_STAT_RES_ACID
Definition: newclient.h:134
#define CS_STAT_RES_ELEC
Definition: newclient.h:131
#define CS_STAT_RES_SLOW
Definition: newclient.h:138
#define CS_STAT_RES_CONF
Definition: newclient.h:133
#define CS_STAT_RES_FIRE
Definition: newclient.h:130
#define CS_STAT_RES_HOLYWORD
Definition: newclient.h:144
#define CS_STAT_TURN_UNDEAD
Definition: newclient.h:140
#define CS_STAT_RES_GHOSTHIT
Definition: newclient.h:136

This table translates the attack numbers as used within the program to the value we use when sending STATS command to the client. If a value is -1, then we don't send that to the client.

Definition at line 96 of file request.c.

Referenced by esrv_update_stats().

Using a global really isn't a good approach, but saves the over head of allocating and deallocating such a block of data each time run through, and saves the space of allocating this in the socket object when we only need it for this cycle. If the serve is ever threaded, this needs to be re-examined.

Definition at line 947 of file request.c.