ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/item.C
(Generate patch)

Comparing deliantra/server/socket/item.C (file contents):
Revision 1.55 by root, Thu Nov 8 19:43:29 2007 UTC vs.
Revision 1.59 by root, Tue Apr 22 02:46:18 2008 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
346 else 346 else
347 pl->ns->update_look = 0; 347 pl->ns->update_look = 0;
348 348
349 if (QUERY_FLAG (ob, FLAG_REMOVED) 349 if (QUERY_FLAG (ob, FLAG_REMOVED)
350 || !ob->map 350 || !ob->map
351 || ob->map->in_memory != MAP_IN_MEMORY 351 || ob->map->in_memory != MAP_ACTIVE
352 || out_of_map (ob->map, ob->x, ob->y)) 352 || out_of_map (ob->map, ob->x, ob->y))
353 return; 353 return;
354 354
355 pl->ns->send_packet ("delinv 0"); 355 pl->ns->send_packet ("delinv 0");
356 356
665 pl->contr->ns->send_packet (sl); 665 pl->contr->ns->send_packet (sl);
666 SET_FLAG (op, FLAG_CLIENT_SENT); 666 SET_FLAG (op, FLAG_CLIENT_SENT);
667} 667}
668 668
669/** 669/**
670 * Tells the client to delete an item. Uses the item 670 * Tells the client to delete an item.
671 * command with a -1 location.
672 */ 671 */
673void 672void
674esrv_del_item (player *pl, int tag) 673esrv_del_item (player *pl, int tag)
675{ 674{
676 if (!pl->ns) 675 if (!pl->ns)
800 tag_t tag = net_uint32 ((uint8 *)data + 1); 799 tag_t tag = net_uint32 ((uint8 *)data + 1);
801 object *op = esrv_get_ob_from_count (pl->ob, tag); 800 object *op = esrv_get_ob_from_count (pl->ob, tag);
802 801
803 if (!op) 802 if (!op)
804 { 803 {
805 new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to lock/unlock"); 804 pl->failmsg ("Could not find object to lock/unlock");
806 return; 805 return;
807 } 806 }
808 807
809 if (!flag) 808 if (!flag)
810 CLEAR_FLAG (op, FLAG_INV_LOCKED); 809 CLEAR_FLAG (op, FLAG_INV_LOCKED);
821 tag_t tag = net_uint32 ((uint8 *)data); 820 tag_t tag = net_uint32 ((uint8 *)data);
822 object *op = esrv_get_ob_from_count (pl->ob, tag); 821 object *op = esrv_get_ob_from_count (pl->ob, tag);
823 822
824 if (!op) 823 if (!op)
825 { 824 {
826 new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to mark"); 825 pl->failmsg ("Could not find object to mark");
827 return; 826 return;
828 } 827 }
829 828
830 pl->mark = op; 829 pl->mark = op;
831 new_draw_info_format (NDI_UNIQUE, 0, pl->ob, "Marked item %s", query_name (op)); 830 pl->ob->statusmsg (format ("Marked item %s", query_name (op)));
832} 831}
833 832
834/** 833/**
835 * look_at prints items on the specified square. 834 * look_at prints items on the specified square.
836 * 835 *
925 */ 924 */
926 if (op->inv && QUERY_FLAG (op, FLAG_APPLIED)) 925 if (op->inv && QUERY_FLAG (op, FLAG_APPLIED))
927 { 926 {
928 object *current, *next; 927 object *current, *next;
929 928
929 int cnt = MAX_ITEM_PER_DROP;
930
930 for (current = op->inv; current != NULL; current = next) 931 for (current = op->inv; current != NULL; current = next)
931 { 932 {
932 next = current->below; 933 next = current->below;
933 drop_object (pl, current, 0); 934 drop_object (pl, current, 0);
935
936 if (--cnt <= 0) break;
934 } 937 }
938
939 if (cnt <= 0)
940 op->failmsg ("Only dropped some items, can't drop that many items at once.");
935 941
936 esrv_update_item (UPD_WEIGHT, pl, op); 942 esrv_update_item (UPD_WEIGHT, pl, op);
937 } 943 }
938 else 944 else
939 drop_object (pl, op, nrof); 945 drop_object (pl, op, nrof);
946
947 update_after_inventory_change (pl);
940 948
941 return; 949 return;
942 } 950 }
943 else if (to == pl->count) 951 else if (to == pl->count)
944 { /* pick it up to the inventory */ 952 { /* pick it up to the inventory */
962 * has already been done (eg, it can be picked up and fits in 970 * has already been done (eg, it can be picked up and fits in
963 * in a sack, so check for those things. We should also check 971 * in a sack, so check for those things. We should also check
964 * an make sure env is in fact a container for that matter. 972 * an make sure env is in fact a container for that matter.
965 */ 973 */
966 if (env->type == CONTAINER && can_pick (pl, op) && sack_can_hold (pl, env, op, nrof)) 974 if (env->type == CONTAINER && can_pick (pl, op) && sack_can_hold (pl, env, op, nrof))
975 {
967 put_object_in_sack (pl, env, op, nrof); 976 put_object_in_sack (pl, env, op, nrof);
977 update_after_inventory_change (pl);
978 }
968} 979}
969 980

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines