Pyrogenesis  trunk
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
CCmpRangeManager Class Reference

Range manager implementation. More...

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

Public Member Functions

virtual int GetComponentTypeId () const
 
virtual void Init (const CParamNode &paramNode)
 
virtual void Deinit ()
 
template<typename S >
void SerializeCommon (S &serialize)
 
virtual void Serialize (ISerializer &serialize)
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
virtual void SetBounds (entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, ssize_t vertices)
 Set the bounds of the world. More...
 
virtual void Verify ()
 Perform some internal consistency checks for testing/debugging. More...
 
FastSpatialSubdivisionGetSubdivision ()
 Access the spatial subdivision kept by the range manager. More...
 
void ResetDerivedData ()
 
void ResetSubdivisions (entity_pos_t x1, entity_pos_t z1)
 
virtual tag_t CreateActiveQuery (entity_id_t source, entity_pos_t minRange, entity_pos_t maxRange, const std::vector< int > &owners, int requiredInterface, u8 flags)
 Construct an active query. More...
 
virtual tag_t CreateActiveParabolicQuery (entity_id_t source, entity_pos_t minRange, entity_pos_t maxRange, entity_pos_t elevationBonus, const std::vector< int > &owners, int requiredInterface, u8 flags)
 Construct an active query of a paraboloic form around the unit. More...
 
virtual void DestroyActiveQuery (tag_t tag)
 
virtual void EnableActiveQuery (tag_t tag)
 
virtual void DisableActiveQuery (tag_t tag)
 
virtual bool IsActiveQueryEnabled (tag_t tag) const
 
virtual std::vector< entity_id_tExecuteQueryAroundPos (const CFixedVector2D &pos, entity_pos_t minRange, entity_pos_t maxRange, const std::vector< int > &owners, int requiredInterface)
 Execute a passive query. More...
 
virtual std::vector< entity_id_tExecuteQuery (entity_id_t source, entity_pos_t minRange, entity_pos_t maxRange, const std::vector< int > &owners, int requiredInterface)
 Execute a passive query. More...
 
virtual std::vector< entity_id_tResetActiveQuery (tag_t tag)
 
virtual std::vector< entity_id_tGetEntitiesByPlayer (player_id_t player) const
 Returns a list of all entities for a specific player. More...
 
virtual std::vector< entity_id_tGetNonGaiaEntities () const
 Returns a list of all entities of all players except gaia. More...
 
std::vector< entity_id_tGetEntitiesByMask (u32 ownerMask) const
 
virtual void SetDebugOverlay (bool enabled)
 Toggle the rendering of debug info. More...
 
void ExecuteActiveQueries ()
 Update all currently-enabled active queries. More...
 
bool TestEntityQuery (const Query &q, entity_id_t id, const EntityData &entity) const
 Returns whether the given entity matches the given query (ignoring maxRange) More...
 
void PerformQuery (const Query &q, std::vector< entity_id_t > &r, CFixedVector2D pos)
 Returns a list of distinct entity IDs that match the given query, sorted by ID. More...
 
virtual entity_pos_t GetElevationAdaptedRange (const CFixedVector3D &pos1, const CFixedVector3D &rot, entity_pos_t range, entity_pos_t elevationBonus, entity_pos_t angle) const
 Get the average elevation over 8 points on distance range around the entity. More...
 
virtual std::vector< entity_pos_tgetParabolicRangeForm (CFixedVector3D pos, entity_pos_t maxRange, entity_pos_t cutoff, entity_pos_t minAngle, entity_pos_t maxAngle, int numberOfSteps) const
 
Query ConstructQuery (entity_id_t source, entity_pos_t minRange, entity_pos_t maxRange, const std::vector< int > &owners, int requiredInterface, u8 flagsMask) const
 
Query ConstructParabolicQuery (entity_id_t source, entity_pos_t minRange, entity_pos_t maxRange, entity_pos_t elevationBonus, const std::vector< int > &owners, int requiredInterface, u8 flagsMask) const
 
void RenderSubmit (SceneCollector &collector)
 
virtual u8 GetEntityFlagMask (const std::string &identifier) const
 Returns the mask for the specified identifier. More...
 
virtual void SetEntityFlag (entity_id_t ent, const std::string &identifier, bool value)
 Set the flag specified by the identifier to the supplied value for the entity. More...
 
virtual CLosQuerier GetLosQuerier (player_id_t player) const
 Returns a CLosQuerier for checking whether vertex positions are visible to the given player (or other players it shares LOS with). More...
 
virtual void ActivateScriptedVisibility (entity_id_t ent, bool status)
 Toggle the scripted Visibility component activation for entity ent. More...
 
ELosVisibility ComputeLosVisibility (CEntityHandle ent, player_id_t player) const
 
ELosVisibility ComputeLosVisibility (entity_id_t ent, player_id_t player) const
 
virtual ELosVisibility GetLosVisibility (CEntityHandle ent, player_id_t player) const
 Returns the visibility status of the given entity, with respect to the given player. More...
 
virtual ELosVisibility GetLosVisibility (entity_id_t ent, player_id_t player) const
 
i32 PosToLosTilesHelper (entity_pos_t x, entity_pos_t z) const
 
void AddToTile (i32 tile, entity_id_t ent)
 
void RemoveFromTile (i32 tile, entity_id_t ent)
 
void UpdateVisibilityData ()
 
virtual void RequestVisibilityUpdate (entity_id_t ent)
 Request the update of the visibility cache of ent at next turn. More...
 
void UpdateVisibility (entity_id_t ent, player_id_t player)
 
void UpdateVisibility (entity_id_t ent)
 
virtual void SetLosRevealAll (player_id_t player, bool enabled)
 Set whether the whole map should be made visible to the given player. More...
 
virtual bool GetLosRevealAll (player_id_t player) const
 Returns whether the whole map has been made visible to the given player. More...
 
virtual void SetLosCircular (bool enabled)
 Set the LOS to be restricted to a circular map. More...
 
virtual bool GetLosCircular () const
 Returns whether the LOS is restricted to a circular map. More...
 
virtual void SetSharedLos (player_id_t player, const std::vector< player_id_t > &players)
 Sets shared LOS data for player to the given list of players. More...
 
virtual u32 GetSharedLosMask (player_id_t player) const
 Returns shared LOS mask for player. More...
 
void ExploreAllTiles (player_id_t p)
 Explore all tiles (but leave them in the FoW) for player p. More...
 
virtual void ExploreTerritories ()
 Explore the tiles inside each player's territory. More...
 
void SeeExploredEntities (player_id_t p) const
 Force any entity in explored territory to appear for player p. More...
 
virtual void RevealShore (player_id_t p, bool enable)
 Reveal the shore for specified player p. More...
 
bool LosIsOffWorld (ssize_t i, ssize_t j) const
 Returns whether the given vertex is outside the normal bounds of the world (i.e. More...
 
void LosAddStripHelper (u8 owner, i32 i0, i32 i1, i32 j, u16 *counts)
 Update the LOS state of tiles within a given horizontal strip (i0,j) to (i1,j) (inclusive). More...
 
void LosRemoveStripHelper (u8 owner, i32 i0, i32 i1, i32 j, u16 *counts)
 Update the LOS state of tiles within a given horizontal strip (i0,j) to (i1,j) (inclusive). More...
 
void MarkVisibilityDirtyAroundTile (u8 owner, i32 i, i32 j)
 
template<bool adding>
void LosUpdateHelper (u8 owner, entity_pos_t visionRange, CFixedVector2D pos)
 Update the LOS state of tiles within a given circular range, either adding or removing visibility depending on the template parameter. More...
 
void LosUpdateHelperIncremental (u8 owner, entity_pos_t visionRange, CFixedVector2D from, CFixedVector2D to)
 Update the LOS state of tiles within a given circular range, by removing visibility around the 'from' position and then adding visibility around the 'to' position. More...
 
void LosAdd (player_id_t owner, entity_pos_t visionRange, CFixedVector2D pos)
 
void SharingLosAdd (u16 visionSharing, entity_pos_t visionRange, CFixedVector2D pos)
 
void LosRemove (player_id_t owner, entity_pos_t visionRange, CFixedVector2D pos)
 
void SharingLosRemove (u16 visionSharing, entity_pos_t visionRange, CFixedVector2D pos)
 
void LosMove (player_id_t owner, entity_pos_t visionRange, CFixedVector2D from, CFixedVector2D to)
 
void SharingLosMove (u16 visionSharing, entity_pos_t visionRange, CFixedVector2D from, CFixedVector2D to)
 
virtual u8 GetPercentMapExplored (player_id_t player) const
 Get percent map explored statistics for specified player. More...
 
virtual u8 GetUnionPercentMapExplored (const std::vector< player_id_t > &players) const
 Get percent map explored statistics for specified set of players. More...
 
- Public Member Functions inherited from ICmpRangeManager
virtual void DestroyActiveQuery (tag_t tag)=0
 Destroy a query and clean up resources. More...
 
virtual void EnableActiveQuery (tag_t tag)=0
 Re-enable the processing of a query. More...
 
virtual void DisableActiveQuery (tag_t tag)=0
 Disable the processing of a query (no RangeUpdate messages will be sent). More...
 
virtual bool IsActiveQueryEnabled (tag_t tag) const =0
 Check if the processing of a query is enabled. More...
 
virtual std::vector< entity_id_tResetActiveQuery (tag_t tag)=0
 Immediately execute a query, and re-enable it if disabled. More...
 
std::string GetLosVisibility_wrapper (entity_id_t ent, player_id_t player) const
 GetLosVisibility wrapped for script calls. 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

bool m_DebugOverlayEnabled
 
bool m_DebugOverlayDirty
 
std::vector< SOverlayLinem_DebugOverlayLines
 
bool m_Deserializing
 
entity_pos_t m_WorldX0
 
entity_pos_t m_WorldZ0
 
entity_pos_t m_WorldX1
 
entity_pos_t m_WorldZ1
 
tag_t m_QueryNext
 
std::map< tag_t, Querym_Queries
 
EntityMap< EntityDatam_EntityData
 
FastSpatialSubdivision m_Subdivision
 
std::vector< entity_id_tm_SubdivisionResults
 
std::vector< bool > m_LosRevealAll
 
bool m_LosCircular
 
i32 m_TerrainVerticesPerSide
 
i32 m_LosTilesPerSide
 
bool m_GlobalVisibilityUpdate
 
std::vector< u8m_GlobalPlayerVisibilityUpdate
 
std::vector< u16m_DirtyVisibility
 
std::vector< std::set< entity_id_t > > m_LosTiles
 
std::vector< entity_id_tm_ModifiedEntities
 
std::vector< std::vector< u16 > > m_LosPlayerCounts
 
std::vector< u32m_LosState
 
std::vector< u32m_LosStateRevealed
 
std::vector< u32m_SharedLosMasks
 
std::vector< u16m_SharedDirtyVisibilityMasks
 
u32 m_TotalInworldVertices
 
std::vector< u32m_ExploredVertices
 

Static Public Attributes

static const player_id_t MAX_LOS_PLAYER_ID = 16
 

Additional Inherited Members

- Public Types inherited from ICmpRangeManager
enum  ELosState { LOS_UNEXPLORED = 0, LOS_EXPLORED = 1, LOS_VISIBLE = 2, LOS_MASK = 3 }
 
enum  ELosVisibility { VIS_HIDDEN = 0, VIS_FOGGED = 1, VIS_VISIBLE = 2 }
 
typedef u32 tag_t
 External identifiers for active queries. More...
 

Detailed Description

Range manager implementation.

Maintains a list of all entities (and their positions and owners), which is used for queries.

LOS implementation is based on the model described in GPG2. (TODO: would be nice to make it cleverer, so e.g. mountains and walls can block vision)

Member Function Documentation

virtual void CCmpRangeManager::ActivateScriptedVisibility ( entity_id_t  ent,
bool  status 
)
inlinevirtual

Toggle the scripted Visibility component activation for entity ent.

Implements ICmpRangeManager.

void CCmpRangeManager::AddToTile ( i32  tile,
entity_id_t  ent 
)
inline
static IComponent* CCmpRangeManager::Allocate ( ScriptInterface ,
JS::HandleValue   
)
inlinestatic
static void CCmpRangeManager::ClassInit ( CComponentManager componentManager)
inlinestatic
ELosVisibility CCmpRangeManager::ComputeLosVisibility ( CEntityHandle  ent,
player_id_t  player 
) const
inline
ELosVisibility CCmpRangeManager::ComputeLosVisibility ( entity_id_t  ent,
player_id_t  player 
) const
inline
Query CCmpRangeManager::ConstructParabolicQuery ( entity_id_t  source,
entity_pos_t  minRange,
entity_pos_t  maxRange,
entity_pos_t  elevationBonus,
const std::vector< int > &  owners,
int  requiredInterface,
u8  flagsMask 
) const
inline
Query CCmpRangeManager::ConstructQuery ( entity_id_t  source,
entity_pos_t  minRange,
entity_pos_t  maxRange,
const std::vector< int > &  owners,
int  requiredInterface,
u8  flagsMask 
) const
inline
virtual tag_t CCmpRangeManager::CreateActiveParabolicQuery ( entity_id_t  source,
entity_pos_t  minRange,
entity_pos_t  maxRange,
entity_pos_t  elevationBonus,
const std::vector< int > &  owners,
int  requiredInterface,
u8  flags 
)
inlinevirtual

Construct an active query of a paraboloic form around the unit.

The query will be disabled by default.

Parameters
sourcethe entity around which the range will be computed.
minRangenon-negative minimum horizontal distance in metres (inclusive). MinRange doesn't do parabolic checks.
maxRangenon-negative maximum distance in metres (inclusive) for units on the same elevation; or -1.0 to ignore distance. For units on a different elevation, a physical correct paraboloid with height=maxRange/2 above the unit is used to query them
elevationBonusextra bonus so the source can be placed higher and shoot further
ownerslist of player IDs that matching entities may have; -1 matches entities with no owner.
requiredInterfaceif non-zero, an interface ID that matching entities must implement.
flagsif a entity in range has one of the flags set it will show up.
Returns
unique non-zero identifier of query.

Implements ICmpRangeManager.

virtual tag_t CCmpRangeManager::CreateActiveQuery ( entity_id_t  source,
entity_pos_t  minRange,
entity_pos_t  maxRange,
const std::vector< int > &  owners,
int  requiredInterface,
u8  flags 
)
inlinevirtual

Construct an active query.

The query will be disabled by default.

Parameters
sourcethe entity around which the range will be computed.
minRangenon-negative minimum distance in metres (inclusive).
maxRangenon-negative maximum distance in metres (inclusive); or -1.0 to ignore distance.
ownerslist of player IDs that matching entities may have; -1 matches entities with no owner.
requiredInterfaceif non-zero, an interface ID that matching entities must implement.
flagsif a entity in range has one of the flags set it will show up.
Returns
unique non-zero identifier of query.

Implements ICmpRangeManager.

static void CCmpRangeManager::Deallocate ( IComponent cmp)
inlinestatic
virtual void CCmpRangeManager::Deinit ( )
inlinevirtual

Implements IComponent.

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

Implements IComponent.

virtual void CCmpRangeManager::DestroyActiveQuery ( tag_t  tag)
inlinevirtual
virtual void CCmpRangeManager::DisableActiveQuery ( tag_t  tag)
inlinevirtual
virtual void CCmpRangeManager::EnableActiveQuery ( tag_t  tag)
inlinevirtual
void CCmpRangeManager::ExecuteActiveQueries ( )
inline

Update all currently-enabled active queries.

virtual std::vector<entity_id_t> CCmpRangeManager::ExecuteQuery ( entity_id_t  source,
entity_pos_t  minRange,
entity_pos_t  maxRange,
const std::vector< int > &  owners,
int  requiredInterface 
)
inlinevirtual

Execute a passive query.

Parameters
sourcethe entity around which the range will be computed.
minRangenon-negative minimum distance in metres (inclusive).
maxRangenon-negative maximum distance in metres (inclusive); or -1.0 to ignore distance.
ownerslist of player IDs that matching entities may have; -1 matches entities with no owner.
requiredInterfaceif non-zero, an interface ID that matching entities must implement.
Returns
list of entities matching the query, ordered by increasing distance from the source entity.

Implements ICmpRangeManager.

virtual std::vector<entity_id_t> CCmpRangeManager::ExecuteQueryAroundPos ( const CFixedVector2D pos,
entity_pos_t  minRange,
entity_pos_t  maxRange,
const std::vector< int > &  owners,
int  requiredInterface 
)
inlinevirtual

Execute a passive query.

Parameters
posthe position around which the range will be computed.
minRangenon-negative minimum distance in metres (inclusive).
maxRangenon-negative maximum distance in metres (inclusive); or -1.0 to ignore distance.
ownerslist of player IDs that matching entities may have; -1 matches entities with no owner.
requiredInterfaceif non-zero, an interface ID that matching entities must implement.
Returns
list of entities matching the query, ordered by increasing distance from the source entity.

Implements ICmpRangeManager.

void CCmpRangeManager::ExploreAllTiles ( player_id_t  p)
inlinevirtual

Explore all tiles (but leave them in the FoW) for player p.

Implements ICmpRangeManager.

virtual void CCmpRangeManager::ExploreTerritories ( )
inlinevirtual

Explore the tiles inside each player's territory.

This is done only at the beginning of the game.

Implements ICmpRangeManager.

virtual int CCmpRangeManager::GetComponentTypeId ( ) const
inlinevirtual

Implements IComponent.

virtual entity_pos_t CCmpRangeManager::GetElevationAdaptedRange ( const CFixedVector3D pos,
const CFixedVector3D rot,
entity_pos_t  range,
entity_pos_t  elevationBonus,
entity_pos_t  angle 
) const
inlinevirtual

Get the average elevation over 8 points on distance range around the entity.

Parameters
idthe entity id to look around
rangethe distance to compare terrain height with
Returns
a fixed number representing the average difference. It's positive when the entity is on average higher than the terrain surrounding it.

Implements ICmpRangeManager.

std::vector<entity_id_t> CCmpRangeManager::GetEntitiesByMask ( u32  ownerMask) const
inline
virtual std::vector<entity_id_t> CCmpRangeManager::GetEntitiesByPlayer ( player_id_t  player) const
inlinevirtual

Returns a list of all entities for a specific player.

(This is on this interface because it shares a lot of the implementation. Maybe it should be extended to be more like ExecuteQuery without the range parameter.)

Implements ICmpRangeManager.

virtual u8 CCmpRangeManager::GetEntityFlagMask ( const std::string &  identifier) const
inlinevirtual

Returns the mask for the specified identifier.

Implements ICmpRangeManager.

virtual bool CCmpRangeManager::GetLosCircular ( ) const
inlinevirtual

Returns whether the LOS is restricted to a circular map.

Implements ICmpRangeManager.

virtual CLosQuerier CCmpRangeManager::GetLosQuerier ( player_id_t  player) const
inlinevirtual

Returns a CLosQuerier for checking whether vertex positions are visible to the given player (or other players it shares LOS with).

Implements ICmpRangeManager.

virtual bool CCmpRangeManager::GetLosRevealAll ( player_id_t  player) const
inlinevirtual

Returns whether the whole map has been made visible to the given player.

Implements ICmpRangeManager.

virtual ELosVisibility CCmpRangeManager::GetLosVisibility ( CEntityHandle  ent,
player_id_t  player 
) const
inlinevirtual

Returns the visibility status of the given entity, with respect to the given player.

Returns VIS_HIDDEN if the entity doesn't exist or is not in the world. This respects the GetLosRevealAll flag.

Implements ICmpRangeManager.

virtual ELosVisibility CCmpRangeManager::GetLosVisibility ( entity_id_t  ent,
player_id_t  player 
) const
inlinevirtual

Implements ICmpRangeManager.

virtual std::vector<entity_id_t> CCmpRangeManager::GetNonGaiaEntities ( ) const
inlinevirtual

Returns a list of all entities of all players except gaia.

Implements ICmpRangeManager.

virtual std::vector<entity_pos_t> CCmpRangeManager::getParabolicRangeForm ( CFixedVector3D  pos,
entity_pos_t  maxRange,
entity_pos_t  cutoff,
entity_pos_t  minAngle,
entity_pos_t  maxAngle,
int  numberOfSteps 
) const
inlinevirtual
virtual u8 CCmpRangeManager::GetPercentMapExplored ( player_id_t  player) const
inlinevirtual

Get percent map explored statistics for specified player.

Implements ICmpRangeManager.

static std::string CCmpRangeManager::GetSchema ( )
inlinestatic
virtual u32 CCmpRangeManager::GetSharedLosMask ( player_id_t  player) const
inlinevirtual

Returns shared LOS mask for player.

Implements ICmpRangeManager.

FastSpatialSubdivision* CCmpRangeManager::GetSubdivision ( )
inlinevirtual

Access the spatial subdivision kept by the range manager.

Returns
pointer to spatial subdivision structure.

Implements ICmpRangeManager.

virtual u8 CCmpRangeManager::GetUnionPercentMapExplored ( const std::vector< player_id_t > &  players) const
inlinevirtual

Get percent map explored statistics for specified set of players.

Note: this function computes statistics from scratch and should not be called too often.

Implements ICmpRangeManager.

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

Reimplemented from IComponent.

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

Implements IComponent.

virtual bool CCmpRangeManager::IsActiveQueryEnabled ( tag_t  tag) const
inlinevirtual
void CCmpRangeManager::LosAdd ( player_id_t  owner,
entity_pos_t  visionRange,
CFixedVector2D  pos 
)
inline
void CCmpRangeManager::LosAddStripHelper ( u8  owner,
i32  i0,
i32  i1,
i32  j,
u16 counts 
)
inline

Update the LOS state of tiles within a given horizontal strip (i0,j) to (i1,j) (inclusive).

bool CCmpRangeManager::LosIsOffWorld ( ssize_t  i,
ssize_t  j 
) const
inline

Returns whether the given vertex is outside the normal bounds of the world (i.e.

outside the range of a circular map)

void CCmpRangeManager::LosMove ( player_id_t  owner,
entity_pos_t  visionRange,
CFixedVector2D  from,
CFixedVector2D  to 
)
inline
void CCmpRangeManager::LosRemove ( player_id_t  owner,
entity_pos_t  visionRange,
CFixedVector2D  pos 
)
inline
void CCmpRangeManager::LosRemoveStripHelper ( u8  owner,
i32  i0,
i32  i1,
i32  j,
u16 counts 
)
inline

Update the LOS state of tiles within a given horizontal strip (i0,j) to (i1,j) (inclusive).

template<bool adding>
void CCmpRangeManager::LosUpdateHelper ( u8  owner,
entity_pos_t  visionRange,
CFixedVector2D  pos 
)
inline

Update the LOS state of tiles within a given circular range, either adding or removing visibility depending on the template parameter.

Assumes owner is in the valid range.

void CCmpRangeManager::LosUpdateHelperIncremental ( u8  owner,
entity_pos_t  visionRange,
CFixedVector2D  from,
CFixedVector2D  to 
)
inline

Update the LOS state of tiles within a given circular range, by removing visibility around the 'from' position and then adding visibility around the 'to' position.

void CCmpRangeManager::MarkVisibilityDirtyAroundTile ( u8  owner,
i32  i,
i32  j 
)
inline
void CCmpRangeManager::PerformQuery ( const Query q,
std::vector< entity_id_t > &  r,
CFixedVector2D  pos 
)
inline

Returns a list of distinct entity IDs that match the given query, sorted by ID.

i32 CCmpRangeManager::PosToLosTilesHelper ( entity_pos_t  x,
entity_pos_t  z 
) const
inline
void CCmpRangeManager::RemoveFromTile ( i32  tile,
entity_id_t  ent 
)
inline
void CCmpRangeManager::RenderSubmit ( SceneCollector collector)
inline
virtual void CCmpRangeManager::RequestVisibilityUpdate ( entity_id_t  ent)
inlinevirtual

Request the update of the visibility cache of ent at next turn.

Typically used for fogging.

Implements ICmpRangeManager.

virtual std::vector<entity_id_t> CCmpRangeManager::ResetActiveQuery ( tag_t  tag)
inlinevirtual
void CCmpRangeManager::ResetDerivedData ( )
inline
void CCmpRangeManager::ResetSubdivisions ( entity_pos_t  x1,
entity_pos_t  z1 
)
inline
virtual void CCmpRangeManager::RevealShore ( player_id_t  p,
bool  enable 
)
inlinevirtual

Reveal the shore for specified player p.

This works like for entities: if RevealShore is called multiple times with enabled, it will be necessary to call it the same number of times with !enabled to make the shore fall back into the FoW.

Implements ICmpRangeManager.

void CCmpRangeManager::SeeExploredEntities ( player_id_t  p) const
inline

Force any entity in explored territory to appear for player p.

This is useful for miraging entities inside the territory borders at the beginning of a game, or if the "Explore Map" option has been set.

virtual void CCmpRangeManager::Serialize ( ISerializer serialize)
inlinevirtual

Implements IComponent.

template<typename S >
void CCmpRangeManager::SerializeCommon ( S &  serialize)
inline
virtual void CCmpRangeManager::SetBounds ( entity_pos_t  x0,
entity_pos_t  z0,
entity_pos_t  x1,
entity_pos_t  z1,
ssize_t  vertices 
)
inlinevirtual

Set the bounds of the world.

Entities should not be outside the bounds (else efficiency will suffer).

Parameters
x0,z0,x1,z1Coordinates of the corners of the world
verticesNumber of terrain vertices per side

Implements ICmpRangeManager.

virtual void CCmpRangeManager::SetDebugOverlay ( bool  enabled)
inlinevirtual

Toggle the rendering of debug info.

Implements ICmpRangeManager.

virtual void CCmpRangeManager::SetEntityFlag ( entity_id_t  ent,
const std::string &  identifier,
bool  value 
)
inlinevirtual

Set the flag specified by the identifier to the supplied value for the entity.

Parameters
entthe entity whose flags will be modified.
identifierthe flag to be modified.
valueto which the flag will be set.

Implements ICmpRangeManager.

virtual void CCmpRangeManager::SetLosCircular ( bool  enabled)
inlinevirtual

Set the LOS to be restricted to a circular map.

Implements ICmpRangeManager.

virtual void CCmpRangeManager::SetLosRevealAll ( player_id_t  player,
bool  enabled 
)
inlinevirtual

Set whether the whole map should be made visible to the given player.

If player is -1, the map will be made visible to all players.

Implements ICmpRangeManager.

virtual void CCmpRangeManager::SetSharedLos ( player_id_t  player,
const std::vector< player_id_t > &  players 
)
inlinevirtual

Sets shared LOS data for player to the given list of players.

Implements ICmpRangeManager.

void CCmpRangeManager::SharingLosAdd ( u16  visionSharing,
entity_pos_t  visionRange,
CFixedVector2D  pos 
)
inline
void CCmpRangeManager::SharingLosMove ( u16  visionSharing,
entity_pos_t  visionRange,
CFixedVector2D  from,
CFixedVector2D  to 
)
inline
void CCmpRangeManager::SharingLosRemove ( u16  visionSharing,
entity_pos_t  visionRange,
CFixedVector2D  pos 
)
inline
bool CCmpRangeManager::TestEntityQuery ( const Query q,
entity_id_t  id,
const EntityData entity 
) const
inline

Returns whether the given entity matches the given query (ignoring maxRange)

void CCmpRangeManager::UpdateVisibility ( entity_id_t  ent,
player_id_t  player 
)
inline
void CCmpRangeManager::UpdateVisibility ( entity_id_t  ent)
inline
void CCmpRangeManager::UpdateVisibilityData ( )
inline
virtual void CCmpRangeManager::Verify ( )
inlinevirtual

Perform some internal consistency checks for testing/debugging.

Implements ICmpRangeManager.

Member Data Documentation

bool CCmpRangeManager::m_DebugOverlayDirty
bool CCmpRangeManager::m_DebugOverlayEnabled
std::vector<SOverlayLine> CCmpRangeManager::m_DebugOverlayLines
bool CCmpRangeManager::m_Deserializing
std::vector<u16> CCmpRangeManager::m_DirtyVisibility
EntityMap<EntityData> CCmpRangeManager::m_EntityData
std::vector<u32> CCmpRangeManager::m_ExploredVertices
std::vector<u8> CCmpRangeManager::m_GlobalPlayerVisibilityUpdate
bool CCmpRangeManager::m_GlobalVisibilityUpdate
bool CCmpRangeManager::m_LosCircular
std::vector<std::vector<u16> > CCmpRangeManager::m_LosPlayerCounts
std::vector<bool> CCmpRangeManager::m_LosRevealAll
std::vector<u32> CCmpRangeManager::m_LosState
std::vector<u32> CCmpRangeManager::m_LosStateRevealed
std::vector<std::set<entity_id_t> > CCmpRangeManager::m_LosTiles
i32 CCmpRangeManager::m_LosTilesPerSide
std::vector<entity_id_t> CCmpRangeManager::m_ModifiedEntities
std::map<tag_t, Query> CCmpRangeManager::m_Queries
tag_t CCmpRangeManager::m_QueryNext
std::vector<u16> CCmpRangeManager::m_SharedDirtyVisibilityMasks
std::vector<u32> CCmpRangeManager::m_SharedLosMasks
FastSpatialSubdivision CCmpRangeManager::m_Subdivision
std::vector<entity_id_t> CCmpRangeManager::m_SubdivisionResults
i32 CCmpRangeManager::m_TerrainVerticesPerSide
u32 CCmpRangeManager::m_TotalInworldVertices
entity_pos_t CCmpRangeManager::m_WorldX0
entity_pos_t CCmpRangeManager::m_WorldX1
entity_pos_t CCmpRangeManager::m_WorldZ0
entity_pos_t CCmpRangeManager::m_WorldZ1
const player_id_t CCmpRangeManager::MAX_LOS_PLAYER_ID = 16
static

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