Pyrogenesis  trunk
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | List of all members
CCmpTerritoryManager Class Reference
Inheritance diagram for CCmpTerritoryManager:
Inheritance graph
[legend]
Collaboration diagram for CCmpTerritoryManager:
Collaboration graph
[legend]

Classes

struct  SBoundaryLine
 

Public Member Functions

virtual int GetComponentTypeId () const
 
virtual void Init (const CParamNode &paramNode)
 
virtual void Deinit ()
 
virtual void Serialize (ISerializer &serialize)
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
void MakeDirtyIfRelevantEntity (entity_id_t ent)
 
virtual const Grid< u8 > & GetTerritoryGrid ()
 For each tile, the TERRITORY_PLAYER_MASK bits are player ID; TERRITORY_CONNECTED_MASK is set if the tile is connected to a root object (civ center etc). More...
 
virtual player_id_t GetOwner (entity_pos_t x, entity_pos_t z)
 Get owner of territory at given position. More...
 
virtual std::vector< u32GetNeighbours (entity_pos_t x, entity_pos_t z, bool filterConnected)
 get the number of neighbour tiles for per player for the selected position More...
 
virtual bool IsConnected (entity_pos_t x, entity_pos_t z)
 Get whether territory at given position is connected to a root object (civ center etc) owned by that territory's player. More...
 
virtual void SetTerritoryBlinking (entity_pos_t x, entity_pos_t z, bool enable)
 Set a piece of territory to blinking. More...
 
virtual bool IsTerritoryBlinking (entity_pos_t x, entity_pos_t z)
 Check if a piece of territory is blinking. More...
 
void MakeDirty ()
 
virtual bool NeedUpdate (size_t *dirtyID) const
 
void CalculateCostGrid ()
 
void CalculateTerritories ()
 
u8 GetTerritoryPercentage (player_id_t player)
 Returns the percentage of the world controlled by a given player as defined by the number of territory cells the given player owns. More...
 
std::vector< STerritoryBoundaryComputeBoundaries ()
 
void UpdateBoundaryLines ()
 
void Interpolate (float frameTime, float frameOffset)
 
void RenderSubmit (SceneCollector &collector)
 
void SetVisibility (bool visible)
 Enables or disables rendering of an territory borders. More...
 
- Public Member Functions inherited from IComponent
virtual ~IComponent ()
 
CEntityHandle GetEntityHandle () const
 
void SetEntityHandle (CEntityHandle ent)
 
entity_id_t GetEntityId () const
 
CEntityHandle GetSystemEntity () const
 
const CSimContextGetSimContext () const
 
void SetSimContext (const CSimContext &context)
 
virtual bool NewJSObject (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
 

Static Public Member Functions

static void ClassInit (CComponentManager &componentManager)
 
static IComponentAllocate (ScriptInterface &, JS::HandleValue)
 
static void Deallocate (IComponent *cmp)
 
static std::string GetSchema ()
 
- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static u8 GetSerializationVersion ()
 

Public Attributes

u8 m_ImpassableCost
 
float m_BorderThickness
 
float m_BorderSeparation
 
Grid< u8 > * m_Territories
 
std::vector< u16m_TerritoryCellCounts
 
u16 m_TerritoryTotalPassableCellCount
 
Grid< u8 > * m_CostGrid
 
bool m_TriggerEvent
 
std::vector< SBoundaryLinem_BoundaryLines
 
bool m_BoundaryLinesDirty
 
double m_AnimTime
 
TerritoryOverlaym_DebugOverlay
 
bool m_EnableLineDebugOverlays
 Enable node debugging overlays for boundary lines? More...
 
std::vector< SOverlayLinem_DebugBoundaryLineNodes
 
size_t m_DirtyID
 

Private Attributes

bool m_Visible
 

Additional Inherited Members

- Static Public Attributes inherited from ICmpTerritoryManager
static const int NAVCELLS_PER_TERRITORY_TILE = 8
 Number of pathfinder navcells per territory tile. More...
 
static const int TERRITORY_PLAYER_MASK = 0x1F
 
static const int TERRITORY_CONNECTED_MASK = 0x20
 
static const int TERRITORY_BLINKING_MASK = 0x40
 
static const int TERRITORY_PROCESSED_MASK = 0x80
 

Member Function Documentation

static IComponent* CCmpTerritoryManager::Allocate ( ScriptInterface ,
JS::HandleValue   
)
inlinestatic
void CCmpTerritoryManager::CalculateCostGrid ( )
void CCmpTerritoryManager::CalculateTerritories ( )
static void CCmpTerritoryManager::ClassInit ( CComponentManager componentManager)
inlinestatic
std::vector< STerritoryBoundary > CCmpTerritoryManager::ComputeBoundaries ( )
static void CCmpTerritoryManager::Deallocate ( IComponent cmp)
inlinestatic
virtual void CCmpTerritoryManager::Deinit ( )
inlinevirtual

Implements IComponent.

virtual void CCmpTerritoryManager::Deserialize ( const CParamNode paramNode,
IDeserializer deserialize 
)
inlinevirtual

Implements IComponent.

virtual int CCmpTerritoryManager::GetComponentTypeId ( ) const
inlinevirtual

Implements IComponent.

std::vector< u32 > CCmpTerritoryManager::GetNeighbours ( entity_pos_t  x,
entity_pos_t  z,
bool  filterConnected 
)
virtual

get the number of neighbour tiles for per player for the selected position

Returns
A list with the number of neighbour tiles per player

Implements ICmpTerritoryManager.

player_id_t CCmpTerritoryManager::GetOwner ( entity_pos_t  x,
entity_pos_t  z 
)
virtual

Get owner of territory at given position.

Returns
player ID of owner; 0 if neutral territory

Implements ICmpTerritoryManager.

static std::string CCmpTerritoryManager::GetSchema ( )
inlinestatic
virtual const Grid<u8>& CCmpTerritoryManager::GetTerritoryGrid ( )
inlinevirtual

For each tile, the TERRITORY_PLAYER_MASK bits are player ID; TERRITORY_CONNECTED_MASK is set if the tile is connected to a root object (civ center etc).

Implements ICmpTerritoryManager.

u8 CCmpTerritoryManager::GetTerritoryPercentage ( player_id_t  player)
virtual

Returns the percentage of the world controlled by a given player as defined by the number of territory cells the given player owns.

Implements ICmpTerritoryManager.

virtual void CCmpTerritoryManager::HandleMessage ( const CMessage msg,
bool  global 
)
inlinevirtual

Reimplemented from IComponent.

virtual void CCmpTerritoryManager::Init ( const CParamNode paramNode)
inlinevirtual

Implements IComponent.

void CCmpTerritoryManager::Interpolate ( float  frameTime,
float  frameOffset 
)
bool CCmpTerritoryManager::IsConnected ( entity_pos_t  x,
entity_pos_t  z 
)
virtual

Get whether territory at given position is connected to a root object (civ center etc) owned by that territory's player.

Implements ICmpTerritoryManager.

bool CCmpTerritoryManager::IsTerritoryBlinking ( entity_pos_t  x,
entity_pos_t  z 
)
virtual

Check if a piece of territory is blinking.

Implements ICmpTerritoryManager.

void CCmpTerritoryManager::MakeDirty ( )
inline
void CCmpTerritoryManager::MakeDirtyIfRelevantEntity ( entity_id_t  ent)
inline
virtual bool CCmpTerritoryManager::NeedUpdate ( size_t *  dirtyID) const
inlinevirtual

Implements ICmpTerritoryManager.

void CCmpTerritoryManager::RenderSubmit ( SceneCollector collector)
virtual void CCmpTerritoryManager::Serialize ( ISerializer serialize)
inlinevirtual

Implements IComponent.

void CCmpTerritoryManager::SetTerritoryBlinking ( entity_pos_t  x,
entity_pos_t  z,
bool  enable 
)
virtual

Set a piece of territory to blinking.

Must be updated on every territory calculation

Implements ICmpTerritoryManager.

void CCmpTerritoryManager::SetVisibility ( bool  visible)
inlinevirtual

Enables or disables rendering of an territory borders.

Implements ICmpTerritoryManager.

void CCmpTerritoryManager::UpdateBoundaryLines ( )

Member Data Documentation

double CCmpTerritoryManager::m_AnimTime
float CCmpTerritoryManager::m_BorderSeparation
float CCmpTerritoryManager::m_BorderThickness
std::vector<SBoundaryLine> CCmpTerritoryManager::m_BoundaryLines
bool CCmpTerritoryManager::m_BoundaryLinesDirty
Grid<u8>* CCmpTerritoryManager::m_CostGrid
std::vector<SOverlayLine> CCmpTerritoryManager::m_DebugBoundaryLineNodes
TerritoryOverlay* CCmpTerritoryManager::m_DebugOverlay
size_t CCmpTerritoryManager::m_DirtyID
bool CCmpTerritoryManager::m_EnableLineDebugOverlays

Enable node debugging overlays for boundary lines?

u8 CCmpTerritoryManager::m_ImpassableCost
Grid<u8>* CCmpTerritoryManager::m_Territories
std::vector<u16> CCmpTerritoryManager::m_TerritoryCellCounts
u16 CCmpTerritoryManager::m_TerritoryTotalPassableCellCount
bool CCmpTerritoryManager::m_TriggerEvent
bool CCmpTerritoryManager::m_Visible
private

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