--- deliantra/server/socket/request.C 2006/12/14 01:12:35 1.32 +++ deliantra/server/socket/request.C 2006/12/14 01:21:58 1.33 @@ -104,11 +104,10 @@ int x, y, mx, my; { - SockList sl (MAXSOCKBUF); + packet sl; sl.printf ("map_scroll %d %d", dx, dy); ns->send_packet (sl); - sl.free (); } /* If we are using the Map1aCmd, we may in fact send @@ -708,14 +707,13 @@ ns->faces_sent[face] |= NS_FACESENT_SMOOTH; - SockList sl (MAXSOCKBUF); + packet sl; sl << "smooth " << uint16 (face) << uint16 (smoothface); Send_With_Handling (ns, &sl); - sl.free (); } /** @@ -794,7 +792,7 @@ { int time, repeat; char command[MAX_BUF]; - short packet; + int pktlen; if (len < 7) { @@ -802,7 +800,7 @@ return; } - packet = net_uint16 (buf); + pktlen = net_uint16 (buf); repeat = net_uint32 (buf + 2); /* -1 is special - no repeat, but don't update */ @@ -846,10 +844,9 @@ /* Send confirmation of command execution now */ - SockList sl (MAXSOCKBUF); - sl << "comc " << uint16 (packet) << uint32 (time); + packet sl; + sl << "comc " << uint16 (pktlen) << uint32 (time); Send_With_Handling (&pl->socket, &sl); - sl.free (); } @@ -1097,7 +1094,7 @@ char buf[MAX_BUF]; uint16 flags; - SockList sl (MAXSOCKBUF); + packet sl; sl << "stats "; if (pl->ob != NULL) @@ -1197,7 +1194,6 @@ Send_With_Handling (&pl->socket, &sl); } - sl.free (); } /** @@ -1208,7 +1204,7 @@ { pl->last_weight = weight; - SockList sl (MAXSOCKBUF); + packet sl; sl << "player "; sl << uint32 (pl->ob->count) @@ -1217,7 +1213,6 @@ << data8 (pl->ob->name); Send_With_Handling (&pl->socket, &sl); - sl.free (); SET_FLAG (pl->ob, FLAG_CLIENT_SENT); } @@ -1243,7 +1238,7 @@ return; } - SockList sl (MAXSOCKBUF); + packet sl; sl << "anim " << uint16 (anim_num) @@ -1260,7 +1255,6 @@ } Send_With_Handling (ns, &sl); - sl.free (); ns->anims_sent[anim_num] = 1; } @@ -1406,7 +1400,7 @@ static long frames, bytes, tbytes, tframes; char *cur; - SockList sl (MAXSOCKBUF); + packet sl; sl << "map "; cur = (char *) compactlayer (ns, (unsigned char *) sl.buf + sl.len, MAP_LAYERS, newmap); @@ -1429,7 +1423,6 @@ ns->sent_scroll = 0; } - sl.free (); } @@ -1481,7 +1474,7 @@ * sent, it returns zero. */ static int -check_head (SockList &sl, NewSocket &ns, int ax, int ay, int layer) +check_head (packet &sl, NewSocket &ns, int ax, int ay, int layer) { short face_num; @@ -1525,7 +1518,7 @@ */ static int -update_space (SockList &sl, NewSocket &ns, maptile *mp, int mx, int my, int sx, int sy, int layer) +update_space (packet &sl, NewSocket &ns, maptile *mp, int mx, int my, int sx, int sy, int layer) { object *ob, *head; uint16 face_num; @@ -1748,7 +1741,7 @@ */ static inline int -update_smooth (SockList &sl, NewSocket &ns, maptile *mp, int mx, int my, int sx, int sy, int layer) +update_smooth (packet &sl, NewSocket &ns, maptile *mp, int mx, int my, int sx, int sy, int layer) { object *ob; int smoothlevel; /* old face_num; */ @@ -1842,8 +1835,8 @@ check_map_change (pl->contr); - SockList sl (MAXSOCKBUF); - SockList esl (MAXSOCKBUF); + packet sl; + packet esl; sl << (socket.mapmode == Map1Cmd ? "map1 " : "map1a "); startlen = sl.len; @@ -2205,9 +2198,6 @@ Send_With_Handling (&socket, &sl); socket.sent_scroll = 0; } - - sl.free (); - esl.free (); } /** @@ -2360,7 +2350,7 @@ void send_skill_info (NewSocket *ns, char *params) { - SockList sl (MAXSOCKBUF); + packet sl; sl << "replyinfo skill_info\n"; for (int i = 1; i < NUM_SKILLS; i++) @@ -2373,7 +2363,6 @@ } Send_With_Handling (ns, &sl); - sl.free (); } /** @@ -2383,7 +2372,7 @@ void send_spell_paths (NewSocket * ns, char *params) { - SockList sl (MAXSOCKBUF); + packet sl; sl << "replyinfo spell_paths\n"; @@ -2397,7 +2386,6 @@ } Send_With_Handling (ns, &sl); - sl.free (); } /** @@ -2437,7 +2425,7 @@ if (flags) { - SockList sl (MAXSOCKBUF); + packet sl; sl << "updspell " << uint8 (flags) @@ -2448,7 +2436,6 @@ if (flags & UPD_SP_DAMAGE) sl << uint16 (spell->last_eat); Send_With_Handling (&pl->socket, &sl); - sl.free (); } } } @@ -2466,18 +2453,17 @@ return; } - SockList sl (MAXSOCKBUF); + packet sl; sl << "delspell " << uint32 (spell->count); Send_With_Handling (&pl->socket, &sl); - sl.free (); } /* appends the spell *spell to the Socklist we will send the data to. */ static void -append_spell (player *pl, SockList &sl, object *spell) +append_spell (player *pl, packet &sl, object *spell) { int len, i, skill = 0; @@ -2533,7 +2519,7 @@ if (!pl->socket.monitor_spells) return; - SockList sl (MAXSOCKBUF); + packet sl; sl << "addspell "; @@ -2584,6 +2570,5 @@ /* finally, we can send the packet */ Send_With_Handling (&pl->socket, &sl); - sl.free (); }