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.16 by root, Mon Sep 4 16:46:32 2006 UTC vs.
Revision 1.20 by root, Fri Sep 8 18:26:22 2006 UTC

1/* 1/*
2 * static char *rcsid_object_c = 2 * static char *rcsid_object_c =
3 * "$Id: object.C,v 1.16 2006/09/04 16:46:32 root Exp $"; 3 * "$Id: object.C,v 1.20 2006/09/08 18:26:22 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
623 } 623 }
624 624
625 update_ob_speed (op); 625 update_ob_speed (op);
626} 626}
627 627
628/*
629 * get_object() grabs an object from the list of unused objects, makes
630 * sure it is initialised, and returns it.
631 * If there are no free objects, expand_objects() is called to get more.
632 */
633
634object *get_object () 628object::object ()
635{ 629{
636 object *op = new object;
637
638 op->count = ++ob_count; 630 count = ++ob_count;
639 631
640 op->active_next = 0;
641 op->active_prev = 0;
642
643 op->next = objects; 632 next = objects;
644 op->prev = 0;
645 633
646 if (objects) 634 if (objects)
647 objects->prev = op; 635 objects->prev = this;
648 636
649 objects = op; 637 objects = this;
650 638
651 SET_FLAG (op, FLAG_REMOVED); 639 SET_FLAG (this, FLAG_REMOVED);
652 640
653 op->expmul = 1.0; 641 expmul = 1.0;
654 op->face = blank_face; 642 face = blank_face;
655 op->attacked_by_count = -1; 643 attacked_by_count = -1;
644}
656 645
657 return op; 646object::~object ()
647{
658} 648}
659 649
660/* 650/*
661 * If an object with the IS_TURNABLE() flag needs to be turned due 651 * If an object with the IS_TURNABLE() flag needs to be turned due
662 * to the closest player being on the other side, this function can 652 * to the closest player being on the other side, this function can
826 update_now=1; 816 update_now=1;
827 817
828 if (QUERY_FLAG(op, FLAG_ALIVE) && !(flags & P_IS_ALIVE)) 818 if (QUERY_FLAG(op, FLAG_ALIVE) && !(flags & P_IS_ALIVE))
829 update_now=1; 819 update_now=1;
830 820
821 if (op->type == SAFE_GROUND && !(flags & P_SAFE))
822 update_now=1;
823
831 if ((move_on | op->move_on) != move_on) update_now=1; 824 if ((move_on | op->move_on) != move_on) update_now=1;
825
832 if ((move_off | op->move_off) != move_off) update_now=1; 826 if ((move_off | op->move_off) != move_off) update_now=1;
827
833 /* This isn't perfect, but I don't expect a lot of objects to 828 /* This isn't perfect, but I don't expect a lot of objects to
834 * to have move_allow right now. 829 * to have move_allow right now.
835 */ 830 */
836 if (((move_block | op->move_block) & ~op->move_allow) != move_block) 831 if (((move_block | op->move_block) & ~op->move_allow) != move_block)
837 update_now=1; 832 update_now=1;
833
838 if ((move_slow | op->move_slow) != move_slow) update_now=1; 834 if ((move_slow | op->move_slow) != move_slow)
835 update_now=1;
839 } 836 }
840 /* if the object is being removed, we can't make intelligent 837 /* if the object is being removed, we can't make intelligent
841 * decisions, because remove_ob can't really pass the object 838 * decisions, because remove_ob can't really pass the object
842 * that is being removed. 839 * that is being removed.
843 */ 840 */
911 } 908 }
912 909
913 if (ob->inv) 910 if (ob->inv)
914 { 911 {
915 /* Only if the space blocks everything do we not process - 912 /* Only if the space blocks everything do we not process -
916 * if some form of movemnt is allowed, let objects 913 * if some form of movement is allowed, let objects
917 * drop on that space. 914 * drop on that space.
918 */ 915 */
919 if (free_inventory || ob->map == NULL 916 if (free_inventory || ob->map == NULL
920 || ob->map->in_memory != MAP_IN_MEMORY 917 || ob->map->in_memory != MAP_IN_MEMORY
921 || (GET_MAP_MOVE_BLOCK (ob->map, ob->x, ob->y) == MOVE_ALL)) 918 || (GET_MAP_MOVE_BLOCK (ob->map, ob->x, ob->y) == MOVE_ALL))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines