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.223 by root, Wed Apr 30 08:29:31 2008 UTC vs.
Revision 1.226 by root, Sat May 3 08:50:30 2008 UTC

606} 606}
607 607
608object & 608object &
609object::operator =(const object &src) 609object::operator =(const object &src)
610{ 610{
611 bool is_freed = flag [FLAG_FREED]; 611 remove ();
612 bool is_removed = flag [FLAG_REMOVED];
613 612
614 *(object_copy *)this = src; 613 *(object_copy *)this = src;
615 614
616 flag [FLAG_FREED] = is_freed;
617 flag [FLAG_REMOVED] = is_removed; 615 flag [FLAG_REMOVED] = true;
618 616
619 /* Copy over key_values, if any. */ 617 /* Copy over key_values, if any. */
620 if (src.key_values) 618 if (src.key_values)
621 { 619 {
622 key_value *tail = 0; 620 key_value *tail = 0;
686object * 684object *
687object::clone () 685object::clone ()
688{ 686{
689 object *neu = create (); 687 object *neu = create ();
690 copy_to (neu); 688 copy_to (neu);
689 neu->map = map; // not copied by copy_to
691 return neu; 690 return neu;
692} 691}
693 692
694/* 693/*
695 * If an object with the IS_TURNABLE() flag needs to be turned due 694 * If an object with the IS_TURNABLE() flag needs to be turned due
1161 * appropriately. 1160 * appropriately.
1162 */ 1161 */
1163 pl->close_container (); 1162 pl->close_container ();
1164 1163
1165 //TODO: the floorbox prev/next might need updating 1164 //TODO: the floorbox prev/next might need updating
1166 esrv_del_item (pl->contr, count); 1165 //esrv_del_item (pl->contr, count);
1166 //TODO: update floorbox to preserve ordering
1167 if (pl->contr->ns)
1168 pl->contr->ns->floorbox_update ();
1167 } 1169 }
1168 1170
1169 for (tmp = ms.bot; tmp; tmp = tmp->above) 1171 for (tmp = ms.bot; tmp; tmp = tmp->above)
1170 { 1172 {
1171 /* No point updating the players look faces if he is the object 1173 /* No point updating the players look faces if he is the object
1469 1471
1470 op->map->dirty = true; 1472 op->map->dirty = true;
1471 1473
1472 if (object *pl = ms.player ()) 1474 if (object *pl = ms.player ())
1473 //TODO: the floorbox prev/next might need updating 1475 //TODO: the floorbox prev/next might need updating
1474 esrv_send_item (pl, op); 1476 //esrv_send_item (pl, op);
1477 //TODO: update floorbox to preserve ordering
1478 if (pl->contr->ns)
1479 pl->contr->ns->floorbox_update ();
1475 1480
1476 /* If this object glows, it may affect lighting conditions that are 1481 /* If this object glows, it may affect lighting conditions that are
1477 * visible to others on this map. But update_all_los is really 1482 * visible to others on this map. But update_all_los is really
1478 * an inefficient way to do this, as it means los for all players 1483 * an inefficient way to do this, as it means los for all players
1479 * on the map will get recalculated. The players could very well 1484 * on the map will get recalculated. The players could very well
2326 * create clone from object to another 2331 * create clone from object to another
2327 */ 2332 */
2328object * 2333object *
2329object_create_clone (object *asrc) 2334object_create_clone (object *asrc)
2330{ 2335{
2331 object *dst = 0, *tmp, *src, *prev, *item; 2336 object *dst = 0;
2332 2337
2333 if (!asrc) 2338 if (!asrc)
2334 return 0; 2339 return 0;
2335 2340
2336 src = asrc->head_ (); 2341 object *src = asrc->head_ ();
2337 2342
2338 prev = 0; 2343 object *prev = 0;
2339 for (object *part = src; part; part = part->more) 2344 for (object *part = src; part; part = part->more)
2340 { 2345 {
2341 tmp = part->clone (); 2346 object *tmp = part->clone ();
2347
2342 tmp->x -= src->x; 2348 tmp->x -= src->x;
2343 tmp->y -= src->y; 2349 tmp->y -= src->y;
2344 2350
2345 if (!part->head) 2351 if (!part->head)
2346 { 2352 {
2356 prev->more = tmp; 2362 prev->more = tmp;
2357 2363
2358 prev = tmp; 2364 prev = tmp;
2359 } 2365 }
2360 2366
2361 for (item = src->inv; item; item = item->below) 2367 for (object *item = src->inv; item; item = item->below)
2362 insert_ob_in_ob (object_create_clone (item), dst); 2368 insert_ob_in_ob (object_create_clone (item), dst);
2363 2369
2364 return dst; 2370 return dst;
2365} 2371}
2366 2372

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines