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.89 by root, Tue Dec 26 09:52:40 2006 UTC vs.
Revision 1.93 by root, Tue Dec 26 20:04:09 2006 UTC

789{ 789{
790 /* Only if the space blocks everything do we not process - 790 /* Only if the space blocks everything do we not process -
791 * if some form of movement is allowed, let objects 791 * if some form of movement is allowed, let objects
792 * drop on that space. 792 * drop on that space.
793 */ 793 */
794 if (!drop_to_ground || !map || map->in_memory != MAP_IN_MEMORY || GET_MAP_MOVE_BLOCK (map, x, y) == MOVE_ALL) 794 if (!drop_to_ground
795 || !map
796 || map->in_memory != MAP_IN_MEMORY
797 || map->at (x, y).move_block == MOVE_ALL)
795 { 798 {
796 while (inv) 799 while (inv)
800 {
801 inv->destroy_inv (drop_to_ground);
797 inv->destroy (); 802 inv->destroy ();
803 }
798 } 804 }
799 else 805 else
800 { /* Put objects in inventory onto this space */ 806 { /* Put objects in inventory onto this space */
801 while (inv) 807 while (inv)
802 { 808 {
807 || op->type == RUNE 813 || op->type == RUNE
808 || op->type == TRAP 814 || op->type == TRAP
809 || op->flag [FLAG_IS_A_TEMPLATE]) 815 || op->flag [FLAG_IS_A_TEMPLATE])
810 op->destroy (); 816 op->destroy ();
811 else 817 else
812 { 818 map->insert (op, x, y);
813 op->remove ();
814 op->x = x;
815 op->y = y;
816 insert_ob_in_map (op, map, 0, 0); /* Insert in same map as the envir */
817 }
818 } 819 }
819 } 820 }
820} 821}
821 822
822object *object::create () 823object *object::create ()
827} 828}
828 829
829void 830void
830object::do_destroy () 831object::do_destroy ()
831{ 832{
832 attachable::do_destroy ();
833
834 if (flag [FLAG_IS_LINKED]) 833 if (flag [FLAG_IS_LINKED])
835 remove_button_link (this); 834 remove_button_link (this);
836 835
837 if (flag [FLAG_FRIENDLY]) 836 if (flag [FLAG_FRIENDLY])
838 remove_friendly_object (this); 837 remove_friendly_object (this);
841 remove (); 840 remove ();
842 841
843 if (flag [FLAG_FREED]) 842 if (flag [FLAG_FREED])
844 return; 843 return;
845 844
845 set_speed (0);
846
846 flag [FLAG_FREED] = 1; 847 flag [FLAG_FREED] = 1;
847 848
849 attachable::do_destroy ();
850
848 destroy_inv (true); 851 destroy_inv (true);
849 set_speed (0);
850 unlink (); 852 unlink ();
851 853
852 // hack to ensure that freed objects still have a valid map 854 // hack to ensure that freed objects still have a valid map
853 { 855 {
854 static maptile *freed_map; // freed objects are moved here to avoid crashes 856 static maptile *freed_map; // freed objects are moved here to avoid crashes
1014 if (map->in_memory == MAP_SAVING) 1016 if (map->in_memory == MAP_SAVING)
1015 return; 1017 return;
1016 1018
1017 int check_walk_off = !flag [FLAG_NO_APPLY]; 1019 int check_walk_off = !flag [FLAG_NO_APPLY];
1018 1020
1019 for (tmp = GET_MAP_OB (map, x, y); tmp; tmp = tmp->above) 1021 for (tmp = map->at (x, y).bot; tmp; tmp = tmp->above)
1020 { 1022 {
1021 /* No point updating the players look faces if he is the object 1023 /* No point updating the players look faces if he is the object
1022 * being removed. 1024 * being removed.
1023 */ 1025 */
1024 1026
1110 * job preparing multi-part monsters 1112 * job preparing multi-part monsters
1111 */ 1113 */
1112object * 1114object *
1113insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y) 1115insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y)
1114{ 1116{
1115 object *tmp;
1116
1117 if (op->head)
1118 op = op->head;
1119
1120 for (tmp = op; tmp; tmp = tmp->more) 1117 for (object *tmp = op->head_ (); tmp; tmp = tmp->more)
1121 { 1118 {
1122 tmp->x = x + tmp->arch->clone.x; 1119 tmp->x = x + tmp->arch->clone.x;
1123 tmp->y = y + tmp->arch->clone.y; 1120 tmp->y = y + tmp->arch->clone.y;
1124 } 1121 }
1125 1122
1439 tmp1->x = op->x; 1436 tmp1->x = op->x;
1440 tmp1->y = op->y; 1437 tmp1->y = op->y;
1441 insert_ob_in_map (tmp1, op->map, op, 0); 1438 insert_ob_in_map (tmp1, op->map, op, 0);
1442} 1439}
1443 1440
1441object *
1442object::insert_at (object *where, object *originator, int flags)
1443{
1444 where->map->insert (this, where->x, where->y, originator, flags);
1445}
1446
1444/* 1447/*
1445 * 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
1446 * is returned contains nr objects, and the remaining parts contains 1449 * is returned contains nr objects, and the remaining parts contains
1447 * 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).
1448 * On failure, NULL is returned, and the reason put into the 1451 * On failure, NULL is returned, and the reason put into the
1449 * global static errmsg array. 1452 * global static errmsg array.
1450 */ 1453 */
1451
1452object * 1454object *
1453get_split_ob (object *orig_ob, uint32 nr) 1455get_split_ob (object *orig_ob, uint32 nr)
1454{ 1456{
1455 object *newob; 1457 object *newob;
1456 int is_removed = (QUERY_FLAG (orig_ob, FLAG_REMOVED) != 0); 1458 int is_removed = (QUERY_FLAG (orig_ob, FLAG_REMOVED) != 0);
1720 * 1722 *
1721 * 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
1722 * 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
1723 * on top. 1725 * on top.
1724 */ 1726 */
1725
1726int 1727int
1727check_move_on (object *op, object *originator) 1728check_move_on (object *op, object *originator)
1728{ 1729{
1729 object *tmp; 1730 object *tmp;
1730 maptile *m = op->map; 1731 maptile *m = op->map;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines