1 | /* |
1 | /* |
2 | * static char *rcsid_object_c = |
2 | * static char *rcsid_object_c = |
3 | * "$Id: object.C,v 1.18 2006/09/08 16:51:42 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->next = objects; |
632 | next = objects; |
641 | |
633 | |
642 | if (objects) |
634 | if (objects) |
643 | objects->prev = op; |
635 | objects->prev = this; |
644 | |
636 | |
645 | objects = op; |
637 | objects = this; |
646 | |
638 | |
647 | SET_FLAG (op, FLAG_REMOVED); |
639 | SET_FLAG (this, FLAG_REMOVED); |
648 | |
640 | |
649 | op->expmul = 1.0; |
641 | expmul = 1.0; |
650 | op->face = blank_face; |
642 | face = blank_face; |
651 | op->attacked_by_count = -1; |
643 | attacked_by_count = -1; |
|
|
644 | } |
652 | |
645 | |
653 | return op; |
646 | object::~object () |
|
|
647 | { |
654 | } |
648 | } |
655 | |
649 | |
656 | /* |
650 | /* |
657 | * 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 |
658 | * 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 |