Pyrogenesis
trunk
|
Implementation of ICmpPathfinder. More...
#include <CCmpPathfinder_Common.h>
Classes | |
class | PathRequests |
Public Member Functions | |
~CCmpPathfinder () | |
int | GetComponentTypeId () const override |
void | Init (const CParamNode ¶mNode) override |
void | Deinit () override |
template<typename S > | |
void | SerializeCommon (S &serialize) |
void | Serialize (ISerializer &serialize) override |
void | Deserialize (const CParamNode ¶mNode, IDeserializer &deserialize) override |
void | HandleMessage (const CMessage &msg, bool global) override |
pass_class_t | GetPassabilityClass (const std::string &name) const override |
Get the tag for a given passability class name. More... | |
void | GetPassabilityClasses (std::map< std::string, pass_class_t > &passClasses) const override |
Get the list of all known passability classes. More... | |
void | GetPassabilityClasses (std::map< std::string, pass_class_t > &nonPathfindingPassClasses, std::map< std::string, pass_class_t > &pathfindingPassClasses) const override |
Get the list of passability classes, separating pathfinding classes and others. More... | |
const PathfinderPassability * | GetPassabilityFromMask (pass_class_t passClass) const |
entity_pos_t | GetClearance (pass_class_t passClass) const override |
entity_pos_t | GetMaximumClearance () const override |
Get the larger clearance in all passability classes. More... | |
const Grid< NavcellData > & | GetPassabilityGrid () override |
const GridUpdateInformation & | GetAIPathfinderDirtinessInformation () const override |
Get the accumulated dirtiness information since the last time the AI accessed and flushed it. More... | |
void | FlushAIPathfinderDirtinessInformation () override |
Grid< u16 > | ComputeShoreGrid (bool expandOnWater=false) override |
Get a grid representing the distance to the shore of the terrain tile. More... | |
void | ComputePathImmediate (entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass, WaypointPath &ret) const override |
u32 | ComputePathAsync (entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass, entity_id_t notify) override |
Asynchronous version of ComputePath. More... | |
WaypointPath | ComputeShortPathImmediate (const ShortPathRequest &request) const override |
u32 | ComputeShortPathAsync (entity_pos_t x0, entity_pos_t z0, entity_pos_t clearance, entity_pos_t range, const PathGoal &goal, pass_class_t passClass, bool avoidMovingUnits, entity_id_t controller, entity_id_t notify) override |
Request a short path computation, asynchronously. More... | |
bool | IsGoalReachable (entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass) override |
void | SetDebugPath (entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass) override |
If the debug overlay is enabled, render the path that will computed by ComputePath. More... | |
void | SetDebugOverlay (bool enabled) override |
Toggle the storage and rendering of debug info. More... | |
void | SetHierDebugOverlay (bool enabled) override |
Toggle the storage and rendering of debug info for the hierarchical pathfinder. More... | |
void | GetDebugData (u32 &steps, double &time, Grid< u8 > &grid) const override |
Returns some stats about the last ComputePath. More... | |
void | SetAtlasOverlay (bool enable, pass_class_t passClass=0) override |
Sets up the pathfinder passability overlay in Atlas. More... | |
bool | CheckMovement (const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r, pass_class_t passClass) const override |
Check whether the given movement line is valid and doesn't hit any obstructions or impassable terrain. More... | |
ICmpObstruction::EFoundationCheck | CheckUnitPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t r, pass_class_t passClass, bool onlyCenterPoint) const override |
Check whether a unit placed here is valid and doesn't hit any obstructions or impassable terrain. More... | |
ICmpObstruction::EFoundationCheck | CheckBuildingPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t a, entity_pos_t w, entity_pos_t h, entity_id_t id, pass_class_t passClass) const override |
Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain. More... | |
ICmpObstruction::EFoundationCheck | CheckBuildingPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t a, entity_pos_t w, entity_pos_t h, entity_id_t id, pass_class_t passClass, bool onlyCenterPoint) const override |
Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain. More... | |
void | SendRequestedPaths () override |
Finish computing asynchronous path requests and send the CMessagePathResult messages. More... | |
void | StartProcessingMoves (bool useMax) override |
Tell asynchronous pathfinder threads that they can begin computing paths. More... | |
template<typename T > | |
std::vector< T > | GetMovesToProcess (std::vector< T > &requests, bool useMax=false, size_t maxMoves=0) |
template<typename T > | |
void | PushRequestsToWorkers (std::vector< T > &from) |
void | UpdateGrid () override |
Regenerates the grid based on the current obstruction list, if necessary. More... | |
void | MinimalTerrainUpdate (int itile0, int jtile0, int itile1, int jtile1) |
Updates the terrain-only grid without updating the dirtiness informations. More... | |
void | TerrainUpdateHelper (bool expandPassability=true, int itile0=-1, int jtile0=-1, int itile1=-1, int jtile1=-1) |
Regenerates the terrain-only grid. More... | |
void | RenderSubmit (SceneCollector &collector) |
Public Member Functions inherited from IComponent | |
virtual | ~IComponent () |
CEntityHandle | GetEntityHandle () const |
void | SetEntityHandle (CEntityHandle ent) |
entity_id_t | GetEntityId () const |
CEntityHandle | GetSystemEntity () const |
const CSimContext & | GetSimContext () const |
void | SetSimContext (const CSimContext &context) |
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 |
Static Public Member Functions | |
static void | ClassInit (CComponentManager &componentManager) |
static IComponent * | Allocate (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 | |
std::map< std::string, pass_class_t > | m_PassClassMasks |
std::vector< PathfinderPassability > | m_PassClasses |
u16 | m_MaxSameTurnMoves |
u16 | m_GridSize |
Grid< NavcellData > * | m_Grid |
Grid< NavcellData > * | m_TerrainOnlyGrid |
GridUpdateInformation | m_DirtinessInformation |
GridUpdateInformation | m_AIPathfinderDirtinessInformation |
bool | m_TerrainDirty |
std::vector< VertexPathfinder > | m_VertexPathfinders |
std::unique_ptr< HierarchicalPathfinder > | m_PathfinderHier |
std::unique_ptr< LongPathfinder > | m_LongPathfinder |
std::vector< Future< void > > | m_Futures |
PathRequests< LongPathRequest > | m_LongPathRequests |
PathRequests< ShortPathRequest > | m_ShortPathRequests |
u32 | m_NextAsyncTicket |
AtlasOverlay * | m_AtlasOverlay |
Additional Inherited Members | |
Public Types inherited from IComponent | |
using | AllocFunc = IComponent *(*)(const ScriptInterface &scriptInterface, JS::HandleValue ctor) |
using | DeallocFunc = void(*)(IComponent *) |
Implementation of ICmpPathfinder.
CCmpPathfinder::~CCmpPathfinder | ( | ) |
|
inlinestatic |
|
overridevirtual |
Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain.
Implements ICmpPathfinder.
|
overridevirtual |
Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain.
when onlyCenterPoint = true, only check the center tile of the building
Implements ICmpPathfinder.
|
overridevirtual |
Check whether the given movement line is valid and doesn't hit any obstructions or impassable terrain.
Returns true if the movement is okay.
Implements ICmpPathfinder.
|
overridevirtual |
Check whether a unit placed here is valid and doesn't hit any obstructions or impassable terrain.
When onlyCenterPoint = true, only check the center tile of the unit
Implements ICmpPathfinder.
|
inlinestatic |
|
overridevirtual |
Asynchronous version of ComputePath.
Request a long path computation, asynchronously. The result will be sent as CMessagePathResult to 'notify'. Returns a unique non-zero number, which will match the 'ticket' in the result, so callers can recognise each individual request they make.
Implements ICmpPathfinder.
|
overridevirtual |
Implements ICmpPathfinder.
Get a grid representing the distance to the shore of the terrain tile.
Implements ICmpPathfinder.
|
overridevirtual |
Request a short path computation, asynchronously.
The result will be sent as CMessagePathResult to 'notify'. Returns a unique non-zero number, which will match the 'ticket' in the result, so callers can recognise each individual request they make.
Implements ICmpPathfinder.
|
overridevirtual |
Implements ICmpPathfinder.
|
inlinestatic |
|
overridevirtual |
Implements IComponent.
|
overridevirtual |
Implements IComponent.
|
inlineoverridevirtual |
Implements ICmpPathfinder.
|
inlineoverridevirtual |
Get the accumulated dirtiness information since the last time the AI accessed and flushed it.
Implements ICmpPathfinder.
|
inlineoverridevirtual |
Implements ICmpPathfinder.
|
inlineoverridevirtual |
Implements IComponent.
|
overridevirtual |
Returns some stats about the last ComputePath.
Implements ICmpPathfinder.
|
inlineoverridevirtual |
Get the larger clearance in all passability classes.
Implements ICmpPathfinder.
std::vector<T> CCmpPathfinder::GetMovesToProcess | ( | std::vector< T > & | requests, |
bool | useMax = false , |
||
size_t | maxMoves = 0 |
||
) |
|
overridevirtual |
Get the tag for a given passability class name.
Logs an error and returns something acceptable if the name is unrecognised.
Implements ICmpPathfinder.
|
overridevirtual |
Get the list of all known passability classes.
Implements ICmpPathfinder.
|
overridevirtual |
Get the list of passability classes, separating pathfinding classes and others.
Implements ICmpPathfinder.
const PathfinderPassability * CCmpPathfinder::GetPassabilityFromMask | ( | pass_class_t | passClass | ) | const |
|
overridevirtual |
Implements ICmpPathfinder.
|
inlinestatic |
|
overridevirtual |
Reimplemented from IComponent.
|
overridevirtual |
Implements IComponent.
|
overridevirtual |
Implements ICmpPathfinder.
void CCmpPathfinder::MinimalTerrainUpdate | ( | int | itile0, |
int | jtile0, | ||
int | itile1, | ||
int | jtile1 | ||
) |
Updates the terrain-only grid without updating the dirtiness informations.
Useful for fast passability updates in Atlas.
void CCmpPathfinder::PushRequestsToWorkers | ( | std::vector< T > & | from | ) |
void CCmpPathfinder::RenderSubmit | ( | SceneCollector & | collector | ) |
|
overridevirtual |
Finish computing asynchronous path requests and send the CMessagePathResult messages.
Implements ICmpPathfinder.
|
overridevirtual |
Implements IComponent.
void CCmpPathfinder::SerializeCommon | ( | S & | serialize | ) |
|
overridevirtual |
Sets up the pathfinder passability overlay in Atlas.
Implements ICmpPathfinder.
|
overridevirtual |
Toggle the storage and rendering of debug info.
Implements ICmpPathfinder.
|
overridevirtual |
If the debug overlay is enabled, render the path that will computed by ComputePath.
Implements ICmpPathfinder.
|
overridevirtual |
Toggle the storage and rendering of debug info for the hierarchical pathfinder.
Implements ICmpPathfinder.
|
overridevirtual |
Tell asynchronous pathfinder threads that they can begin computing paths.
Implements ICmpPathfinder.
void CCmpPathfinder::TerrainUpdateHelper | ( | bool | expandPassability = true , |
int | itile0 = -1 , |
||
int | jtile0 = -1 , |
||
int | itile1 = -1 , |
||
int | jtile1 = -1 |
||
) |
Regenerates the terrain-only grid.
Atlas doesn't need to have passability cells expanded.
|
overridevirtual |
Regenerates the grid based on the current obstruction list, if necessary.
Implements ICmpPathfinder.
GridUpdateInformation CCmpPathfinder::m_AIPathfinderDirtinessInformation |
AtlasOverlay* CCmpPathfinder::m_AtlasOverlay |
GridUpdateInformation CCmpPathfinder::m_DirtinessInformation |
std::vector<Future<void> > CCmpPathfinder::m_Futures |
Grid<NavcellData>* CCmpPathfinder::m_Grid |
u16 CCmpPathfinder::m_GridSize |
std::unique_ptr<LongPathfinder> CCmpPathfinder::m_LongPathfinder |
PathRequests<LongPathRequest> CCmpPathfinder::m_LongPathRequests |
u16 CCmpPathfinder::m_MaxSameTurnMoves |
u32 CCmpPathfinder::m_NextAsyncTicket |
std::vector<PathfinderPassability> CCmpPathfinder::m_PassClasses |
std::map<std::string, pass_class_t> CCmpPathfinder::m_PassClassMasks |
std::unique_ptr<HierarchicalPathfinder> CCmpPathfinder::m_PathfinderHier |
PathRequests<ShortPathRequest> CCmpPathfinder::m_ShortPathRequests |
bool CCmpPathfinder::m_TerrainDirty |
Grid<NavcellData>* CCmpPathfinder::m_TerrainOnlyGrid |
std::vector<VertexPathfinder> CCmpPathfinder::m_VertexPathfinders |