Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpUnitMotionManager.h
Show All 25 Lines | |||||
#include "simulation2/helpers/Grid.h" | #include "simulation2/helpers/Grid.h" | ||||
#include "simulation2/system/EntityMap.h" | #include "simulation2/system/EntityMap.h" | ||||
class CCmpUnitMotion; | class CCmpUnitMotion; | ||||
class CCmpUnitMotionManager final : public ICmpUnitMotionManager | class CCmpUnitMotionManager final : public ICmpUnitMotionManager | ||||
{ | { | ||||
public: | public: | ||||
static constexpr int typeId{CID_UnitMotionManager}; | |||||
static void ClassInit(CComponentManager& componentManager); | static void ClassInit(CComponentManager& componentManager); | ||||
DEFAULT_COMPONENT_ALLOCATOR(UnitMotionManager) | static IComponent* Allocate(const ScriptInterface&, JS::HandleValue); | ||||
static void Deallocate(IComponent* cmp); | |||||
int GetComponentTypeId() const override; | |||||
/** | /** | ||||
* Maximum value for pushing pressure. | * Maximum value for pushing pressure. | ||||
*/ | */ | ||||
static constexpr int MAX_PRESSURE = 255; | static constexpr int MAX_PRESSURE = 255; | ||||
// Persisted state for each unit. | // Persisted state for each unit. | ||||
struct MotionState | struct MotionState | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | private: | ||||
void MoveUnits(fixed dt); | void MoveUnits(fixed dt); | ||||
void MoveFormations(fixed dt); | void MoveFormations(fixed dt); | ||||
void Move(EntityMap<MotionState>& ents, fixed dt); | void Move(EntityMap<MotionState>& ents, fixed dt); | ||||
void Push(EntityMap<MotionState>::value_type& a, EntityMap<MotionState>::value_type& b, fixed dt); | void Push(EntityMap<MotionState>::value_type& a, EntityMap<MotionState>::value_type& b, fixed dt); | ||||
}; | }; | ||||
REGISTER_COMPONENT_TYPE(UnitMotionManager) | |||||
#endif // INCLUDED_CCMPUNITMOTIONMANAGER | #endif // INCLUDED_CCMPUNITMOTIONMANAGER |
Wildfire Games · Phabricator