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.257 by root, Tue Sep 16 16:03:02 2008 UTC vs.
Revision 1.260 by root, Mon Sep 29 10:35:36 2008 UTC

909 || map->in_memory != MAP_ACTIVE 909 || map->in_memory != MAP_ACTIVE
910 || map->no_drop 910 || map->no_drop
911 || ms ().move_block == MOVE_ALL) 911 || ms ().move_block == MOVE_ALL)
912 { 912 {
913 while (inv) 913 while (inv)
914 inv->destroy (true); 914 inv->destroy ();
915 } 915 }
916 else 916 else
917 { /* Put objects in inventory onto this space */ 917 { /* Put objects in inventory onto this space */
918 while (inv) 918 while (inv)
919 { 919 {
923 || op->flag [FLAG_NO_DROP] 923 || op->flag [FLAG_NO_DROP]
924 || op->type == RUNE 924 || op->type == RUNE
925 || op->type == TRAP 925 || op->type == TRAP
926 || op->flag [FLAG_IS_A_TEMPLATE] 926 || op->flag [FLAG_IS_A_TEMPLATE]
927 || op->flag [FLAG_DESTROY_ON_DEATH]) 927 || op->flag [FLAG_DESTROY_ON_DEATH])
928 op->destroy (true); 928 op->destroy ();
929 else 929 else
930 map->insert (op, x, y); 930 map->insert (op, x, y);
931 } 931 }
932 } 932 }
933} 933}
997 attacked_by = 0; 997 attacked_by = 0;
998 current_weapon = 0; 998 current_weapon = 0;
999} 999}
1000 1000
1001void 1001void
1002object::destroy (bool destroy_inventory) 1002object::destroy ()
1003{ 1003{
1004 if (destroyed ()) 1004 if (destroyed ())
1005 return; 1005 return;
1006 1006
1007 if (!is_head () && !head->destroyed ()) 1007 if (!is_head () && !head->destroyed ())
1008 { 1008 {
1009 LOG (llevError | logBacktrace, "tried to destroy the tail of an object"); 1009 LOG (llevError | logBacktrace, "tried to destroy the tail of an object");
1010 head->destroy (destroy_inventory); 1010 head->destroy ();
1011 return; 1011 return;
1012 } 1012 }
1013 1013
1014 destroy_inv (!destroy_inventory); 1014 destroy_inv (false);
1015 1015
1016 if (is_head ()) 1016 if (is_head ())
1017 if (sound_destroy) 1017 if (sound_destroy)
1018 play_sound (sound_destroy); 1018 play_sound (sound_destroy);
1019 else if (flag [FLAG_MONSTER]) 1019 else if (flag [FLAG_MONSTER])
1191 esrv_update_item (UPD_NROF, pl, top); 1191 esrv_update_item (UPD_NROF, pl, top);
1192 1192
1193 op->weight = 0; // cancel the addition above 1193 op->weight = 0; // cancel the addition above
1194 op->carrying = 0; // must be 0 already 1194 op->carrying = 0; // must be 0 already
1195 1195
1196 op->destroy (1); 1196 op->destroy ();
1197 1197
1198 return top; 1198 return top;
1199 } 1199 }
1200 1200
1201 return 0; 1201 return 0;
1275 { 1275 {
1276 LOG (llevError, "insert_ob_in_map called for object in an inventory (proceeding)"); 1276 LOG (llevError, "insert_ob_in_map called for object in an inventory (proceeding)");
1277 op->remove (); 1277 op->remove ();
1278 } 1278 }
1279 1279
1280 if (op->face && !face_info (op->face))//D TODO: remove soon 1280 if (m == &freed_map)//D TODO: remove soon
1281 {//D 1281 {//D
1282 LOG (llevError | logBacktrace, "op->face out of bounds: %s", op->debug_desc ());//D 1282 LOG (llevError | logBacktrace, "tries to insret object on freed objects map: %s", op->debug_desc ());//D
1283 op->face = 1;//D
1284 }//D 1283 }//D
1285 1284
1286 /* Ideally, the caller figures this out. However, it complicates a lot 1285 /* Ideally, the caller figures this out. However, it complicates a lot
1287 * of areas of callers (eg, anything that uses find_free_spot would now 1286 * of areas of callers (eg, anything that uses find_free_spot would now
1288 * need extra work 1287 * need extra work
1289 */ 1288 */
1290 if (!xy_normalise (m, op->x, op->y)) 1289 if (!xy_normalise (m, op->x, op->y))
1291 { 1290 {
1292 op->head_ ()->destroy (1);// remove head_ once all tail object destroyers found 1291 op->head_ ()->destroy ();// remove head_ once all tail object destroyers found
1293 return 0; 1292 return 0;
1294 } 1293 }
1295 1294
1296 if (object *more = op->more) 1295 if (object *more = op->more)
1297 if (!insert_ob_in_map (more, m, originator, flag)) 1296 if (!insert_ob_in_map (more, m, originator, flag))
1310 { 1309 {
1311 // TODO: we actually want to update tmp, not op, 1310 // TODO: we actually want to update tmp, not op,
1312 // but some caller surely breaks when we return tmp 1311 // but some caller surely breaks when we return tmp
1313 // from here :/ 1312 // from here :/
1314 op->nrof += tmp->nrof; 1313 op->nrof += tmp->nrof;
1315 tmp->destroy (1); 1314 tmp->destroy ();
1316 } 1315 }
1317 1316
1318 CLEAR_FLAG (op, FLAG_APPLIED); /* hack for fixing F_APPLIED in items of dead people */ 1317 CLEAR_FLAG (op, FLAG_APPLIED); /* hack for fixing F_APPLIED in items of dead people */
1319 CLEAR_FLAG (op, FLAG_INV_LOCKED); 1318 CLEAR_FLAG (op, FLAG_INV_LOCKED);
1320 1319
1495{ 1494{
1496 /* first search for itself and remove any old instances */ 1495 /* first search for itself and remove any old instances */
1497 1496
1498 for (object *tmp = op->ms ().bot; tmp; tmp = tmp->above) 1497 for (object *tmp = op->ms ().bot; tmp; tmp = tmp->above)
1499 if (!strcmp (tmp->arch->archname, arch_string)) /* same archetype */ 1498 if (!strcmp (tmp->arch->archname, arch_string)) /* same archetype */
1500 tmp->destroy (1); 1499 tmp->destroy ();
1501 1500
1502 object *tmp = arch_to_object (archetype::find (arch_string)); 1501 object *tmp = arch_to_object (archetype::find (arch_string));
1503 1502
1504 tmp->x = op->x; 1503 tmp->x = op->x;
1505 tmp->y = op->y; 1504 tmp->y = op->y;
1628 if (object *pl = tmp->visible_to ()) 1627 if (object *pl = tmp->visible_to ())
1629 esrv_update_item (UPD_NROF, pl, tmp); 1628 esrv_update_item (UPD_NROF, pl, tmp);
1630 1629
1631 adjust_weight (this, op->total_weight ()); 1630 adjust_weight (this, op->total_weight ());
1632 1631
1633 op->destroy (1); 1632 op->destroy ();
1634 op = tmp; 1633 op = tmp;
1635 goto inserted; 1634 goto inserted;
1636 } 1635 }
1637 1636
1638 op->owner = 0; // it's his/hers now. period. 1637 op->owner = 0; // it's his/hers now. period.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines