--- deliantra/server/socket/item.C 2006/12/14 02:37:37 1.18 +++ deliantra/server/socket/item.C 2006/12/15 00:34:17 1.21 @@ -201,13 +201,13 @@ int got_one = 0, start_look = 0, end_look = 0; char buf[MAX_BUF]; - if (!pl->contr->socket.update_look) + if (!pl->contr->socket->update_look) { LOG (llevDebug, "esrv_draw_look called when update_look was not set\n"); return; } else - pl->contr->socket.update_look = 0; + pl->contr->socket->update_look = 0; if (QUERY_FLAG (pl, FLAG_REMOVED) || !pl->map @@ -220,29 +220,30 @@ packet sl; - pl->contr->socket.send_packet ("delinv 0"); + pl->contr->socket->send_packet ("delinv 0"); - sl.printf ("item%d ", pl->contr->socket.itemcmd); + sl.printf ("item%d ", pl->contr->socket->itemcmd); sl << uint32 (0); - if (!(pl->contr->socket.faces_sent[empty_face->number] & NS_FACESENT_FACE)) - esrv_send_face (&pl->contr->socket, empty_face->number, 0); + if (!(pl->contr->socket->faces_sent[empty_face->number] & NS_FACESENT_FACE)) + esrv_send_face (pl->contr->socket, empty_face->number, 0); - if (pl->contr->socket.look_position) + if (pl->contr->socket->look_position) { - sl << uint32 (0x80000000 | (pl->contr->socket.look_position - NUM_LOOK_OBJECTS)) + char buf[80]; + snprintf (buf, 80, "Apply this to see %d previous items", NUM_LOOK_OBJECTS); + + sl << uint32 (0x80000000 | (pl->contr->socket->look_position - NUM_LOOK_OBJECTS)) << uint32 (0) << sint32 (-1) - << uint32 (empty_face->number); - - sl.printf ("Click here to see %d previous items", NUM_LOOK_OBJECTS); - - sl << uint16 (0) + << uint32 (empty_face->number) + << data8 (buf) + << uint16 (0) << uint8 (0) << uint32 (0); - if (pl->contr->socket.itemcmd == 2) + if (pl->contr->socket->itemcmd == 2) sl << uint16 (0); } @@ -259,7 +260,7 @@ if (LOOK_OBJ (tmp)) { - if (++start_look < pl->contr->socket.look_position) + if (++start_look < pl->contr->socket->look_position) continue; end_look++; @@ -269,18 +270,16 @@ /* What we basically do is make a 'fake' object - when the user applies it, * we notice the special tag the object has, and act accordingly. */ - sl << uint32 (0x80000000 | (pl->contr->socket.look_position + NUM_LOOK_OBJECTS)) + sl << uint32 (0x80000000 | (pl->contr->socket->look_position + NUM_LOOK_OBJECTS)) << uint32 (0) << uint32 ((uint32) - 1) - << uint32 (empty_face->number); - - sl.printf ("Click here to see next group of items"); - - sl << uint16 (0) + << uint32 (empty_face->number) + << data8 ("Apply this to see next group of items") + << uint16 (0) << uint8 (0) << uint32 (0); - if (pl->contr->socket.itemcmd == 2) + if (pl->contr->socket->itemcmd == 2) sl << uint16 (0); break; @@ -291,15 +290,15 @@ else head = tmp; - add_object_to_socklist (pl->contr->socket, sl, head); + add_object_to_socklist (*pl->contr->socket, sl, head); got_one++; if (sl.length () >= (MAXSOCKBUF - MAXITEMLEN)) { - Send_With_Handling (&pl->contr->socket, &sl); + pl->contr->socket->send_packet (sl); sl.reset (); - sl.printf ("item%d ", pl->contr->socket.itemcmd); + sl.printf ("item%d ", pl->contr->socket->itemcmd); sl << uint32 (0); got_one = 0; } @@ -307,7 +306,7 @@ } if (got_one) - Send_With_Handling (&pl->contr->socket, &sl); + pl->contr->socket->send_packet (sl); } @@ -323,10 +322,10 @@ packet sl; sl.printf ("delinv %d", op->count); - Send_With_Handling (&pl->contr->socket, &sl); + pl->contr->socket->send_packet (sl); sl.reset (); - sl.printf ("item%d ", pl->contr->socket.itemcmd); + sl.printf ("item%d ", pl->contr->socket->itemcmd); sl << uint32 (op->count); @@ -341,7 +340,7 @@ if (LOOK_OBJ (head)) { - add_object_to_socklist (pl->contr->socket, sl, head); + add_object_to_socklist (*pl->contr->socket, sl, head); got_one++; @@ -351,10 +350,10 @@ */ if (sl.length () >= (MAXSOCKBUF - MAXITEMLEN)) { - Send_With_Handling (&pl->contr->socket, &sl); + pl->contr->socket->send_packet (sl); sl.reset (); - sl.printf ("item%d ", pl->contr->socket.itemcmd); + sl.printf ("item%d ", pl->contr->socket->itemcmd); sl << uint32 (op->count); got_one = 0; } @@ -362,7 +361,7 @@ } if (got_one) - Send_With_Handling (&pl->contr->socket, &sl); + pl->contr->socket->send_packet (sl); } @@ -425,8 +424,8 @@ if (flags & UPD_FACE) { - if (!(pl->contr->socket.faces_sent[op->face->number] & NS_FACESENT_FACE)) - esrv_send_face (&pl->contr->socket, op->face->number, 0); + if (!(pl->contr->socket->faces_sent[op->face->number] & NS_FACESENT_FACE)) + esrv_send_face (pl->contr->socket, op->face->number, 0); sl << uint32 (op->face->number); } @@ -490,7 +489,7 @@ if (flags & UPD_NROF) sl << uint32 (op->nrof); - Send_With_Handling (&pl->contr->socket, &sl); + pl->contr->socket->send_packet (sl); } /** @@ -510,23 +509,23 @@ */ if (!op->env) { - pl->contr->socket.update_look = 1; + pl->contr->socket->update_look = 1; return; } } packet sl; - sl.printf ("item%d ", pl->contr->socket.itemcmd); + sl.printf ("item%d ", pl->contr->socket->itemcmd); if (op->head) op = op->head; sl << uint32 (op->env ? op->env->count : 0); - add_object_to_socklist (pl->contr->socket, sl, op); + add_object_to_socklist (*pl->contr->socket, sl, op); - Send_With_Handling (&pl->contr->socket, &sl); + pl->contr->socket->send_packet (sl); SET_FLAG (op, FLAG_CLIENT_SENT); } @@ -544,7 +543,7 @@ sl << "delitem " << uint32 (tag); - Send_With_Handling (&pl->socket, &sl); + pl->socket->send_packet (sl); } @@ -625,8 +624,8 @@ /* If the high bit is set, player applied a pseudo object. */ if (tag & 0x80000000) { - pl->socket.look_position = tag & 0x7fffffff; - pl->socket.update_look = 1; + pl->socket->look_position = tag & 0x7fffffff; + pl->socket->update_look = 1; return; } @@ -761,10 +760,10 @@ } dy = atoi (cp); - if (FABS (dx) > pl->socket.mapx / 2 || FABS (dy) > pl->socket.mapy / 2) + if (FABS (dx) > pl->socket->mapx / 2 || FABS (dy) > pl->socket->mapy / 2) return; - if (pl->blocked_los[dx + pl->socket.mapx / 2][dy + pl->socket.mapy / 2]) + if (pl->blocked_los[dx + pl->socket->mapx / 2][dy + pl->socket->mapy / 2]) return; look_at (pl->ob, dx, dy);