18 #ifndef INCLUDED_ICMPOBSTRUCTIONMANAGER 19 #define INCLUDED_ICMPOBSTRUCTIONMANAGER 81 bool valid()
const {
return n != 0; }
267 std::vector<entity_id_t>*
out)
const = 0;
283 std::vector<entity_id_t>*
out)
const = 0;
407 m_AvoidMoving(avoidMoving), m_Group(group)
412 if (group == m_Group || (group2 !=
INVALID_ENTITY && group2 == m_Group))
447 m_Exclude(exclude), m_Group(group1), m_Group2(group2), m_Mask(mask)
453 m_Exclude(false), m_Group(group1), m_Group2(group2), m_Mask(mask)
461 if (group == m_Group || group == m_Group2 || (group2 !=
INVALID_ENTITY &&
462 (group2 == m_Group || group2 == m_Group2)))
468 return (flags & m_Mask) == 0;
471 return (flags & m_Mask) != 0;
507 m_Tag(tag), m_Group(group1), m_Group2(group2), m_Mask(mask)
516 return (tag.
n != m_Tag.
n && (flags & m_Mask) != 0 && ((group == m_Group
517 && group2 == m_Group2) || (group2 == m_Group && group == m_Group2)));
534 return tag.
n != m_Tag.
n;
549 m_Tag(tag), m_Group(group), m_AvoidMoving(avoidMoving)
554 if (tag.n == m_Tag.n)
557 if (group == m_Group || (group2 !=
INVALID_ENTITY && group2 == m_Group))
587 return (tag.n != m_Tag.n && (flags & m_Mask) != 0);
591 #endif // INCLUDED_ICMPOBSTRUCTIONMANAGER flags_t m_Mask
Definition: ICmpObstructionManager.h:579
Definition: IComponent.h:32
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:532
A simple fixed-point number class.
Definition: Fixed.h:119
Obstruction test filter that will test only against shapes that:
Definition: ICmpObstructionManager.h:498
Interface for ICmpObstructionManager Test functions to filter out unwanted shapes.
Definition: ICmpObstructionManager.h:351
entity_pos_t x
Definition: ICmpObstructionManager.h:68
Obstruction test filter that will test only against shapes that:
Definition: ICmpObstructionManager.h:438
u32 n
Definition: ICmpObstructionManager.h:83
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:512
tag_t()
Definition: ICmpObstructionManager.h:79
bool m_AvoidMoving
Definition: ICmpObstructionManager.h:545
Definition: FixedVector2D.h:24
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
Definition: code_annotation.h:38
virtual void SetUnitControlGroup(tag_t tag, entity_id_t group)=0
Set the control group of a unit shape.
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 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 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.
tag_t m_Tag
Definition: ICmpObstructionManager.h:526
Definition: Pathfinding.h:213
bool valid() const
Definition: ICmpObstructionManager.h:81
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.
uint16_t u16
Definition: types.h:38
virtual void UpdateInformations(GridUpdateInformation &informations)=0
Gets dirtiness information and resets it afterwards.
SkipTagObstructionFilter(tag_t tag)
Definition: ICmpObstructionManager.h:528
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.
virtual void SetPassabilityCircular(bool enabled)=0
Set the passability to be restricted to a circular map.
virtual void Init(const CParamNode ¶mNode)=0
bool m_Exclude
Definition: ICmpObstructionManager.h:440
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:585
Obstruction test filter that reject shapes in a given control group, and rejects shapes that don't bl...
Definition: ICmpObstructionManager.h:400
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
static void out(const wchar_t *fmt,...)
Definition: wdbg_sym.cpp:421
ControlGroupMovementObstructionFilter(bool avoidMoving, entity_id_t group)
Definition: ICmpObstructionManager.h:406
Similar to ControlGroupMovementObstructionFilter, but also ignoring a specific tag.
Definition: ICmpObstructionManager.h:541
Definition: ICmpObstructionManager.h:91
SkipControlGroupsRequireFlagObstructionFilter(entity_id_t group1, entity_id_t group2, flags_t mask)
Definition: ICmpObstructionManager.h:452
bool m_AvoidMoving
Definition: ICmpObstructionManager.h:402
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.
entity_id_t m_Group2
Definition: ICmpObstructionManager.h:502
entity_pos_t hh
Definition: ICmpObstructionManager.h:70
Basic 2D array, intended for storing tile data, plus support for lazy updates by ICmpObstructionManag...
Definition: TerritoryBoundary.h:27
tag_t(u32 n)
Definition: ICmpObstructionManager.h:80
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:552
entity_id_t m_Group
Definition: ICmpObstructionManager.h:501
Obstruction test filter that will test against all shapes.
Definition: ICmpObstructionManager.h:375
uint8_t u8
Definition: types.h:37
virtual void GetStaticObstructionsOnObstruction(const ObstructionSquare &square, std::vector< entity_id_t > &out, const IObstructionTestFilter &filter) const =0
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 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...
entity_id_t m_Group2
Definition: ICmpObstructionManager.h:442
Obstruction test filter that will test only against stationary (i.e.
Definition: ICmpObstructionManager.h:387
entity_id_t m_Group
Definition: ICmpObstructionManager.h:543
tag_t m_Tag
Definition: ICmpObstructionManager.h:578
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 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, filtering out using the given filter.
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.
flags_t m_Mask
Definition: ICmpObstructionManager.h:443
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
Definition: debug.h:290
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.
uint32_t u32
Definition: types.h:39
SkipTagAndControlGroupObstructionFilter(tag_t tag, bool avoidMoving, entity_id_t group)
Definition: ICmpObstructionManager.h:548
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:410
entity_pos_t hw
Definition: ICmpObstructionManager.h:70
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 SetUnitMovingFlag(tag_t tag, bool moving)=0
Set whether a unit shape is moving or stationary.
SkipControlGroupsRequireFlagObstructionFilter(bool exclude, entity_id_t group1, entity_id_t group2, flags_t mask)
Definition: ICmpObstructionManager.h:446
Definition: ICmpObstructionManager.h:96
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 SetStaticControlGroup(tag_t tag, entity_id_t group, entity_id_t group2)=0
Sets the control group of a static shape.
u8 flags_t
Bitmask of EFlag values.
Definition: ICmpObstructionManager.h:102
entity_id_t m_Group
Definition: ICmpObstructionManager.h:403
virtual fixed MaxDistanceBetweenShapes(const ObstructionSquare &source, const ObstructionSquare &target) const =0
Calculate the largest straight line distance between the source and the target.
ICmpObstructionManager::flags_t flags_t
Definition: ICmpObstructionManager.h:355
entity_id_t m_Group
Definition: ICmpObstructionManager.h:441
u16 NavcellData
Definition: ICmpObstructionManager.h:32
#define DECLARE_INTERFACE_TYPE(iname)
Definition: Interface.h:23
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:378
tag_t m_Tag
Definition: ICmpObstructionManager.h:544
virtual ~IObstructionTestFilter()
Definition: ICmpObstructionManager.h:357
Definition: ICmpObstructionManager.h:92
Definition: ICmpObstructionManager.h:94
Obstruction test filter that will test only against shapes that:
Definition: ICmpObstructionManager.h:576
void Init()
Definition: ICmpObstructionManager.h:474
tag_t m_Tag
Definition: ICmpObstructionManager.h:500
Obstruction test filter that will test only against shapes that do not have the specified tag set...
Definition: ICmpObstructionManager.h:524
virtual fixed DistanceToTarget(entity_id_t ent, entity_id_t target) const =0
Calculate the shortest distance between the entity and the target.
EFlags
Boolean flags affecting the obstruction behaviour of a shape.
Definition: ICmpObstructionManager.h:89
Definition: ICmpObstructionManager.h:95
virtual fixed DistanceBetweenShapes(const ObstructionSquare &source, const ObstructionSquare &target) const =0
Calculate the shortest straight line distance between the source and the target.
ICmpObstructionManager::tag_t tag_t
Definition: ICmpObstructionManager.h:354
virtual bool GetPassabilityCircular() const =0
entity_pos_t z
Definition: ICmpObstructionManager.h:68
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:458
SkipTagRequireControlGroupsAndFlagObstructionFilter(tag_t tag, entity_id_t group1, entity_id_t group2, flags_t mask)
Definition: ICmpObstructionManager.h:506
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 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 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
const entity_id_t INVALID_ENTITY
Invalid entity ID.
Definition: Entity.h:35
u32 entity_id_t
Entity ID type.
Definition: Entity.h:23
SkipTagRequireFlagsObstructionFilter(tag_t tag, flags_t mask)
Definition: ICmpObstructionManager.h:581
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.
CFixedVector2D u
Definition: ICmpObstructionManager.h:69
Standard representation for all types of shapes, for use with geometry processing code...
Definition: ICmpObstructionManager.h:66
virtual ObstructionSquare GetObstruction(tag_t tag) const =0
Get the obstruction square representing the given shape.
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 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:390
virtual void SetDebugOverlay(bool enabled)=0
Toggle the rendering of debug info.
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.
Obstruction manager: provides efficient spatial queries over objects in the world.
Definition: ICmpObstructionManager.h:60
flags_t m_Mask
Definition: ICmpObstructionManager.h:503
External identifiers for shapes.
Definition: ICmpObstructionManager.h:77
CFixedVector2D v
Definition: ICmpObstructionManager.h:69
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
Definition: ICmpObstructionManager.h:93