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.254 by root, Sun Aug 31 01:17:11 2008 UTC vs.
Revision 1.258 by root, Mon Sep 29 09:04:50 2008 UTC

232 || memcmp (&ob1->stats , &ob2->stats , sizeof (ob1->stats))) 232 || memcmp (&ob1->stats , &ob2->stats , sizeof (ob1->stats)))
233 return 0; 233 return 0;
234 234
235 if ((ob1->flag ^ ob2->flag) 235 if ((ob1->flag ^ ob2->flag)
236 .reset (FLAG_INV_LOCKED) 236 .reset (FLAG_INV_LOCKED)
237 .reset (FLAG_CLIENT_SENT)
238 .reset (FLAG_REMOVED) 237 .reset (FLAG_REMOVED)
239 .any ()) 238 .any ())
240 return 0; 239 return 0;
241 240
242 /* This is really a spellbook check - we should in general 241 /* This is really a spellbook check - we should in general
637 } 636 }
638 637
639 if (speed < 0) 638 if (speed < 0)
640 dst->speed_left -= rndm (); 639 dst->speed_left -= rndm ();
641 640
642 dst->set_speed (dst->speed); 641 dst->activate ();
643} 642}
644 643
645void 644void
646object::instantiate () 645object::instantiate ()
647{ 646{
831{ 830{
832 /* If already on active list, don't do anything */ 831 /* If already on active list, don't do anything */
833 if (active) 832 if (active)
834 return; 833 return;
835 834
835 if (has_active_speed () && flag [FLAG_FREED]) LOG (llevError | logBacktrace, "BUG: tried to activate freed object %s\n", debug_desc ());//D
836 if (has_active_speed () && flag [FLAG_DEBUG]) LOG (llevError | logBacktrace, "BUG: tried to activate DEBUG object %s\n", debug_desc ());//D temp
837
836 if (has_active_speed ()) 838 if (has_active_speed ())
837 actives.insert (this); 839 actives.insert (this);
838} 840}
839 841
840void 842void
981 x = 1; 983 x = 1;
982 y = 1; 984 y = 1;
983 985
984 if (more) 986 if (more)
985 { 987 {
986 more->destroy (); 988 more->destroy (true);
987 more = 0; 989 more = 0;
988 } 990 }
989 991
990 head = 0; 992 head = 0;
991 993
1189 esrv_update_item (UPD_NROF, pl, top); 1191 esrv_update_item (UPD_NROF, pl, top);
1190 1192
1191 op->weight = 0; // cancel the addition above 1193 op->weight = 0; // cancel the addition above
1192 op->carrying = 0; // must be 0 already 1194 op->carrying = 0; // must be 0 already
1193 1195
1194 op->destroy (1); 1196 op->destroy (true);
1195 1197
1196 return top; 1198 return top;
1197 } 1199 }
1198 1200
1199 return 0; 1201 return 0;
1273 { 1275 {
1274 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)");
1275 op->remove (); 1277 op->remove ();
1276 } 1278 }
1277 1279
1278 if (op->face && !face_info (op->face))//D TODO: remove soon 1280 if (m == &freed_map)//D TODO: remove soon
1279 {//D 1281 {//D
1280 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
1281 op->face = 1;//D
1282 }//D 1283 }//D
1283 1284
1284 /* Ideally, the caller figures this out. However, it complicates a lot 1285 /* Ideally, the caller figures this out. However, it complicates a lot
1285 * 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
1286 * need extra work 1287 * need extra work
1287 */ 1288 */
1288 if (!xy_normalise (m, op->x, op->y)) 1289 if (!xy_normalise (m, op->x, op->y))
1289 { 1290 {
1290 op->head_ ()->destroy (1);// remove head_ once all tail object destroyers found 1291 op->head_ ()->destroy (true);// remove head_ once all tail object destroyers found
1291 return 0; 1292 return 0;
1292 } 1293 }
1293 1294
1294 if (object *more = op->more) 1295 if (object *more = op->more)
1295 if (!insert_ob_in_map (more, m, originator, flag)) 1296 if (!insert_ob_in_map (more, m, originator, flag))
1308 { 1309 {
1309 // TODO: we actually want to update tmp, not op, 1310 // TODO: we actually want to update tmp, not op,
1310 // but some caller surely breaks when we return tmp 1311 // but some caller surely breaks when we return tmp
1311 // from here :/ 1312 // from here :/
1312 op->nrof += tmp->nrof; 1313 op->nrof += tmp->nrof;
1313 tmp->destroy (1); 1314 tmp->destroy (true);
1314 } 1315 }
1315 1316
1316 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 */
1317 CLEAR_FLAG (op, FLAG_INV_LOCKED); 1318 CLEAR_FLAG (op, FLAG_INV_LOCKED);
1318 1319
1493{ 1494{
1494 /* first search for itself and remove any old instances */ 1495 /* first search for itself and remove any old instances */
1495 1496
1496 for (object *tmp = op->ms ().bot; tmp; tmp = tmp->above) 1497 for (object *tmp = op->ms ().bot; tmp; tmp = tmp->above)
1497 if (!strcmp (tmp->arch->archname, arch_string)) /* same archetype */ 1498 if (!strcmp (tmp->arch->archname, arch_string)) /* same archetype */
1498 tmp->destroy (1); 1499 tmp->destroy (true);
1499 1500
1500 object *tmp = arch_to_object (archetype::find (arch_string)); 1501 object *tmp = arch_to_object (archetype::find (arch_string));
1501 1502
1502 tmp->x = op->x; 1503 tmp->x = op->x;
1503 tmp->y = op->y; 1504 tmp->y = op->y;
1626 if (object *pl = tmp->visible_to ()) 1627 if (object *pl = tmp->visible_to ())
1627 esrv_update_item (UPD_NROF, pl, tmp); 1628 esrv_update_item (UPD_NROF, pl, tmp);
1628 1629
1629 adjust_weight (this, op->total_weight ()); 1630 adjust_weight (this, op->total_weight ());
1630 1631
1631 op->destroy (1); 1632 op->destroy (true);
1632 op = tmp; 1633 op = tmp;
1633 goto inserted; 1634 goto inserted;
1634 } 1635 }
1635 1636
1636 op->owner = 0; // it's his/hers now. period. 1637 op->owner = 0; // it's his/hers now. period.
2485 2486
2486#if 0 2487#if 0
2487 // remove the "Close old_container" object. 2488 // remove the "Close old_container" object.
2488 if (object *closer = old_container->inv) 2489 if (object *closer = old_container->inv)
2489 if (closer->type == CLOSE_CON) 2490 if (closer->type == CLOSE_CON)
2490 closer->destroy (); 2491 closer->destroy (true);
2491#endif 2492#endif
2492 2493
2493 // make sure the container is available 2494 // make sure the container is available
2494 esrv_send_item (this, old_container); 2495 esrv_send_item (this, old_container);
2495 2496
2551 2552
2552void 2553void
2553object::force_add (const shstr name, int duration) 2554object::force_add (const shstr name, int duration)
2554{ 2555{
2555 if (object *force = force_find (name)) 2556 if (object *force = force_find (name))
2556 force->destroy (); 2557 force->destroy (true);
2557 2558
2558 object *force = get_archetype (FORCE_NAME); 2559 object *force = get_archetype (FORCE_NAME);
2559 2560
2560 force->slaying = name; 2561 force->slaying = name;
2561 force->stats.food = 1; 2562 force->stats.food = 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines