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.92 by root, Tue Dec 26 17:39:29 2006 UTC vs.
Revision 1.94 by root, Wed Dec 27 05:22:35 2006 UTC

785 * object.c ? 785 * object.c ?
786 */ 786 */
787void 787void
788object::destroy_inv (bool drop_to_ground) 788object::destroy_inv (bool drop_to_ground)
789{ 789{
790 // need to check first, because the checks below might segfault
791 // as we might be on an invalid mapspace and crossfire code
792 // is too buggy to ensure that the inventory is empty.
793 // corollary: if you create arrows etc. with stuff in tis inventory,
794 // cf will crash below with off-map x and y
795 if (!inv)
796 return;
797
790 /* Only if the space blocks everything do we not process - 798 /* Only if the space blocks everything do we not process -
791 * if some form of movement is allowed, let objects 799 * if some form of movement is allowed, let objects
792 * drop on that space. 800 * drop on that space.
793 */ 801 */
794 if (!drop_to_ground 802 if (!drop_to_ground
813 || op->type == RUNE 821 || op->type == RUNE
814 || op->type == TRAP 822 || op->type == TRAP
815 || op->flag [FLAG_IS_A_TEMPLATE]) 823 || op->flag [FLAG_IS_A_TEMPLATE])
816 op->destroy (); 824 op->destroy ();
817 else 825 else
818 { 826 map->insert (op, x, y);
819 op->remove ();
820 op->x = x;
821 op->y = y;
822 insert_ob_in_map (op, map, 0, 0); /* Insert in same map as the envir */
823 }
824 } 827 }
825 } 828 }
826} 829}
827 830
828object *object::create () 831object *object::create ()
1117 * job preparing multi-part monsters 1120 * job preparing multi-part monsters
1118 */ 1121 */
1119object * 1122object *
1120insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y) 1123insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y)
1121{ 1124{
1122 object *tmp;
1123
1124 if (op->head)
1125 op = op->head;
1126
1127 for (tmp = op; tmp; tmp = tmp->more) 1125 for (object *tmp = op->head_ (); tmp; tmp = tmp->more)
1128 { 1126 {
1129 tmp->x = x + tmp->arch->clone.x; 1127 tmp->x = x + tmp->arch->clone.x;
1130 tmp->y = y + tmp->arch->clone.y; 1128 tmp->y = y + tmp->arch->clone.y;
1131 } 1129 }
1132 1130
1446 tmp1->x = op->x; 1444 tmp1->x = op->x;
1447 tmp1->y = op->y; 1445 tmp1->y = op->y;
1448 insert_ob_in_map (tmp1, op->map, op, 0); 1446 insert_ob_in_map (tmp1, op->map, op, 0);
1449} 1447}
1450 1448
1449object *
1450object::insert_at (object *where, object *originator, int flags)
1451{
1452 where->map->insert (this, where->x, where->y, originator, flags);
1453}
1454
1451/* 1455/*
1452 * get_split_ob(ob,nr) splits up ob into two parts. The part which 1456 * get_split_ob(ob,nr) splits up ob into two parts. The part which
1453 * is returned contains nr objects, and the remaining parts contains 1457 * is returned contains nr objects, and the remaining parts contains
1454 * the rest (or is removed and freed if that number is 0). 1458 * the rest (or is removed and freed if that number is 0).
1455 * On failure, NULL is returned, and the reason put into the 1459 * On failure, NULL is returned, and the reason put into the
1456 * global static errmsg array. 1460 * global static errmsg array.
1457 */ 1461 */
1458
1459object * 1462object *
1460get_split_ob (object *orig_ob, uint32 nr) 1463get_split_ob (object *orig_ob, uint32 nr)
1461{ 1464{
1462 object *newob; 1465 object *newob;
1463 int is_removed = (QUERY_FLAG (orig_ob, FLAG_REMOVED) != 0); 1466 int is_removed = (QUERY_FLAG (orig_ob, FLAG_REMOVED) != 0);
1727 * 1730 *
1728 * MSW 2001-07-08: Check all objects on space, not just those below 1731 * MSW 2001-07-08: Check all objects on space, not just those below
1729 * object being inserted. insert_ob_in_map may not put new objects 1732 * object being inserted. insert_ob_in_map may not put new objects
1730 * on top. 1733 * on top.
1731 */ 1734 */
1732
1733int 1735int
1734check_move_on (object *op, object *originator) 1736check_move_on (object *op, object *originator)
1735{ 1737{
1736 object *tmp; 1738 object *tmp;
1737 maptile *m = op->map; 1739 maptile *m = op->map;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines