1 | /* |
1 | /* |
2 | * static char *rcsid_object_c = |
2 | * static char *rcsid_object_c = |
3 | * "$Id: object.C,v 1.1 2006/08/13 17:16:00 elmex Exp $"; |
3 | * "$Id: object.C,v 1.2 2006/08/25 17:11:52 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 | |
… | |
… | |
582 | * clears all variables and flags to default settings. |
582 | * clears all variables and flags to default settings. |
583 | */ |
583 | */ |
584 | |
584 | |
585 | void clear_object(object *op) { |
585 | void clear_object(object *op) { |
586 | |
586 | |
|
|
587 | if (object_free_callback) |
|
|
588 | object_free_callback (op); |
|
|
589 | |
587 | event *evt; |
590 | event *evt; |
588 | event *evt2; |
591 | event *evt2; |
589 | |
592 | |
590 | /* redo this to be simpler/more efficient. Was also seeing |
593 | /* redo this to be simpler/more efficient. Was also seeing |
591 | * crashes in the old code. Move this to the top - am |
594 | * crashes in the old code. Move this to the top - am |
… | |
… | |
661 | |
664 | |
662 | void copy_object(object *op2, object *op) { |
665 | void copy_object(object *op2, object *op) { |
663 | int is_freed=QUERY_FLAG(op,FLAG_FREED),is_removed=QUERY_FLAG(op,FLAG_REMOVED); |
666 | int is_freed=QUERY_FLAG(op,FLAG_FREED),is_removed=QUERY_FLAG(op,FLAG_REMOVED); |
664 | event *evt, *evt2, *evt_new; |
667 | event *evt, *evt2, *evt_new; |
665 | |
668 | |
|
|
669 | if (object_free_callback) |
|
|
670 | object_free_callback (op); |
|
|
671 | |
|
|
672 | // callback registries and self are empty for copied objects |
|
|
673 | // this ought to change in the future |
|
|
674 | |
666 | /* Decrement the refcounts, but don't bother zeroing the fields; |
675 | /* Decrement the refcounts, but don't bother zeroing the fields; |
667 | they'll be overwritten by memcpy. */ |
676 | they'll be overwritten by memcpy. */ |
668 | if(op->name!=NULL) free_string(op->name); |
677 | if(op->name!=NULL) free_string(op->name); |
669 | if(op->name_pl!=NULL) free_string(op->name_pl); |
678 | if(op->name_pl!=NULL) free_string(op->name_pl); |
670 | if(op->title!=NULL) free_string(op->title); |
679 | if(op->title!=NULL) free_string(op->title); |
… | |
… | |
754 | tail->next = new_link; |
763 | tail->next = new_link; |
755 | tail = new_link; |
764 | tail = new_link; |
756 | } |
765 | } |
757 | } |
766 | } |
758 | } |
767 | } |
759 | |
768 | |
760 | update_ob_speed(op); |
769 | update_ob_speed(op); |
761 | } |
770 | } |
762 | |
771 | |
763 | /* |
772 | /* |
764 | * expand_objects() allocates more objects for the list of unused objects. |
773 | * expand_objects() allocates more objects for the list of unused objects. |