| 1750 | } |
| 1751 | |
| 1752 | void ObjInitPositionHistory(object *obj) { |
| 1753 | ASSERT(Object_map_position_history[OBJNUM(obj)] == -1); |
| 1754 | |
| 1755 | // If it is one of the types of object's that we have to sample positions for |
| 1756 | // Initialize that |
| 1757 | switch (obj->type) { |
| 1758 | case OBJ_ROBOT: |
| 1759 | case OBJ_WEAPON: |
| 1760 | case OBJ_DEBRIS: |
| 1761 | if (Num_free_object_position_history > 0) { |
| 1762 | // we have a free slot |
| 1763 | Num_free_object_position_history--; |
| 1764 | int free_slot = Object_map_position_free_slots[Num_free_object_position_history]; |
| 1765 | Object_map_position_history[OBJNUM(obj)] = free_slot; |
| 1766 | int i; |
| 1767 | for (i = 0; i < MAX_POSITION_HISTORY; i++) { |
| 1768 | Object_position_samples[free_slot].pos[i] = obj->pos; |
| 1769 | } |
| 1770 | } else { |
| 1771 | // out of slots! |
| 1772 | Object_map_position_history[OBJNUM(obj)] = -1; |
| 1773 | } |
| 1774 | break; |
| 1775 | default: |
| 1776 | // not saving positions |
| 1777 | Object_map_position_history[OBJNUM(obj)] = -1; |
| 1778 | break; |
| 1779 | } |
| 1780 | } |
| 1781 | |
| 1782 | void ObjFreePositionHistory(object *obj) { |
| 1783 | int objnum = OBJNUM(obj); |
no outgoing calls
no test coverage detected