… | |
… | |
813 | || op->type == RUNE |
813 | || op->type == RUNE |
814 | || op->type == TRAP |
814 | || op->type == TRAP |
815 | || op->flag [FLAG_IS_A_TEMPLATE]) |
815 | || op->flag [FLAG_IS_A_TEMPLATE]) |
816 | op->destroy (); |
816 | op->destroy (); |
817 | else |
817 | else |
818 | { |
818 | 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 | } |
819 | } |
825 | } |
820 | } |
826 | } |
821 | } |
827 | |
822 | |
828 | object *object::create () |
823 | object *object::create () |
… | |
… | |
1117 | * job preparing multi-part monsters |
1112 | * job preparing multi-part monsters |
1118 | */ |
1113 | */ |
1119 | object * |
1114 | object * |
1120 | insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y) |
1115 | insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y) |
1121 | { |
1116 | { |
1122 | object *tmp; |
|
|
1123 | |
|
|
1124 | if (op->head) |
|
|
1125 | op = op->head; |
|
|
1126 | |
|
|
1127 | for (tmp = op; tmp; tmp = tmp->more) |
1117 | for (object *tmp = op->head_ (); tmp; tmp = tmp->more) |
1128 | { |
1118 | { |
1129 | tmp->x = x + tmp->arch->clone.x; |
1119 | tmp->x = x + tmp->arch->clone.x; |
1130 | tmp->y = y + tmp->arch->clone.y; |
1120 | tmp->y = y + tmp->arch->clone.y; |
1131 | } |
1121 | } |
1132 | |
1122 | |
… | |
… | |
1446 | tmp1->x = op->x; |
1436 | tmp1->x = op->x; |
1447 | tmp1->y = op->y; |
1437 | tmp1->y = op->y; |
1448 | insert_ob_in_map (tmp1, op->map, op, 0); |
1438 | insert_ob_in_map (tmp1, op->map, op, 0); |
1449 | } |
1439 | } |
1450 | |
1440 | |
|
|
1441 | object * |
|
|
1442 | object::insert_at (object *where, object *originator, int flags) |
|
|
1443 | { |
|
|
1444 | where->map->insert (this, where->x, where->y, originator, flags); |
|
|
1445 | } |
|
|
1446 | |
1451 | /* |
1447 | /* |
1452 | * get_split_ob(ob,nr) splits up ob into two parts. The part which |
1448 | * 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 |
1449 | * is returned contains nr objects, and the remaining parts contains |
1454 | * the rest (or is removed and freed if that number is 0). |
1450 | * the rest (or is removed and freed if that number is 0). |
1455 | * On failure, NULL is returned, and the reason put into the |
1451 | * On failure, NULL is returned, and the reason put into the |
1456 | * global static errmsg array. |
1452 | * global static errmsg array. |
1457 | */ |
1453 | */ |
1458 | |
|
|
1459 | object * |
1454 | object * |
1460 | get_split_ob (object *orig_ob, uint32 nr) |
1455 | get_split_ob (object *orig_ob, uint32 nr) |
1461 | { |
1456 | { |
1462 | object *newob; |
1457 | object *newob; |
1463 | int is_removed = (QUERY_FLAG (orig_ob, FLAG_REMOVED) != 0); |
1458 | int is_removed = (QUERY_FLAG (orig_ob, FLAG_REMOVED) != 0); |
… | |
… | |
1727 | * |
1722 | * |
1728 | * MSW 2001-07-08: Check all objects on space, not just those below |
1723 | * 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 |
1724 | * object being inserted. insert_ob_in_map may not put new objects |
1730 | * on top. |
1725 | * on top. |
1731 | */ |
1726 | */ |
1732 | |
|
|
1733 | int |
1727 | int |
1734 | check_move_on (object *op, object *originator) |
1728 | check_move_on (object *op, object *originator) |
1735 | { |
1729 | { |
1736 | object *tmp; |
1730 | object *tmp; |
1737 | maptile *m = op->map; |
1731 | maptile *m = op->map; |