18 #ifndef INCLUDED_CCMPPATHFINDER_COMMON 19 #define INCLUDED_CCMPPATHFINDER_COMMON 45 #define PATHFIND_DEBUG 0 47 #define PATHFIND_DEBUG 1 159 bool m_PreserveUpdateInformations;
187 static
std::
string GetSchema()
189 return "<a:component type='system'/><empty/>";
194 virtual void Deinit();
197 void SerializeCommon(S& serialize);
203 virtual void HandleMessage(
const CMessage& msg,
bool global);
205 virtual pass_class_t GetPassabilityClass(
const std::string& name)
const;
207 virtual void GetPassabilityClasses(std::map<std::string, pass_class_t>& passClasses)
const;
208 virtual void GetPassabilityClasses(
209 std::map<std::string, pass_class_t>& nonPathfindingPassClasses,
210 std::map<std::string, pass_class_t>& pathfindingPassClasses)
const;
228 if (passability.m_Clearance > max)
229 max = passability.m_Clearance;
238 virtual Grid<u16> ComputeShoreGrid(
bool expandOnWater =
false);
242 m_LongPathfinder.ComputePath(x0, z0, goal, passClass, ret);
253 m_LongPathfinder.SetDebugPath(x0, z0, goal, passClass);
258 m_DebugOverlay = enabled;
259 m_LongPathfinder.SetDebugOverlay(enabled);
264 m_LongPathfinder.SetHierDebugOverlay(enabled, &GetSimContext());
269 m_LongPathfinder.GetDebugData(steps, time, grid);
272 virtual void SetAtlasOverlay(
bool enable,
pass_class_t passClass = 0);
282 virtual void FinishAsyncRequests();
284 void ProcessLongRequests(
const std::vector<AsyncLongPathRequest>& longRequests);
286 void ProcessShortRequests(
const std::vector<AsyncShortPathRequest>& shortRequests);
288 virtual void ProcessSameTurnMoves();
293 virtual void UpdateGrid();
299 void MinimalTerrainUpdate();
305 void TerrainUpdateHelper(
bool expandPassability =
true);
325 for (
size_t j = 0; j < h; ++j)
327 for (
size_t i = 0; i < w; ++i)
342 #endif // INCLUDED_CCMPPATHFINDER_COMMON An entity initialisation parameter node.
Definition: ParamNode.h:148
void SubscribeToMessageType(MessageTypeId mtid)
Subscribe the current component type to the given message type.
Definition: ComponentManager.cpp:574
A simple fixed-point number class.
Definition: Fixed.h:115
virtual entity_pos_t GetClearance(pass_class_t passClass) const
Definition: CCmpPathfinder_Common.h:214
Interface for ICmpObstructionManager Test functions to filter out unwanted shapes.
Definition: ICmpObstructionManager.h:282
pass_class_t m_PassClass
Definition: CCmpPathfinder_Common.h:314
static void ClassInit(CComponentManager &componentManager)
Definition: CCmpPathfinder_Common.h:124
u8 G
Definition: SColor.h:33
CFixedVector2D p0
Definition: CCmpPathfinder_Common.h:114
Implementation of ICmpPathfinder.
Definition: CCmpPathfinder_Common.h:121
Definition: FixedVector2D.h:24
u32 ticket
Definition: CCmpPathfinder_Common.h:53
Definition: CCmpPathfinder_Common.h:81
u16 pass_class_t
Definition: Pathfinding.h:29
const entity_pos_t CLEARANCE_EXTENSION_RADIUS
To make sure the long-range pathfinder is more strict than the short-range one, we need to slightly o...
Definition: Pathfinding.h:139
Line-based overlay, with world-space coordinates, rendered in the world potentially behind other obje...
Definition: Overlay.h:35
u32 ticket
Definition: CCmpPathfinder_Common.h:63
static CFixed Zero()
Definition: Fixed.h:127
u8 status
Definition: CCmpPathfinder_Common.h:89
Definition: Pathfinding.h:105
Definition: Pathfinding.h:287
Returned path.
Definition: Pathfinding.h:40
uint16_t u16
Definition: types.h:38
const CCmpPathfinder * m_Pathfinder
Definition: CCmpPathfinder_Common.h:313
Serialization interface; see serialization overview.
Definition: ISerializer.h:120
static Status Init()
Definition: h_mgr.cpp:744
Definition: Components.h:64
#define IS_PASSABLE(item, classmask)
Definition: Pathfinding.h:101
virtual void SetDebugPath(entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass)
If the debug overlay is enabled, render the path that will computed by ComputePath.
Definition: CCmpPathfinder_Common.h:251
Definition: CCmpPathfinder_Common.h:51
CFixedVector2D p
Definition: CCmpPathfinder_Common.h:86
pass_class_t passClass
Definition: CCmpPathfinder_Common.h:57
Definition: unique_range.h:196
Pathfinder goal.
Definition: PathGoal.h:32
Basic 2D array, intended for storing tile data, plus support for lazy updates by ICmpObstructionManag...
Definition: ICmpPathfinder.h:34
EFoundationCheck
Definition: ICmpObstruction.h:33
Definition: CCmpPathfinder_Common.h:96
u8 B
Definition: SColor.h:34
Definition: Components.h:83
uint8_t u8
Definition: types.h:37
Pathfinder algorithms.
Definition: ICmpPathfinder.h:49
CFixedVector2D p1
Definition: CCmpPathfinder_Common.h:106
virtual void BuildTextureRGBA(u8 *data, size_t w, size_t h)
Called each frame to generate the texture to render on the terrain.
Definition: CCmpPathfinder_Common.h:321
This interface accepts renderable objects.
Definition: Scene.h:83
u8 A
Definition: SColor.h:35
Definition: CCmpPathfinder_Common.h:112
Definition: LongPathfinder.h:161
virtual void ComputePath(entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass, WaypointPath &ret)
Compute a tile-based path from the given point to the goal, and return the set of waypoints...
Definition: CCmpPathfinder_Common.h:240
Definition: Components.h:70
uint32_t u32
Definition: types.h:39
const int NAVCELLS_PER_TILE
The long-range pathfinder operates primarily over a navigation grid (a uniform-cost 2D passability gr...
Definition: Pathfinding.h:117
Definition: CCmpPathfinder_Common.h:61
bool avoidMovingUnits
Definition: CCmpPathfinder_Common.h:70
entity_pos_t x0
Definition: CCmpPathfinder_Common.h:54
Definition: ComponentManager.h:40
Grid< NavcellData > * m_TerrainOnlyGrid
Definition: CCmpPathfinder_Common.h:152
fixed c1
Definition: CCmpPathfinder_Common.h:115
fixed m_Clearance
Definition: Pathfinding.h:366
Definition: Components.h:84
Definition: Components.h:81
Definition: CCmpPathfinder_Common.h:83
virtual entity_pos_t GetMaximumClearance() const
Get the larger clearance in all passability classes.
Definition: CCmpPathfinder_Common.h:223
CFixedVector2D p1
Definition: CCmpPathfinder_Common.h:98
virtual void SetDebugOverlay(bool enabled)
Toggle the storage and rendering of debug info.
Definition: CCmpPathfinder_Common.h:256
#define DEFAULT_COMPONENT_ALLOCATOR(cname)
Definition: Component.h:44
u8 R
Definition: SColor.h:32
Definition: CCmpPathfinder_Common.h:310
virtual void SetHierDebugOverlay(bool enabled)
Toggle the storage and rendering of debug info for the hierarchical pathfinder.
Definition: CCmpPathfinder_Common.h:262
entity_pos_t z0
Definition: CCmpPathfinder_Common.h:55
Definition: CCmpPathfinder_Common.h:77
Definition: Components.h:65
entity_pos_t z0
Definition: CCmpPathfinder_Common.h:65
PathGoal goal
Definition: CCmpPathfinder_Common.h:68
entity_pos_t x0
Definition: CCmpPathfinder_Common.h:64
u16 NavcellData
Definition: Pathfinding.h:100
entity_pos_t range
Definition: CCmpPathfinder_Common.h:67
fixed h
Definition: CCmpPathfinder_Common.h:87
T & get(int i, int j) const
Definition: Grid.h:117
Base class for texture-based terrain overlays, with an arbitrary number of texels per terrain tile...
Definition: TerrainOverlay.h:174
u16 pred
Definition: CCmpPathfinder_Common.h:88
entity_id_t notify
Definition: CCmpPathfinder_Common.h:58
pass_class_t passClass
Definition: CCmpPathfinder_Common.h:69
entity_id_t notify
Definition: CCmpPathfinder_Common.h:72
AtlasOverlay(const CCmpPathfinder *pathfinder, pass_class_t passClass)
Definition: CCmpPathfinder_Common.h:316
entity_pos_t clearance
Definition: CCmpPathfinder_Common.h:66
virtual void GetDebugData(u32 &steps, double &time, Grid< u8 > &grid) const
Returns some stats about the last ComputePath.
Definition: CCmpPathfinder_Common.h:267
u32 entity_id_t
Entity ID type.
Definition: Entity.h:23
Definition: CCmpPathfinder_Common.h:104
PathGoal goal
Definition: CCmpPathfinder_Common.h:56
entity_id_t group
Definition: CCmpPathfinder_Common.h:71
Definition: CCmpPathfinder_Common.h:82
Deserialization interface; see serialization overview.
Definition: IDeserializer.h:34