Pyrogenesis
13997
|
Implementation of ICmpPathfinder. More...
#include <CCmpPathfinder_Common.h>
Public Member Functions | |
virtual void | Init (const CParamNode ¶mNode) |
virtual void | Deinit () |
virtual void | Serialize (ISerializer &serialize) |
virtual void | Deserialize (const CParamNode ¶mNode, IDeserializer &deserialize) |
virtual void | HandleMessage (const CMessage &msg, bool global) |
virtual pass_class_t | GetPassabilityClass (const std::string &name) |
Get the tag for a given passability class name. More... | |
virtual std::map< std::string, pass_class_t > | GetPassabilityClasses () |
Get the list of all known passability classes. More... | |
virtual cost_class_t | GetCostClass (const std::string &name) |
Get the tag for a given movement cost class name. More... | |
virtual const Grid< u16 > & | GetPassabilityGrid () |
virtual void | ComputePath (entity_pos_t x0, entity_pos_t z0, const Goal &goal, pass_class_t passClass, cost_class_t costClass, Path &ret) |
virtual u32 | ComputePathAsync (entity_pos_t x0, entity_pos_t z0, const Goal &goal, pass_class_t passClass, cost_class_t costClass, entity_id_t notify) |
Asynchronous version of ComputePath. More... | |
virtual void | ComputeShortPath (const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t r, entity_pos_t range, const Goal &goal, pass_class_t passClass, Path &ret) |
virtual u32 | ComputeShortPathAsync (entity_pos_t x0, entity_pos_t z0, entity_pos_t r, entity_pos_t range, const Goal &goal, pass_class_t passClass, bool avoidMovingUnits, entity_id_t controller, entity_id_t notify) |
Asynchronous version of ComputeShortPath (using ControlGroupObstructionFilter). More... | |
virtual void | SetDebugPath (entity_pos_t x0, entity_pos_t z0, const Goal &goal, pass_class_t passClass, cost_class_t costClass) |
If the debug overlay is enabled, render the path that will computed by ComputePath. More... | |
virtual void | ResetDebugPath () |
virtual void | SetDebugOverlay (bool enabled) |
Toggle the storage and rendering of debug info. More... | |
virtual fixed | GetMovementSpeed (entity_pos_t x0, entity_pos_t z0, cost_class_t costClass) |
Find the speed factor (typically around 1.0) for a unit of the given cost class at the given position. More... | |
virtual CFixedVector2D | GetNearestPointOnGoal (CFixedVector2D pos, const Goal &goal) |
Returns the coordinates of the point on the goal that is closest to pos in a straight line. More... | |
virtual 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) |
Check whether the given movement line is valid and doesn't hit any obstructions or impassable terrain. More... | |
virtual ICmpObstruction::EFoundationCheck | CheckUnitPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t r, pass_class_t passClass) |
Check whether a unit placed here is valid and doesn't hit any obstructions or impassable terrain. More... | |
virtual ICmpObstruction::EFoundationCheck | CheckUnitPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t r, pass_class_t passClass, bool onlyCenterPoint) |
Check whether a unit placed here is valid and doesn't hit any obstructions or impassable terrain. More... | |
virtual 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) |
Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain. More... | |
virtual 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) |
Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain. More... | |
virtual void | FinishAsyncRequests () |
Finish computing asynchronous path requests and send the CMessagePathResult messages. More... | |
void | ProcessLongRequests (const std::vector< AsyncLongPathRequest > &longRequests) |
void | ProcessShortRequests (const std::vector< AsyncShortPathRequest > &shortRequests) |
virtual void | ProcessSameTurnMoves () |
Process moves during the same turn they were created in to improve responsiveness. More... | |
void | NearestTile (entity_pos_t x, entity_pos_t z, u16 &i, u16 &j) |
Returns the tile containing the given position. More... | |
void | UpdateGrid () |
Regenerates the grid based on the current obstruction list, if necessary. More... | |
void | RenderSubmit (SceneCollector &collector) |
![]() | |
virtual void | ComputePath (entity_pos_t x0, entity_pos_t z0, const Goal &goal, pass_class_t passClass, cost_class_t costClass, Path &ret)=0 |
Compute a tile-based path from the given point to the goal, and return the set of waypoints. More... | |
virtual void | ComputeShortPath (const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t r, entity_pos_t range, const Goal &goal, pass_class_t passClass, Path &ret)=0 |
Compute a precise path from the given point to the goal, and return the set of waypoints. More... | |
![]() | |
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 JSClass * | GetJSClass () const |
virtual jsval | GetJSInstance () const |
Static Public Member Functions | |
static void | ClassInit (CComponentManager &componentManager) |
static IComponent * | Allocate (ScriptInterface &, jsval) |
static void | Deallocate (IComponent *cmp) |
static std::string | GetSchema () |
static void | TileCenter (u16 i, u16 j, entity_pos_t &x, entity_pos_t &z) |
Returns the position of the center of the given tile. More... | |
static fixed | DistanceToGoal (CFixedVector2D pos, const CCmpPathfinder::Goal &goal) |
![]() | |
static std::string | GetSchema () |
static u8 | GetSerializationVersion () |
Public Attributes | |
std::map< std::string, pass_class_t > | m_PassClassMasks |
std::vector < PathfinderPassability > | m_PassClasses |
std::map< std::string, cost_class_t > | m_TerrainCostClassTags |
std::map< std::string, cost_class_t > | m_UnitCostClassTags |
std::vector< std::vector< u32 > > | m_MoveCosts |
std::vector< std::vector< fixed > > | m_MoveSpeeds |
std::vector< AsyncLongPathRequest > | m_AsyncLongPathRequests |
std::vector < AsyncShortPathRequest > | m_AsyncShortPathRequests |
u32 | m_NextAsyncTicket |
u16 | m_SameTurnMovesCount |
u16 | m_MapSize |
Grid< TerrainTile > * | m_Grid |
Grid< u8 > * | m_ObstructionGrid |
bool | m_TerrainDirty |
u16 | m_MaxSameTurnMoves |
PathfindTileGrid * | m_DebugGrid |
u32 | m_DebugSteps |
Path * | m_DebugPath |
PathfinderOverlay * | m_DebugOverlay |
pass_class_t | m_DebugPassClass |
std::vector< SOverlayLine > | m_DebugOverlayShortPathLines |
Additional Inherited Members | |
![]() | |
typedef u16 | pass_class_t |
typedef u8 | cost_class_t |
Implementation of ICmpPathfinder.
Definition at line 169 of file CCmpPathfinder_Common.h.
|
inlinestatic |
Definition at line 180 of file CCmpPathfinder_Common.h.
|
virtual |
Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain.
Implements ICmpPathfinder.
Definition at line 707 of file CCmpPathfinder.cpp.
|
virtual |
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.
Definition at line 715 of file CCmpPathfinder.cpp.
|
virtual |
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.
Definition at line 853 of file CCmpPathfinder_Vertex.cpp.
|
virtual |
Check whether a unit placed here is valid and doesn't hit any obstructions or impassable terrain.
Implements ICmpPathfinder.
Definition at line 659 of file CCmpPathfinder.cpp.
|
virtual |
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.
Definition at line 665 of file CCmpPathfinder.cpp.
|
inlinestatic |
Definition at line 172 of file CCmpPathfinder_Common.h.
|
virtual |
Definition at line 366 of file CCmpPathfinder_Tile.cpp.
|
virtual |
Asynchronous version of ComputePath.
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.
Definition at line 545 of file CCmpPathfinder.cpp.
|
virtual |
Definition at line 496 of file CCmpPathfinder_Vertex.cpp.
|
virtual |
Asynchronous version of ComputeShortPath (using ControlGroupObstructionFilter).
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.
Definition at line 552 of file CCmpPathfinder.cpp.
|
inlinestatic |
Definition at line 180 of file CCmpPathfinder_Common.h.
|
virtual |
Implements IComponent.
Definition at line 150 of file CCmpPathfinder.cpp.
|
virtual |
Implements IComponent.
Definition at line 200 of file CCmpPathfinder.cpp.
|
static |
Definition at line 278 of file CCmpPathfinder.cpp.
|
virtual |
Finish computing asynchronous path requests and send the CMessagePathResult messages.
Implements ICmpPathfinder.
Definition at line 559 of file CCmpPathfinder.cpp.
|
virtual |
Get the tag for a given movement cost class name.
Logs an error and returns something acceptable if the name is unrecognised.
Implements ICmpPathfinder.
Definition at line 267 of file CCmpPathfinder.cpp.
|
virtual |
Find the speed factor (typically around 1.0) for a unit of the given cost class at the given position.
Implements ICmpPathfinder.
Definition at line 241 of file CCmpPathfinder.cpp.
|
virtual |
Returns the coordinates of the point on the goal that is closest to pos in a straight line.
Implements ICmpPathfinder.
Definition at line 320 of file CCmpPathfinder_Vertex.cpp.
|
virtual |
Get the tag for a given passability class name.
Logs an error and returns something acceptable if the name is unrecognised.
Implements ICmpPathfinder.
Definition at line 251 of file CCmpPathfinder.cpp.
|
virtual |
Get the list of all known passability classes.
Implements ICmpPathfinder.
Definition at line 262 of file CCmpPathfinder.cpp.
Implements ICmpPathfinder.
Definition at line 301 of file CCmpPathfinder.cpp.
|
inlinestatic |
Definition at line 220 of file CCmpPathfinder_Common.h.
|
virtual |
Reimplemented from IComponent.
Definition at line 210 of file CCmpPathfinder.cpp.
|
virtual |
Implements IComponent.
Definition at line 45 of file CCmpPathfinder.cpp.
|
inline |
Returns the tile containing the given position.
Definition at line 282 of file CCmpPathfinder_Common.h.
void CCmpPathfinder::ProcessLongRequests | ( | const std::vector< AsyncLongPathRequest > & | longRequests | ) |
Definition at line 577 of file CCmpPathfinder.cpp.
|
virtual |
Process moves during the same turn they were created in to improve responsiveness.
Implements ICmpPathfinder.
Definition at line 602 of file CCmpPathfinder.cpp.
void CCmpPathfinder::ProcessShortRequests | ( | const std::vector< AsyncShortPathRequest > & | shortRequests | ) |
Definition at line 589 of file CCmpPathfinder.cpp.
void CCmpPathfinder::RenderSubmit | ( | SceneCollector & | collector | ) |
Definition at line 234 of file CCmpPathfinder.cpp.
|
virtual |
Definition at line 175 of file CCmpPathfinder_Tile.cpp.
|
virtual |
Implements IComponent.
Definition at line 192 of file CCmpPathfinder.cpp.
|
virtual |
Toggle the storage and rendering of debug info.
Implements ICmpPathfinder.
Definition at line 149 of file CCmpPathfinder_Tile.cpp.
|
virtual |
If the debug overlay is enabled, render the path that will computed by ComputePath.
Implements ICmpPathfinder.
Definition at line 162 of file CCmpPathfinder_Tile.cpp.
|
inlinestatic |
Returns the position of the center of the given tile.
Definition at line 291 of file CCmpPathfinder_Common.h.
void CCmpPathfinder::UpdateGrid | ( | ) |
Regenerates the grid based on the current obstruction list, if necessary.
Definition at line 307 of file CCmpPathfinder.cpp.
std::vector<AsyncLongPathRequest> CCmpPathfinder::m_AsyncLongPathRequests |
Definition at line 194 of file CCmpPathfinder_Common.h.
std::vector<AsyncShortPathRequest> CCmpPathfinder::m_AsyncShortPathRequests |
Definition at line 195 of file CCmpPathfinder_Common.h.
PathfindTileGrid* CCmpPathfinder::m_DebugGrid |
Definition at line 212 of file CCmpPathfinder_Common.h.
PathfinderOverlay* CCmpPathfinder::m_DebugOverlay |
Definition at line 215 of file CCmpPathfinder_Common.h.
std::vector<SOverlayLine> CCmpPathfinder::m_DebugOverlayShortPathLines |
Definition at line 218 of file CCmpPathfinder_Common.h.
pass_class_t CCmpPathfinder::m_DebugPassClass |
Definition at line 216 of file CCmpPathfinder_Common.h.
Path* CCmpPathfinder::m_DebugPath |
Definition at line 214 of file CCmpPathfinder_Common.h.
u32 CCmpPathfinder::m_DebugSteps |
Definition at line 213 of file CCmpPathfinder_Common.h.
Grid<TerrainTile>* CCmpPathfinder::m_Grid |
Definition at line 202 of file CCmpPathfinder_Common.h.
u16 CCmpPathfinder::m_MapSize |
Definition at line 201 of file CCmpPathfinder_Common.h.
u16 CCmpPathfinder::m_MaxSameTurnMoves |
Definition at line 208 of file CCmpPathfinder_Common.h.
std::vector<std::vector<u32> > CCmpPathfinder::m_MoveCosts |
Definition at line 189 of file CCmpPathfinder_Common.h.
std::vector<std::vector<fixed> > CCmpPathfinder::m_MoveSpeeds |
Definition at line 190 of file CCmpPathfinder_Common.h.
u32 CCmpPathfinder::m_NextAsyncTicket |
Definition at line 196 of file CCmpPathfinder_Common.h.
Definition at line 203 of file CCmpPathfinder_Common.h.
std::vector<PathfinderPassability> CCmpPathfinder::m_PassClasses |
Definition at line 185 of file CCmpPathfinder_Common.h.
std::map<std::string, pass_class_t> CCmpPathfinder::m_PassClassMasks |
Definition at line 184 of file CCmpPathfinder_Common.h.
u16 CCmpPathfinder::m_SameTurnMovesCount |
Definition at line 197 of file CCmpPathfinder_Common.h.
std::map<std::string, cost_class_t> CCmpPathfinder::m_TerrainCostClassTags |
Definition at line 187 of file CCmpPathfinder_Common.h.
bool CCmpPathfinder::m_TerrainDirty |
Definition at line 204 of file CCmpPathfinder_Common.h.
std::map<std::string, cost_class_t> CCmpPathfinder::m_UnitCostClassTags |
Definition at line 188 of file CCmpPathfinder_Common.h.