18 #ifndef INCLUDED_ICMPOBSTRUCTIONMANAGER
19 #define INCLUDED_ICMPOBSTRUCTIONMANAGER
189 std::vector<entity_id_t>*
out) = 0;
205 std::vector<entity_id_t>*
out) = 0;
340 m_AvoidMoving(avoidMoving), m_Group(group)
345 if (group == m_Group || (group2 !=
INVALID_ENTITY && group2 == m_Group))
377 m_Exclude(exclude), m_Group(group1), m_Group2(group2), m_Mask(mask)
383 m_Exclude(false), m_Group(group1), m_Group2(group2), m_Mask(mask)
391 if (group == m_Group || group == m_Group2 || (group2 !=
INVALID_ENTITY &&
392 (group2 == m_Group || group2 == m_Group2)))
398 return (flags & m_Mask) == 0;
401 return (flags & m_Mask) != 0;
438 m_Tag(tag), m_Group(group1), m_Group2(group2), m_Mask(mask)
447 return (tag.
n != m_Tag.n && (flags & m_Mask) != 0 && ((group == m_Group
448 && group2 == m_Group2) || (group2 == m_Group && group == m_Group2)));
465 return tag.
n != m_Tag.n;
485 return (tag.n != m_Tag.n && (flags & m_Mask) != 0);
489 #endif // INCLUDED_ICMPOBSTRUCTIONMANAGER
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)=0
Collision test a static square shape against the current set of shapes.
A simple fixed-point number class.
Obstruction test filter that will test only against shapes that:
Interface for ICmpObstructionManager Test functions to filter out unwanted shapes.
Obstruction test filter that will test only against shapes that:
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
virtual void SetUnitControlGroup(tag_t tag, entity_id_t group)=0
Set the control group of 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 ObstructionSquare GetStaticShapeObstruction(entity_pos_t x, entity_pos_t z, entity_angle_t a, entity_pos_t w, entity_pos_t h)=0
virtual bool TestUnitShape(const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t r, std::vector< entity_id_t > *out)=0
Collision test a unit shape against the current set of registered shapes, and optionally writes a lis...
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.
SkipTagObstructionFilter(tag_t tag)
virtual void SetPassabilityCircular(bool enabled)=0
Set the passability to be restricted to a circular map.
virtual void Init(const CParamNode ¶mNode)=0
Obstruction test filter that reject shapes in a given control group, and rejects shapes that don't bl...
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)=0
Collision test a flat-ended thick line against the current set of shapes.
static void out(const wchar_t *fmt,...)
ControlGroupMovementObstructionFilter(bool avoidMoving, entity_id_t group)
SkipControlGroupsRequireFlagObstructionFilter(entity_id_t group1, entity_id_t group2, flags_t mask)
virtual ObstructionSquare GetObstruction(tag_t tag)=0
Get the obstruction square representing the given shape.
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.
Obstruction test filter that will test against all shapes.
Obstruction test filter that will test only against stationary (i.e.
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.
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
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)
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.
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.
ICmpObstructionManager::flags_t flags_t
#define DECLARE_INTERFACE_TYPE(iname)
TileObstruction
Bit-flags for Rasterise.
virtual ~IObstructionTestFilter()
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)=0
Find all the obstructions that are inside (or partially inside) the given range.
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.
Obstruction test filter that will test only against shapes that:
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.
virtual ObstructionSquare GetUnitShapeObstruction(entity_pos_t x, entity_pos_t z, entity_pos_t r)=0
Obstruction test filter that will test only against shapes that do not have the specified tag set...
EFlags
Boolean flags affecting the obstruction behaviour of a shape.
ICmpObstructionManager::tag_t tag_t
virtual bool Rasterise(Grid< u8 > &grid)=0
Convert the current set of shapes onto a grid.
SkipTagRequireControlGroupsAndFlagObstructionFilter(tag_t tag, entity_id_t group1, entity_id_t group2, flags_t mask)
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.
virtual bool FindMostImportantObstruction(const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t r, ObstructionSquare &square)=0
Find a single obstruction that blocks a unit at the given point with the given radius.
virtual void RemoveShape(tag_t tag)=0
Remove an existing shape.
const entity_id_t INVALID_ENTITY
Invalid entity ID.
u32 entity_id_t
Entity ID type.
SkipTagRequireFlagsObstructionFilter(tag_t tag, flags_t mask)
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.
Standard representation for all types of shapes, for use with geometry processing code...
virtual void SetDebugOverlay(bool enabled)=0
Toggle the rendering of debug info.
Obstruction manager: provides efficient spatial queries over objects in the world.
External identifiers for shapes.
virtual tag_t AddUnitShape(entity_id_t ent, entity_pos_t x, entity_pos_t z, entity_angle_t r, flags_t flags, entity_id_t group)=0
Register a unit shape.
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const