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

Comparing deliantra/server/common/object.C (file contents):
Revision 1.216 by root, Tue Apr 22 23:50:23 2008 UTC vs.
Revision 1.217 by root, Wed Apr 23 07:13:23 2008 UTC

917object::destroy_inv (bool drop_to_ground) 917object::destroy_inv (bool drop_to_ground)
918{ 918{
919 // need to check first, because the checks below might segfault 919 // need to check first, because the checks below might segfault
920 // as we might be on an invalid mapspace and crossfire code 920 // as we might be on an invalid mapspace and crossfire code
921 // is too buggy to ensure that the inventory is empty. 921 // is too buggy to ensure that the inventory is empty.
922 // corollary: if you create arrows etc. with stuff in tis inventory, 922 // corollary: if you create arrows etc. with stuff in its inventory,
923 // cf will crash below with off-map x and y 923 // cf will crash below with off-map x and y
924 if (!inv) 924 if (!inv)
925 return; 925 return;
926 926
927 /* Only if the space blocks everything do we not process - 927 /* Only if the space blocks everything do we not process -
934 || map->nodrop 934 || map->nodrop
935 || ms ().move_block == MOVE_ALL) 935 || ms ().move_block == MOVE_ALL)
936 { 936 {
937 while (inv) 937 while (inv)
938 { 938 {
939 inv->destroy_inv (drop_to_ground); 939 inv->destroy_inv (false);
940 inv->destroy (); 940 inv->destroy ();
941 } 941 }
942 } 942 }
943 else 943 else
944 { /* Put objects in inventory onto this space */ 944 { /* Put objects in inventory onto this space */
950 || op->flag [FLAG_NO_DROP] 950 || op->flag [FLAG_NO_DROP]
951 || op->type == RUNE 951 || op->type == RUNE
952 || op->type == TRAP 952 || op->type == TRAP
953 || op->flag [FLAG_IS_A_TEMPLATE] 953 || op->flag [FLAG_IS_A_TEMPLATE]
954 || op->flag [FLAG_DESTROY_ON_DEATH]) 954 || op->flag [FLAG_DESTROY_ON_DEATH])
955 op->destroy (); 955 op->destroy (true);
956 else 956 else
957 map->insert (op, x, y); 957 map->insert (op, x, y);
958 } 958 }
959 } 959 }
960} 960}
976 remove_friendly_object (this); 976 remove_friendly_object (this);
977 977
978 remove (); 978 remove ();
979 979
980 attachable::do_destroy (); 980 attachable::do_destroy ();
981
982 destroy_inv (true);
983 981
984 deactivate (); 982 deactivate ();
985 unlink (); 983 unlink ();
986 984
987 flag [FLAG_FREED] = 1; 985 flag [FLAG_FREED] = 1;
1028object::destroy (bool destroy_inventory) 1026object::destroy (bool destroy_inventory)
1029{ 1027{
1030 if (destroyed ()) 1028 if (destroyed ())
1031 return; 1029 return;
1032 1030
1033 if (destroy_inventory) 1031 destroy_inv (!destroy_inventory);
1034 destroy_inv (false);
1035 1032
1036 if (is_head ()) 1033 if (is_head ())
1037 if (sound_destroy) 1034 if (sound_destroy)
1038 play_sound (sound_destroy); 1035 play_sound (sound_destroy);
1039 else if (flag [FLAG_MONSTER]) 1036 else if (flag [FLAG_MONSTER])
1152 * removed (most likely destroyed), update the player view 1149 * removed (most likely destroyed), update the player view
1153 * appropriately. 1150 * appropriately.
1154 */ 1151 */
1155 pl->close_container (); 1152 pl->close_container ();
1156 1153
1157 pl->contr->ns->floorbox_update (); 1154 esrv_del_item (pl, count);
1158 } 1155 }
1159 1156
1160 for (tmp = ms.bot; tmp; tmp = tmp->above) 1157 for (tmp = ms.bot; tmp; tmp = tmp->above)
1161 { 1158 {
1162 /* No point updating the players look faces if he is the object 1159 /* No point updating the players look faces if he is the object
1298 * of areas of callers (eg, anything that uses find_free_spot would now 1295 * of areas of callers (eg, anything that uses find_free_spot would now
1299 * need extra work 1296 * need extra work
1300 */ 1297 */
1301 if (!xy_normalise (m, op->x, op->y)) 1298 if (!xy_normalise (m, op->x, op->y))
1302 { 1299 {
1303 op->destroy (); 1300 op->destroy (1);
1304 return 0; 1301 return 0;
1305 } 1302 }
1306 1303
1307 if (object *more = op->more) 1304 if (object *more = op->more)
1308 if (!insert_ob_in_map (more, m, originator, flag)) 1305 if (!insert_ob_in_map (more, m, originator, flag))
1456 } 1453 }
1457 1454
1458 op->map->dirty = true; 1455 op->map->dirty = true;
1459 1456
1460 if (object *pl = ms.player ()) 1457 if (object *pl = ms.player ())
1461 pl->contr->ns->floorbox_update (); 1458 esrv_send_item (pl, op);
1462 1459
1463 /* If this object glows, it may affect lighting conditions that are 1460 /* If this object glows, it may affect lighting conditions that are
1464 * visible to others on this map. But update_all_los is really 1461 * visible to others on this map. But update_all_los is really
1465 * an inefficient way to do this, as it means los for all players 1462 * an inefficient way to do this, as it means los for all players
1466 * on the map will get recalculated. The players could very well 1463 * on the map will get recalculated. The players could very well
2567 &name, 2564 &name,
2568 title ? "\",title:\"" : "", 2565 title ? "\",title:\"" : "",
2569 title ? (const char *)title : "", 2566 title ? (const char *)title : "",
2570 flag_desc (flagdesc, 512), type); 2567 flag_desc (flagdesc, 512), type);
2571 2568
2572 if (!this->flag[FLAG_REMOVED] && env) 2569 if (!flag[FLAG_REMOVED] && env)
2573 p += snprintf (p, 256, "(in %s)", env->debug_desc (info2)); 2570 p += snprintf (p, 256, "(in %s)", env->debug_desc (info2));
2574 2571
2575 if (map) 2572 if (map)
2576 p += snprintf (p, 256, "(on %s@%d+%d)", &map->path, x, y); 2573 p += snprintf (p, 256, "(on %s@%d+%d)", &map->path, x, y);
2577 2574

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines