… | |
… | |
214 | return; |
214 | return; |
215 | |
215 | |
216 | for (tmp = get_map_ob (pl->map, pl->x, pl->y); tmp && tmp->above; tmp = tmp->above) |
216 | for (tmp = get_map_ob (pl->map, pl->x, pl->y); tmp && tmp->above; tmp = tmp->above) |
217 | ; |
217 | ; |
218 | |
218 | |
|
|
219 | pl->contr->socket->send_packet ("delinv 0"); |
|
|
220 | |
219 | packet sl; |
221 | packet sl; |
220 | |
|
|
221 | pl->contr->socket->send_packet ("delinv 0"); |
|
|
222 | |
|
|
223 | sl.printf ("item%d ", pl->contr->socket->itemcmd); |
222 | sl.printf ("item%d ", pl->contr->socket->itemcmd); |
224 | |
223 | |
225 | sl << uint32 (0); |
224 | sl << uint32 (0); |
226 | |
225 | |
227 | if (!(pl->contr->socket->faces_sent[empty_face->number] & NS_FACESENT_FACE)) |
226 | if (!(pl->contr->socket->faces_sent[empty_face->number] & NS_FACESENT_FACE)) |
228 | esrv_send_face (pl->contr->socket, empty_face->number, 0); |
227 | esrv_send_face (pl->contr->socket, empty_face->number, 0); |
229 | |
228 | |
230 | if (pl->contr->socket->look_position) |
229 | if (pl->contr->socket->look_position) |
231 | { |
230 | { |
232 | char buf[80]; |
231 | char buf[80]; |
233 | snprintf (buf, 80, "Apply this to see %d previous items", NUM_LOOK_OBJECTS); |
232 | snprintf (buf, 80, "Apply this to see %d previous items", FLOORBOX_PAGESIZE); |
234 | |
233 | |
235 | sl << uint32 (0x80000000 | (pl->contr->socket->look_position - NUM_LOOK_OBJECTS)) |
234 | sl << uint32 (0x80000000 | (pl->contr->socket->look_position - FLOORBOX_PAGESIZE)) |
236 | << uint32 (0) |
235 | << uint32 (0) |
237 | << sint32 (-1) |
236 | << sint32 (-1) |
238 | << uint32 (empty_face->number) |
237 | << uint32 (empty_face->number) |
239 | << data8 (buf) |
238 | << data8 (buf) |
240 | << uint16 (0) |
239 | << uint16 (0) |
… | |
… | |
261 | if (++start_look < pl->contr->socket->look_position) |
260 | if (++start_look < pl->contr->socket->look_position) |
262 | continue; |
261 | continue; |
263 | |
262 | |
264 | end_look++; |
263 | end_look++; |
265 | |
264 | |
266 | if (end_look > NUM_LOOK_OBJECTS) |
265 | if (end_look > FLOORBOX_PAGESIZE) |
267 | { |
266 | { |
268 | /* What we basically do is make a 'fake' object - when the user applies it, |
267 | /* What we basically do is make a 'fake' object - when the user applies it, |
269 | * we notice the special tag the object has, and act accordingly. |
268 | * we notice the special tag the object has, and act accordingly. |
270 | */ |
269 | */ |
271 | sl << uint32 (0x80000000 | (pl->contr->socket->look_position + NUM_LOOK_OBJECTS)) |
270 | sl << uint32 (0x80000000 | (pl->contr->socket->look_position + FLOORBOX_PAGESIZE)) |
272 | << uint32 (0) |
271 | << uint32 (0) |
273 | << uint32 ((uint32) - 1) |
272 | << uint32 ((uint32) - 1) |
274 | << uint32 (empty_face->number) |
273 | << uint32 (empty_face->number) |
275 | << data8 ("Apply this to see next group of items") |
274 | << data8 ("Apply this to see next group of items") |
276 | << uint16 (0) |
275 | << uint16 (0) |
… | |
… | |
315 | esrv_send_inventory (object *pl, object *op) |
314 | esrv_send_inventory (object *pl, object *op) |
316 | { |
315 | { |
317 | object *tmp; |
316 | object *tmp; |
318 | int got_one = 0; |
317 | int got_one = 0; |
319 | |
318 | |
|
|
319 | |
|
|
320 | pl->contr->socket->send_packet_printf ("delinv %d", op->count); |
|
|
321 | |
320 | packet sl; |
322 | packet sl; |
321 | |
|
|
322 | sl.printf ("delinv %d", op->count); |
|
|
323 | pl->contr->socket->send_packet (sl); |
|
|
324 | |
|
|
325 | sl.reset (); |
|
|
326 | sl.printf ("item%d ", pl->contr->socket->itemcmd); |
323 | sl.printf ("item%d ", pl->contr->socket->itemcmd); |
327 | |
324 | |
328 | sl << uint32 (op->count); |
325 | sl << uint32 (op->count); |
329 | |
326 | |
330 | for (tmp = op->inv; tmp; tmp = tmp->below) |
327 | for (tmp = op->inv; tmp; tmp = tmp->below) |
… | |
… | |
391 | * and track back the call. |
388 | * and track back the call. |
392 | */ |
389 | */ |
393 | LOG (llevDebug, "We have not sent item %s (%d)\n", &op->name, op->count); |
390 | LOG (llevDebug, "We have not sent item %s (%d)\n", &op->name, op->count); |
394 | } |
391 | } |
395 | |
392 | |
396 | packet sl; |
393 | packet sl ("upditem"); |
397 | |
394 | |
398 | sl << "upditem " |
|
|
399 | << uint8 (flags); |
395 | sl << uint8 (flags); |
400 | |
396 | |
401 | if (op->head) |
397 | if (op->head) |
402 | op = op->head; |
398 | op = op->head; |
403 | |
399 | |
404 | sl << uint32 (op->count); |
400 | sl << uint32 (op->count); |
… | |
… | |
532 | */ |
528 | */ |
533 | |
529 | |
534 | void |
530 | void |
535 | esrv_del_item (player *pl, int tag) |
531 | esrv_del_item (player *pl, int tag) |
536 | { |
532 | { |
537 | packet sl; |
533 | packet sl ("delitem"); |
538 | |
534 | |
539 | sl << "delitem " |
|
|
540 | << uint32 (tag); |
535 | sl << uint32 (tag); |
541 | |
536 | |
542 | pl->socket->send_packet (sl); |
537 | pl->socket->send_packet (sl); |
543 | } |
538 | } |
544 | |
539 | |
545 | |
540 | |
… | |
… | |
634 | } |
629 | } |
635 | |
630 | |
636 | player_apply (pl->ob, op, 0, 0); |
631 | player_apply (pl->ob, op, 0, 0); |
637 | } |
632 | } |
638 | |
633 | |
639 | /** Client wants to apply some object. Lets do so. */ |
634 | /** Client wants to lock some object. Lets do so. */ |
640 | void |
635 | void |
641 | LockItem (char *data, int len, player *pl) |
636 | LockItem (char *data, int len, player *pl) |
642 | { |
637 | { |
643 | int flag = data[0]; |
638 | int flag = data[0]; |
644 | tag_t tag = net_uint32 ((uint8 *)data + 1); |
639 | tag_t tag = net_uint32 ((uint8 *)data + 1); |
… | |
… | |
656 | SET_FLAG (op, FLAG_INV_LOCKED); |
651 | SET_FLAG (op, FLAG_INV_LOCKED); |
657 | |
652 | |
658 | esrv_update_item (UPD_FLAGS, pl->ob, op); |
653 | esrv_update_item (UPD_FLAGS, pl->ob, op); |
659 | } |
654 | } |
660 | |
655 | |
661 | /** Client wants to apply some object. Lets do so. */ |
656 | /** Client wants to mark some object. Lets do so. */ |
662 | void |
657 | void |
663 | MarkItem (char *data, int len, player *pl) |
658 | MarkItem (char *data, int len, player *pl) |
664 | { |
659 | { |
665 | tag_t tag = net_uint32 ((uint8 *)data); |
660 | tag_t tag = net_uint32 ((uint8 *)data); |
666 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
661 | object *op = esrv_get_ob_from_count (pl->ob, tag); |