Pyrogenesis  trunk
Classes | Namespaces | 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/Los.h"
#include "simulation2/helpers/MapEdgeTiles.h"
#include "simulation2/helpers/Render.h"
#include "simulation2/helpers/Spatial.h"
#include "simulation2/serialization/SerializedTypes.h"
#include "graphics/Overlay.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  anonymous_namespace{CCmpRangeManager.cpp}::Query
 Representation of a range query. More...
 
struct  anonymous_namespace{CCmpRangeManager.cpp}::EntityParabolicRangeOutline
 
struct  anonymous_namespace{CCmpRangeManager.cpp}::EntityData
 
class  anonymous_namespace{CCmpRangeManager.cpp}::EntityDistanceOrdering
 Functor for sorting entities by distance from a source point. More...
 
struct  SerializeHelper< Query >
 Serialization helper template for Query. More...
 
struct  SerializeHelper< EntityData >
 Serialization helper template for EntityData. More...
 
class  CCmpRangeManager
 Range manager implementation. More...
 

Namespaces

 anonymous_namespace{CCmpRangeManager.cpp}
 

Macros

#define DEBUG_RANGE_MANAGER_BOUNDS   0
 

Enumerations

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

Functions

u32 anonymous_namespace{CCmpRangeManager.cpp}::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...
 
u32 anonymous_namespace{CCmpRangeManager.cpp}::CalcPlayerLosMask (player_id_t player)
 Returns LOS mask for given player. More...
 
u32 anonymous_namespace{CCmpRangeManager.cpp}::CalcSharedLosMask (std::vector< player_id_t > players)
 Returns shared LOS mask for given list of players. More...
 
bool anonymous_namespace{CCmpRangeManager.cpp}::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...
 
LosVisibility anonymous_namespace{CCmpRangeManager.cpp}::GetPlayerVisibility (u32 visibilities, player_id_t player)
 Computes the 2-bit visibility for one player, given the total 32-bit visibilities. More...
 
bool anonymous_namespace{CCmpRangeManager.cpp}::IsVisibilityDirty (u16 dirty, player_id_t player)
 Test whether the visibility is dirty for a given LoS region and a given player. More...
 
bool anonymous_namespace{CCmpRangeManager.cpp}::HasVisionSharing (u16 visionSharing, player_id_t player)
 Test whether a player share this vision. More...
 
u16 anonymous_namespace{CCmpRangeManager.cpp}::CalcVisionSharingMask (player_id_t player)
 Computes the shared vision mask for the player. More...
 
static bool anonymous_namespace{CCmpRangeManager.cpp}::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 This equates to computing f(x, z) = y = -(xx + zz)/(2*range) + range/2 > 0, or alternatively sqrt(xx+zz) <= sqrt(range^2 - 2range*y). More...
 

Variables

constexpr int anonymous_namespace{CCmpRangeManager.cpp}::LOS_REGION_RATIO = 8
 How many LOS vertices to have per region. More...
 
const fixed anonymous_namespace{CCmpRangeManager.cpp}::PARABOLIC_RANGE_TOLERANCE = fixed::FromInt(1)/2
 Tolerance for parabolic range calculations. More...
 
static std::map< entity_id_t, EntityParabolicRangeOutline > anonymous_namespace{CCmpRangeManager.cpp}::ParabolicRangesOutlines
 

Macro Definition Documentation

◆ DEBUG_RANGE_MANAGER_BOUNDS

#define DEBUG_RANGE_MANAGER_BOUNDS   0