--- deliantra/server/socket/item.C 2006/12/14 00:23:59 1.14 +++ deliantra/server/socket/item.C 2006/12/14 01:59:10 1.17 @@ -111,12 +111,12 @@ return flags; } -/* Used in the send_look to put object head into SockList +/* Used in the send_look to put object head into packet * sl for socket ns. Need socket to know if we need to send * animation of face to the client. */ static void -add_object_to_socklist (NewSocket &ns, SockList &sl, object *head) +add_object_to_socklist (NewSocket &ns, packet &sl, object *head) { int flags, len, anim_speed; char item_n[MAX_BUF]; @@ -218,9 +218,9 @@ for (tmp = get_map_ob (pl->map, pl->x, pl->y); tmp && tmp->above; tmp = tmp->above) ; - SockList sl (MAXSOCKBUF); + packet sl; - Write_String_To_Socket (&pl->contr->socket, "delinv 0", sizeof ("delinv 0") - 1); + pl->contr->socket.send_packet ("delinv 0"); sl.printf ("item%d ", pl->contr->socket.itemcmd); @@ -294,7 +294,7 @@ add_object_to_socklist (pl->contr->socket, sl, head); got_one++; - if (sl.len >= (MAXSOCKBUF - MAXITEMLEN)) + if (sl.length () >= (MAXSOCKBUF - MAXITEMLEN)) { Send_With_Handling (&pl->contr->socket, &sl); @@ -309,7 +309,6 @@ if (got_one) Send_With_Handling (&pl->contr->socket, &sl); - sl.free (); } /** @@ -321,7 +320,7 @@ object *tmp; int got_one = 0; - SockList sl (MAXSOCKBUF); + packet sl; sl.printf ("delinv %d", op->count); Send_With_Handling (&pl->contr->socket, &sl); @@ -350,11 +349,12 @@ * items (especially with some of the bags out there) to * overflow the buffer. IF so, send multiple item commands. */ - if (sl.len >= (MAXSOCKBUF - MAXITEMLEN)) + if (sl.length () >= (MAXSOCKBUF - MAXITEMLEN)) { Send_With_Handling (&pl->contr->socket, &sl); - sprintf ((char *) sl.buf, "item%d ", pl->contr->socket.itemcmd); - sl.len = strlen ((char *) sl.buf); + + sl.reset (); + sl.printf ("item%d ", pl->contr->socket.itemcmd); sl << uint32 (op->count); got_one = 0; } @@ -364,7 +364,6 @@ if (got_one) Send_With_Handling (&pl->contr->socket, &sl); - sl.free (); } /** @@ -398,7 +397,7 @@ LOG (llevDebug, "We have not sent item %s (%d)\n", &op->name, op->count); } - SockList sl (MAXSOCKBUF); + packet sl; sl << "upditem " << uint8 (flags); @@ -492,7 +491,6 @@ sl << uint32 (op->nrof); Send_With_Handling (&pl->contr->socket, &sl); - sl.free (); } /** @@ -517,7 +515,7 @@ } } - SockList sl (MAXSOCKBUF); + packet sl; sl.printf ("item%d ", pl->contr->socket.itemcmd); @@ -531,7 +529,6 @@ Send_With_Handling (&pl->contr->socket, &sl); SET_FLAG (op, FLAG_CLIENT_SENT); - sl.free (); } /** @@ -542,13 +539,12 @@ void esrv_del_item (player *pl, int tag) { - SockList sl (MAXSOCKBUF); + packet sl; sl << "delitem " << uint32 (tag); Send_With_Handling (&pl->socket, &sl); - sl.free (); }