Pyrogenesis  trunk
Classes | Macros | Enumerations | Functions | Variables
CCmpRangeManager.cpp File Reference
#include "precompiled.h"
#include "simulation2/system/Component.h"
#include "ICmpRangeManager.h"
#include "ICmpTerrain.h"
#include "simulation2/system/EntityMap.h"
#include "simulation2/MessageTypes.h"
#include "simulation2/components/ICmpFogging.h"
#include "simulation2/components/ICmpMirage.h"
#include "simulation2/components/ICmpOwnership.h"
#include "simulation2/components/ICmpPosition.h"
#include "simulation2/components/ICmpObstructionManager.h"
#include "simulation2/components/ICmpTerritoryManager.h"
#include "simulation2/components/ICmpVisibility.h"
#include "simulation2/components/ICmpVision.h"
#include "simulation2/components/ICmpWaterManager.h"
#include "simulation2/helpers/Render.h"
#include "simulation2/helpers/Spatial.h"
#include "graphics/Overlay.h"
#include "graphics/Terrain.h"
#include "lib/timer.h"
#include "ps/CLogger.h"
#include "ps/Profile.h"
#include "renderer/Scene.h"
Include dependency graph for CCmpRangeManager.cpp:

Classes

struct  Query
 Representation of a range query. More...
 
struct  EntityParabolicRangeOutline
 
struct  EntityData
 
struct  SerializeQuery
 Serialization helper template for Query. More...
 
struct  SerializeEntityData
 Serialization helper template for EntityData. More...
 
struct  EntityDistanceOrdering
 Functor for sorting entities by distance from a source point. More...
 
class  CCmpRangeManager
 Range manager implementation. More...
 

Macros

#define LOS_TILES_RATIO   8
 
#define DEBUG_RANGE_MANAGER_BOUNDS   0
 

Enumerations

enum  FlagMasks {
  None = 0x00, Normal = 0x01, Injured = 0x02, AllQuery = Normal | Injured,
  InWorld = 0x08, RetainInFog = 0x10, RevealShore = 0x20, ScriptedVisibility = 0x40,
  SharedVision = 0x80
}
 Representation of an entity, with the data needed for queries. More...
 

Functions

static u32 CalcOwnerMask (player_id_t owner)
 Convert an owner ID (-1 = unowned, 0 = gaia, 1..30 = players) into a 32-bit mask for quick set-membership tests. More...
 
static u32 CalcPlayerLosMask (player_id_t player)
 Returns LOS mask for given player. More...
 
static u32 CalcSharedLosMask (std::vector< player_id_t > players)
 Returns shared LOS mask for given list of players. More...
 
static bool SetPlayerSharedDirtyVisibilityBit (u16 &mask, player_id_t player, bool enable)
 Add/remove a player to/from mask, which is a 1-bit mask representing a list of players. More...
 
static u8 GetPlayerVisibility (u32 visibilities, player_id_t player)
 Computes the 2-bit visibility for one player, given the total 32-bit visibilities. More...
 
static bool IsVisibilityDirty (u16 dirty, player_id_t player)
 Test whether the visibility is dirty for a given LoS tile and a given player. More...
 
static bool HasVisionSharing (u16 visionSharing, player_id_t player)
 Test whether a player share this vision. More...
 
static u16 CalcVisionSharingMask (player_id_t player)
 Computes the shared vision mask for the player. More...
 
static bool InParabolicRange (CFixedVector3D v, fixed range)
 Checks whether v is in a parabolic range of (0,0,0) The highest point of the paraboloid is (0,range/2,0) and the circle of distance 'range' around (0,0,0) on height y=0 is part of the paraboloid. More...
 
 cassert (sizeof(EntityData)==24)
 

Variables

static std::map< entity_id_t, EntityParabolicRangeOutlineParabolicRangesOutlines
 

Macro Definition Documentation

#define DEBUG_RANGE_MANAGER_BOUNDS   0
#define LOS_TILES_RATIO   8

Enumeration Type Documentation

enum FlagMasks

Representation of an entity, with the data needed for queries.

Enumerator
None 
Normal 
Injured 
AllQuery 
InWorld 
RetainInFog 
RevealShore 
ScriptedVisibility 
SharedVision 

Function Documentation

static u32 CalcOwnerMask ( player_id_t  owner)
inlinestatic

Convert an owner ID (-1 = unowned, 0 = gaia, 1..30 = players) into a 32-bit mask for quick set-membership tests.

static u32 CalcPlayerLosMask ( player_id_t  player)
inlinestatic

Returns LOS mask for given player.

static u32 CalcSharedLosMask ( std::vector< player_id_t players)
static

Returns shared LOS mask for given list of players.

static u16 CalcVisionSharingMask ( player_id_t  player)
inlinestatic

Computes the shared vision mask for the player.

cassert ( sizeof(EntityData = =24)
static u8 GetPlayerVisibility ( u32  visibilities,
player_id_t  player 
)
inlinestatic

Computes the 2-bit visibility for one player, given the total 32-bit visibilities.

static bool HasVisionSharing ( u16  visionSharing,
player_id_t  player 
)
inlinestatic

Test whether a player share this vision.

static bool InParabolicRange ( CFixedVector3D  v,
fixed  range 
)
static

Checks whether v is in a parabolic range of (0,0,0) The highest point of the paraboloid is (0,range/2,0) and the circle of distance 'range' around (0,0,0) on height y=0 is part of the paraboloid.

Avoids sqrting and overflowing.

static bool IsVisibilityDirty ( u16  dirty,
player_id_t  player 
)
inlinestatic

Test whether the visibility is dirty for a given LoS tile and a given player.

static bool SetPlayerSharedDirtyVisibilityBit ( u16 mask,
player_id_t  player,
bool  enable 
)
static

Add/remove a player to/from mask, which is a 1-bit mask representing a list of players.

Returns true if the mask is modified.

Variable Documentation

std::map<entity_id_t, EntityParabolicRangeOutline> ParabolicRangesOutlines
static