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.19 2006/09/08 17:14:07 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 | |
|
|
634 | object *get_object () |
628 | object::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; |
646 | object::~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 |
… | |
… | |
911 | } |
901 | } |
912 | |
902 | |
913 | if (ob->inv) |
903 | if (ob->inv) |
914 | { |
904 | { |
915 | /* Only if the space blocks everything do we not process - |
905 | /* Only if the space blocks everything do we not process - |
916 | * if some form of movemnt is allowed, let objects |
906 | * if some form of movement is allowed, let objects |
917 | * drop on that space. |
907 | * drop on that space. |
918 | */ |
908 | */ |
919 | if (free_inventory || ob->map == NULL |
909 | if (free_inventory || ob->map == NULL |
920 | || ob->map->in_memory != MAP_IN_MEMORY |
910 | || ob->map->in_memory != MAP_IN_MEMORY |
921 | || (GET_MAP_MOVE_BLOCK (ob->map, ob->x, ob->y) == MOVE_ALL)) |
911 | || (GET_MAP_MOVE_BLOCK (ob->map, ob->x, ob->y) == MOVE_ALL)) |