18#ifndef INCLUDED_ICMPOBSTRUCTIONMANAGER
19#define INCLUDED_ICMPOBSTRUCTIONMANAGER
35template<
typename T>
class Grid;
84 bool valid()
const {
return n != 0; }
272 std::vector<entity_id_t>*
out)
const = 0;
288 std::vector<entity_id_t>*
out)
const = 0;
473 return (flags &
m_Mask) == 0;
476 return (flags &
m_Mask) != 0;
std::uint16_t NavcellData
Definition: ICmpObstructionManager.h:37
Definition: FixedVector2D.h:25
A simple fixed-point number class.
Definition: Fixed.h:129
Obstruction test filter that reject shapes in a given control group, and rejects shapes that don't bl...
Definition: ICmpObstructionManager.h:406
ControlGroupMovementObstructionFilter(bool avoidMoving, entity_id_t group)
Definition: ICmpObstructionManager.h:411
virtual bool TestShape(tag_t, flags_t flags, entity_id_t group, entity_id_t group2) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:415
entity_id_t m_Group
Definition: ICmpObstructionManager.h:408
bool m_AvoidMoving
Definition: ICmpObstructionManager.h:407
Basic 2D array, intended for storing tile data, plus support for lazy updates by ICmpObstructionManag...
Definition: Grid.h:46
Obstruction manager: provides efficient spatial queries over objects in the world.
Definition: ICmpObstructionManager.h:64
virtual void SetDebugOverlay(bool enabled)=0
Toggle the rendering of debug info.
virtual bool IsPointInPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t px, entity_pos_t pz, entity_pos_t minRange, entity_pos_t maxRange) const =0
Check if the given point is in range of the other point given those parameters.
virtual void GetStaticObstructionsInRange(const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector< ObstructionSquare > &squares) const =0
virtual void Rasterize(Grid< NavcellData > &grid, const std::vector< PathfinderPassability > &passClasses, bool fullUpdate)=0
Convert the current set of shapes onto a navcell grid, for all passability classes contained in passC...
EFlags
Boolean flags affecting the obstruction behaviour of a shape.
Definition: ICmpObstructionManager.h:93
@ FLAG_BLOCK_CONSTRUCTION
Definition: ICmpObstructionManager.h:96
@ FLAG_BLOCK_FOUNDATION
Definition: ICmpObstructionManager.h:95
@ FLAG_BLOCK_PATHFINDING
Definition: ICmpObstructionManager.h:97
@ FLAG_BLOCK_MOVEMENT
Definition: ICmpObstructionManager.h:94
@ FLAG_MOVING
Definition: ICmpObstructionManager.h:98
@ FLAG_DELETE_UPON_CONSTRUCTION
Definition: ICmpObstructionManager.h:99
virtual fixed DistanceToTarget(entity_id_t ent, entity_id_t target) const =0
Calculate the shortest distance between the entity and the target.
virtual bool IsInTargetRange(entity_id_t ent, entity_id_t target, entity_pos_t minRange, entity_pos_t maxRange, bool opposite) const =0
Check if the given entity is in range of the target given those parameters.
std::uint8_t flags_t
Bitmask of EFlag values.
Definition: ICmpObstructionManager.h:105
virtual void RemoveShape(tag_t tag)=0
Remove an existing shape.
virtual ObstructionSquare GetUnitShapeObstruction(entity_pos_t x, entity_pos_t z, entity_pos_t clearance) const =0
virtual void GetObstructionsInRange(const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector< ObstructionSquare > &squares) const =0
Find all the obstructions that are inside (or partially inside) the given range.
virtual fixed MaxDistanceBetweenShapes(const ObstructionSquare &source, const ObstructionSquare &target) const =0
Calculate the largest straight line distance between the source and the target.
virtual void SetUnitMovingFlag(tag_t tag, bool moving)=0
Set whether a unit shape is moving or stationary.
virtual void MoveShape(tag_t tag, entity_pos_t x, entity_pos_t z, entity_angle_t a)=0
Adjust the position and angle of an existing shape.
virtual bool IsInPointRange(entity_id_t ent, entity_pos_t px, entity_pos_t pz, entity_pos_t minRange, entity_pos_t maxRange, bool opposite) const =0
Check if the given entity is in range of the other point given those parameters.
virtual bool TestStaticShape(const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t a, entity_pos_t w, entity_pos_t h, std::vector< entity_id_t > *out) const =0
Collision test a static square shape against the current set of shapes.
virtual bool TestUnitLine(const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r, bool relaxClearanceForUnits) const =0
virtual void SetPassabilityCircular(bool enabled)=0
Set the passability to be restricted to a circular map.
virtual void UpdateInformations(GridUpdateInformation &informations)=0
Gets dirtiness information and resets it afterwards.
virtual void GetUnitsOnObstruction(const ObstructionSquare &square, std::vector< entity_id_t > &out, const IObstructionTestFilter &filter, bool strict=false) const =0
Returns the entity IDs of all unit shapes that intersect the given obstruction square,...
virtual void SetStaticControlGroup(tag_t tag, entity_id_t group, entity_id_t group2)=0
Sets the control group of a static shape.
virtual ObstructionSquare GetObstruction(tag_t tag) const =0
Get the obstruction square representing the given shape.
virtual bool AreShapesInRange(const ObstructionSquare &source, const ObstructionSquare &target, entity_pos_t minRange, entity_pos_t maxRange, bool opposite) const =0
Check if the given shape is in range of the target shape given those parameters.
virtual void GetUnitObstructionsInRange(const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector< ObstructionSquare > &squares) const =0
virtual tag_t AddUnitShape(entity_id_t ent, entity_pos_t x, entity_pos_t z, entity_pos_t clearance, flags_t flags, entity_id_t group)=0
Register a unit shape.
virtual tag_t AddStaticShape(entity_id_t ent, entity_pos_t x, entity_pos_t z, entity_angle_t a, entity_pos_t w, entity_pos_t h, flags_t flags, entity_id_t group, entity_id_t group2=INVALID_ENTITY)=0
Register a static shape.
virtual bool TestLine(const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r, bool relaxClearanceForUnits) const =0
Collision test a flat-ended thick line against the current set of shapes.
virtual void SetBounds(entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1)=0
Set the bounds of the world.
virtual void SetUnitControlGroup(tag_t tag, entity_id_t group)=0
Set the control group of a unit shape.
virtual bool IsInTargetParabolicRange(entity_id_t ent, entity_id_t target, entity_pos_t minRange, entity_pos_t maxRange, entity_pos_t yOrigin, bool opposite) const =0
Check if the given entity is in parabolic range of the target given those parameters.
virtual fixed DistanceToPoint(entity_id_t ent, entity_pos_t px, entity_pos_t pz) const =0
Returns the distance from the obstruction to the point (px, pz), or -1 if the entity is out of the wo...
virtual fixed MaxDistanceToTarget(entity_id_t ent, entity_id_t target) const =0
Calculate the largest straight line distance between the entity and the target.
virtual bool TestUnitShape(const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t clearance, std::vector< entity_id_t > *out) const =0
Collision test a unit shape against the current set of registered shapes, and optionally writes a lis...
virtual fixed MaxDistanceToPoint(entity_id_t ent, entity_pos_t px, entity_pos_t pz) const =0
Calculate the largest straight line distance between the entity and the point.
virtual ObstructionSquare GetStaticShapeObstruction(entity_pos_t x, entity_pos_t z, entity_angle_t a, entity_pos_t w, entity_pos_t h) const =0
virtual fixed DistanceBetweenShapes(const ObstructionSquare &source, const ObstructionSquare &target) const =0
Calculate the shortest straight line distance between the source and the target.
virtual void GetStaticObstructionsOnObstruction(const ObstructionSquare &square, std::vector< entity_id_t > &out, const IObstructionTestFilter &filter) const =0
virtual bool GetPassabilityCircular() const =0
Definition: IComponent.h:33
Interface for ICmpObstructionManager Test functions to filter out unwanted shapes.
Definition: ICmpObstructionManager.h:357
ICmpObstructionManager::tag_t tag_t
Definition: ICmpObstructionManager.h:359
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const =0
Return true if the shape with the specified parameters should be tested for collisions.
ICmpObstructionManager::flags_t flags_t
Definition: ICmpObstructionManager.h:360
virtual ~IObstructionTestFilter()
Definition: ICmpObstructionManager.h:362
Obstruction test filter that will test against all shapes.
Definition: ICmpObstructionManager.h:381
virtual bool TestShape(tag_t, flags_t, entity_id_t, entity_id_t) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:383
Definition: Pathfinding.h:219
Obstruction test filter that will test only against shapes that:
Definition: ICmpObstructionManager.h:444
void Init()
Definition: ICmpObstructionManager.h:479
bool m_Exclude
Definition: ICmpObstructionManager.h:445
SkipControlGroupsRequireFlagObstructionFilter(bool exclude, entity_id_t group1, entity_id_t group2, flags_t mask)
Definition: ICmpObstructionManager.h:451
flags_t m_Mask
Definition: ICmpObstructionManager.h:448
virtual bool TestShape(tag_t, flags_t flags, entity_id_t group, entity_id_t group2) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:463
SkipControlGroupsRequireFlagObstructionFilter(entity_id_t group1, entity_id_t group2, flags_t mask)
Definition: ICmpObstructionManager.h:457
entity_id_t m_Group2
Definition: ICmpObstructionManager.h:447
entity_id_t m_Group
Definition: ICmpObstructionManager.h:446
Similar to ControlGroupMovementObstructionFilter, but also ignoring a specific tag.
Definition: ICmpObstructionManager.h:547
SkipTagAndControlGroupObstructionFilter(tag_t tag, bool avoidMoving, entity_id_t group)
Definition: ICmpObstructionManager.h:553
bool m_AvoidMoving
Definition: ICmpObstructionManager.h:550
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:557
tag_t m_Tag
Definition: ICmpObstructionManager.h:549
entity_id_t m_Group
Definition: ICmpObstructionManager.h:548
Obstruction test filter that will test only against shapes that do not have the specified tag set.
Definition: ICmpObstructionManager.h:530
virtual bool TestShape(tag_t tag, flags_t, entity_id_t, entity_id_t) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:537
SkipTagObstructionFilter(tag_t tag)
Definition: ICmpObstructionManager.h:533
tag_t m_Tag
Definition: ICmpObstructionManager.h:531
Obstruction test filter that will test only against shapes that:
Definition: ICmpObstructionManager.h:504
flags_t m_Mask
Definition: ICmpObstructionManager.h:508
entity_id_t m_Group2
Definition: ICmpObstructionManager.h:507
SkipTagRequireControlGroupsAndFlagObstructionFilter(tag_t tag, entity_id_t group1, entity_id_t group2, flags_t mask)
Definition: ICmpObstructionManager.h:511
entity_id_t m_Group
Definition: ICmpObstructionManager.h:506
tag_t m_Tag
Definition: ICmpObstructionManager.h:505
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:517
Obstruction test filter that will test only against shapes that:
Definition: ICmpObstructionManager.h:582
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t, entity_id_t) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:590
SkipTagRequireFlagsObstructionFilter(tag_t tag, flags_t mask)
Definition: ICmpObstructionManager.h:586
flags_t m_Mask
Definition: ICmpObstructionManager.h:584
tag_t m_Tag
Definition: ICmpObstructionManager.h:583
Obstruction test filter that will test only against stationary (i.e.
Definition: ICmpObstructionManager.h:393
virtual bool TestShape(tag_t, flags_t flags, entity_id_t, entity_id_t) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:395
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
Definition: debug.h:222
const entity_id_t INVALID_ENTITY
Invalid entity ID.
Definition: Entity.h:35
std::uint32_t entity_id_t
Entity ID type.
Definition: Entity.h:29
#define DECLARE_INTERFACE_TYPE(iname)
Definition: Interface.h:23
Standard representation for all types of shapes, for use with geometry processing code.
Definition: ICmpObstructionManager.h:70
CFixedVector2D u
Definition: ICmpObstructionManager.h:72
entity_pos_t z
Definition: ICmpObstructionManager.h:71
entity_pos_t hw
Definition: ICmpObstructionManager.h:73
entity_pos_t hh
Definition: ICmpObstructionManager.h:73
entity_pos_t x
Definition: ICmpObstructionManager.h:71
CFixedVector2D v
Definition: ICmpObstructionManager.h:72
External identifiers for shapes.
Definition: ICmpObstructionManager.h:81
tag_t(std::uint32_t n)
Definition: ICmpObstructionManager.h:83
std::uint32_t n
Definition: ICmpObstructionManager.h:86
bool valid() const
Definition: ICmpObstructionManager.h:84
tag_t()
Definition: ICmpObstructionManager.h:82
static void out(const wchar_t *fmt,...)
Definition: wdbg_sym.cpp:407