Pyrogenesis trunk
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
CCmpUnitMotionManager Class Referencefinal

#include <CCmpUnitMotionManager.h>

Inheritance diagram for CCmpUnitMotionManager:
Inheritance graph
[legend]
Collaboration diagram for CCmpUnitMotionManager:
Collaboration graph
[legend]

Classes

struct  MotionState
 

Public Member Functions

int GetComponentTypeId () const override
 
void Init (const CParamNode &paramNode) override
 
void Deinit () override
 
void Serialize (ISerializer &serialize) override
 
void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize) override
 
void HandleMessage (const CMessage &msg, bool global) override
 
void Register (CCmpUnitMotion *component, entity_id_t ent, bool formationController) override
 
void Unregister (entity_id_t ent) override
 
bool ComputingMotion () const override
 True if entities are currently in the "Move" phase. More...
 
bool IsPushingActivated () const override
 
- Public Member Functions inherited from IComponent
virtual ~IComponent ()
 
virtual void Init (const CParamNode &paramNode)=0
 
virtual void Deinit ()=0
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
CEntityHandle GetEntityHandle () const
 
void SetEntityHandle (CEntityHandle ent)
 
entity_id_t GetEntityId () const
 
CEntityHandle GetSystemEntity () const
 
const CSimContextGetSimContext () const
 
void SetSimContext (const CSimContext &context)
 
virtual void Serialize (ISerializer &serialize)=0
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)=0
 
virtual bool NewJSObject (const ScriptInterface &scriptInterface, JS::MutableHandleObject out) const
 Returns false by default, indicating that a scripted wrapper of this IComponent is not supported. More...
 
virtual JS::Value GetJSInstance () const
 
virtual int GetComponentTypeId () const =0
 

Static Public Member Functions

static void ClassInit (CComponentManager &componentManager)
 
static IComponentAllocate (const ScriptInterface &, JS::HandleValue)
 
static void Deallocate (IComponent *cmp)
 
static std::string GetSchema ()
 
- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static void RegisterComponentType (CComponentManager &mgr, EInterfaceId iid, EComponentTypeId cid, AllocFunc alloc, DeallocFunc dealloc, const char *name, const std::string &schema)
 
static void RegisterComponentTypeScriptWrapper (CComponentManager &mgr, EInterfaceId iid, EComponentTypeId cid, AllocFunc alloc, DeallocFunc dealloc, const char *name, const std::string &schema)
 
static u8 GetSerializationVersion ()
 

Public Attributes

entity_pos_t m_PushingRadiusMultiplier
 
entity_pos_t m_MovingPushExtension
 
entity_pos_t m_StaticPushExtension
 
entity_pos_t m_MovingPushingSpread
 
entity_pos_t m_StaticPushingSpread
 
entity_pos_t m_MinimalPushing
 
entity_pos_t m_PushingPressureStrength
 
entity_pos_t m_PushingPressureDecay
 
EntityMap< MotionStatem_Units
 
EntityMap< MotionStatem_FormationControllers
 
Grid< std::vector< EntityMap< MotionState >::iterator > > m_MovingUnits
 
bool m_ComputingMotion
 

Static Public Attributes

static constexpr int MAX_PRESSURE = 255
 Maximum value for pushing pressure. More...
 

Private Member Functions

void OnDeserialized ()
 This deserialization process is rather ugly, but it's required to store some data in the motion states. More...
 
void ResetSubdivisions ()
 
void OnTurnStart ()
 
void MoveUnits (fixed dt)
 
void MoveFormations (fixed dt)
 
void Move (EntityMap< MotionState > &ents, fixed dt)
 
void Push (EntityMap< MotionState >::value_type &a, EntityMap< MotionState >::value_type &b, fixed dt)
 

Additional Inherited Members

- Public Types inherited from IComponent
using AllocFunc = IComponent *(*)(const ScriptInterface &scriptInterface, JS::HandleValue ctor)
 
using DeallocFunc = void(*)(IComponent *)
 

Member Function Documentation

◆ Allocate()

static IComponent * CCmpUnitMotionManager::Allocate ( const ScriptInterface ,
JS::HandleValue   
)
inlinestatic

◆ ClassInit()

void CCmpUnitMotionManager::ClassInit ( CComponentManager componentManager)
static

◆ ComputingMotion()

bool CCmpUnitMotionManager::ComputingMotion ( ) const
inlineoverridevirtual

True if entities are currently in the "Move" phase.

Implements ICmpUnitMotionManager.

◆ Deallocate()

static void CCmpUnitMotionManager::Deallocate ( IComponent cmp)
inlinestatic

◆ Deinit()

void CCmpUnitMotionManager::Deinit ( )
inlineoverridevirtual

Implements IComponent.

◆ Deserialize()

void CCmpUnitMotionManager::Deserialize ( const CParamNode paramNode,
IDeserializer deserialize 
)
overridevirtual

Implements IComponent.

◆ GetComponentTypeId()

int CCmpUnitMotionManager::GetComponentTypeId ( ) const
inlineoverridevirtual

Implements IComponent.

◆ GetSchema()

static std::string CCmpUnitMotionManager::GetSchema ( )
inlinestatic

◆ HandleMessage()

void CCmpUnitMotionManager::HandleMessage ( const CMessage msg,
bool  global 
)
overridevirtual

Reimplemented from IComponent.

◆ Init()

void CCmpUnitMotionManager::Init ( const CParamNode paramNode)
overridevirtual

Implements IComponent.

◆ IsPushingActivated()

bool CCmpUnitMotionManager::IsPushingActivated ( ) const
inlineoverridevirtual
Returns
whether pushing is currently enabled or not.

Implements ICmpUnitMotionManager.

◆ Move()

void CCmpUnitMotionManager::Move ( EntityMap< MotionState > &  ents,
fixed  dt 
)
private

◆ MoveFormations()

void CCmpUnitMotionManager::MoveFormations ( fixed  dt)
private

◆ MoveUnits()

void CCmpUnitMotionManager::MoveUnits ( fixed  dt)
private

◆ OnDeserialized()

void CCmpUnitMotionManager::OnDeserialized ( )
private

This deserialization process is rather ugly, but it's required to store some data in the motion states.

Ideally, the motion state would actually be CCmpUnitMotion themselves, but for data locality (because our components are stored randomly on the heap right now) they're not. If we ever change the simulation so that components could be registered by their managers and exposed, then we could just use CCmpUnitMotion directly and clean this code uglyness.

◆ OnTurnStart()

void CCmpUnitMotionManager::OnTurnStart ( )
private

◆ Push()

void CCmpUnitMotionManager::Push ( EntityMap< MotionState >::value_type &  a,
EntityMap< MotionState >::value_type &  b,
fixed  dt 
)
private

◆ Register()

void CCmpUnitMotionManager::Register ( CCmpUnitMotion component,
entity_id_t  ent,
bool  formationController 
)
overridevirtual

Implements ICmpUnitMotionManager.

◆ ResetSubdivisions()

void CCmpUnitMotionManager::ResetSubdivisions ( )
private

◆ Serialize()

void CCmpUnitMotionManager::Serialize ( ISerializer serialize)
overridevirtual

Implements IComponent.

◆ Unregister()

void CCmpUnitMotionManager::Unregister ( entity_id_t  ent)
overridevirtual

Implements ICmpUnitMotionManager.

Member Data Documentation

◆ m_ComputingMotion

bool CCmpUnitMotionManager::m_ComputingMotion

◆ m_FormationControllers

EntityMap<MotionState> CCmpUnitMotionManager::m_FormationControllers

◆ m_MinimalPushing

entity_pos_t CCmpUnitMotionManager::m_MinimalPushing

◆ m_MovingPushExtension

entity_pos_t CCmpUnitMotionManager::m_MovingPushExtension

◆ m_MovingPushingSpread

entity_pos_t CCmpUnitMotionManager::m_MovingPushingSpread

◆ m_MovingUnits

Grid<std::vector<EntityMap<MotionState>::iterator> > CCmpUnitMotionManager::m_MovingUnits

◆ m_PushingPressureDecay

entity_pos_t CCmpUnitMotionManager::m_PushingPressureDecay

◆ m_PushingPressureStrength

entity_pos_t CCmpUnitMotionManager::m_PushingPressureStrength

◆ m_PushingRadiusMultiplier

entity_pos_t CCmpUnitMotionManager::m_PushingRadiusMultiplier

◆ m_StaticPushExtension

entity_pos_t CCmpUnitMotionManager::m_StaticPushExtension

◆ m_StaticPushingSpread

entity_pos_t CCmpUnitMotionManager::m_StaticPushingSpread

◆ m_Units

EntityMap<MotionState> CCmpUnitMotionManager::m_Units

◆ MAX_PRESSURE

constexpr int CCmpUnitMotionManager::MAX_PRESSURE = 255
staticconstexpr

Maximum value for pushing pressure.


The documentation for this class was generated from the following files: