--- deliantra/server/socket/request.C 2006/12/15 04:21:29 1.40 +++ deliantra/server/socket/request.C 2006/12/16 03:08:26 1.42 @@ -48,8 +48,6 @@ #include #include -#include -#include #include #include @@ -90,17 +88,12 @@ }; static void -socket_map_scroll (client_socket * ns, int dx, int dy) +socket_map_scroll (client * ns, int dx, int dy) { struct Map newmap; int x, y, mx, my; - { - packet sl; - - sl.printf ("map_scroll %d %d", dx, dy); - ns->send_packet (sl); - } + ns->send_packet_printf ("map_scroll %d %d", dx, dy); /* If we are using the Map1aCmd, we may in fact send * head information that is outside the viewable map. @@ -150,7 +143,7 @@ static void clear_map (player *pl) { - client_socket &socket = *pl->socket; + client &socket = *pl->socket; memset (&socket.lastmap, 0, sizeof (socket.lastmap)); @@ -165,7 +158,7 @@ static void check_map_change (player *pl) { - client_socket &socket = *pl->socket; + client &socket = *pl->socket; object *ob = pl->ob; char buf[MAX_BUF]; /* eauugggh */ @@ -224,7 +217,7 @@ * that information. */ void -RequestInfo (char *buf, int len, client_socket * ns) +RequestInfo (char *buf, int len, client * ns) { char *params = NULL, *cp; @@ -357,7 +350,7 @@ /** This is the Setup cmd - easy first implementation */ void -SetUp (char *buf, int len, client_socket * ns) +SetUp (char *buf, int len, client * ns) { int s, slen; char *cmd, *param, cmdback[HUGE_BUF]; @@ -577,7 +570,7 @@ * it either has to be here or init_sockets needs to be exported. */ void -AddMeCmd (char *buf, int len, client_socket * ns) +AddMeCmd (char *buf, int len, client * ns) { Settings oldsettings; @@ -592,7 +585,7 @@ /** Reply to ExtendedInfos command */ void -ToggleExtendedInfos (char *buf, int len, client_socket * ns) +ToggleExtendedInfos (char *buf, int len, client * ns) { char cmdback[MAX_BUF]; char command[50]; @@ -653,7 +646,7 @@ /** Reply to ExtendedInfos command */ void -ToggleExtendedText (char *buf, int len, client_socket * ns) +ToggleExtendedText (char *buf, int len, client * ns) { char cmdback[MAX_BUF]; char temp[10]; @@ -714,7 +707,7 @@ * client. */ static void -SendSmooth (client_socket * ns, uint16 face) +SendSmooth (client * ns, uint16 face) { uint16 smoothface; @@ -748,7 +741,7 @@ * to smooth a picture number given as argument. */ void -AskSmooth (char *buf, int len, client_socket * ns) +AskSmooth (char *buf, int len, client * ns) { uint16 facenbr; @@ -939,7 +932,7 @@ * problem. */ void -VersionCmd (char *buf, int len, client_socket * ns) +VersionCmd (char *buf, int len, client * ns) { char *cp; char version_warning[256]; @@ -973,17 +966,8 @@ { LOG (llevDebug, "CS: connection from client of type <%s>, ip %s\n", cp, ns->host); - snprintf (ns->client, sizeof (ns->client), "%s", cp + 1); - - /* This is first implementation - i skip all beta DX clients with it - * Add later stuff here for other clients - */ + assign (ns->version, cp + 1); - /* these are old dxclients */ - /* Version 1024 added support for singular + plural name values - - * requiing this minimal value reduces complexity of that code, and it - * has been around for a long time. - */ if (ns->sc_version < 1026) { sprintf (version_warning, "drawinfo %d %s", NDI_RED, @@ -995,9 +979,8 @@ } /** sound related functions. */ - void -SetSound (char *buf, int len, client_socket * ns) +SetSound (char *buf, int len, client * ns) { ns->sound = atoi (buf); } @@ -1065,7 +1048,7 @@ * it needs to send something back (vs just printing out a message) */ void -send_query (client_socket * ns, uint8 flags, char *text) +send_query (client * ns, uint8 flags, char *text) { char buf[MAX_BUF]; @@ -1234,7 +1217,7 @@ * when the player logs in and picks stuff up. */ void -esrv_send_animation (client_socket * ns, short anim_num) +esrv_send_animation (client * ns, short anim_num) { int i; @@ -1281,7 +1264,7 @@ * the face yet, we will also send it. */ static void -esrv_map_setbelow (client_socket * ns, int x, int y, short face_num, struct Map *newmap) +esrv_map_setbelow (client * ns, int x, int y, short face_num, struct Map *newmap) { if (newmap->cells[x][y].count >= MAP_LAYERS) { @@ -1311,7 +1294,7 @@ /** Checkes if map cells have changed */ static int -mapcellchanged (client_socket * ns, int i, int j, struct Map *newmap) +mapcellchanged (client * ns, int i, int j, struct Map *newmap) { int k; @@ -1334,7 +1317,7 @@ * how many layers of data we should back. */ static uint8 * -compactlayer (client_socket * ns, unsigned char *cur, int numlayers, struct Map *newmap) +compactlayer (client * ns, unsigned char *cur, int numlayers, struct Map *newmap) { int x, y, k; int face; @@ -1452,7 +1435,7 @@ * sent, it returns zero. */ static int -check_head (packet &sl, client_socket &ns, int ax, int ay, int layer) +check_head (packet &sl, client &ns, int ax, int ay, int layer) { short face_num; @@ -1496,7 +1479,7 @@ */ static int -update_space (packet &sl, client_socket &ns, maptile *mp, int mx, int my, int sx, int sy, int layer) +update_space (packet &sl, client &ns, maptile *mp, int mx, int my, int sx, int sy, int layer) { object *ob, *head; uint16 face_num; @@ -1719,7 +1702,7 @@ */ static inline int -update_smooth (packet &sl, client_socket &ns, maptile *mp, int mx, int my, int sx, int sy, int layer) +update_smooth (packet &sl, client &ns, maptile *mp, int mx, int my, int sx, int sy, int layer) { object *ob; int smoothlevel; /* old face_num; */ @@ -1763,7 +1746,7 @@ * available. */ int -getExtendedMapInfoSize (client_socket * ns) +getExtendedMapInfoSize (client * ns) { int result = 0; @@ -1809,7 +1792,7 @@ uint8 extendedinfos; maptile *m; - client_socket &socket = *pl->contr->socket; + client &socket = *pl->contr->socket; check_map_change (pl->contr); @@ -2262,7 +2245,7 @@ * the params - we always send the same info no matter what. */ void -send_skill_info (client_socket *ns, char *params) +send_skill_info (client *ns, char *params) { packet sl; sl << "replyinfo skill_info\n"; @@ -2284,7 +2267,7 @@ * the params - we always send the same info no matter what. */ void -send_spell_paths (client_socket * ns, char *params) +send_spell_paths (client * ns, char *params) { packet sl;