Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
CCmpObstruction Class Reference

Obstruction implementation. More...

Inheritance diagram for CCmpObstruction:
ICmpObstruction IComponent

Classes

struct  SerializeTag
 
struct  Shape
 

Public Types

enum  { STATIC, UNIT, CLUSTER }
 
typedef
ICmpObstructionManager::tag_t 
tag_t
 
typedef
ICmpObstructionManager::flags_t 
flags_t
 
- Public Types inherited from ICmpObstruction
enum  EFoundationCheck {
  FOUNDATION_CHECK_SUCCESS, FOUNDATION_CHECK_FAIL_ERROR, FOUNDATION_CHECK_FAIL_NO_OBSTRUCTION, FOUNDATION_CHECK_FAIL_OBSTRUCTS_FOUNDATION,
  FOUNDATION_CHECK_FAIL_TERRAIN_CLASS
}
 

Public Member Functions

virtual void Init (const CParamNode &paramNode)
 
virtual void Deinit ()
 
template<typename S >
void SerializeCommon (S &serialize)
 
virtual void Serialize (ISerializer &serialize)
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
virtual void SetActive (bool active)
 
virtual void SetDisableBlockMovementPathfinding (bool movementDisabled, bool pathfindingDisabled, int32_t shape)
 
virtual bool GetBlockMovementFlag ()
 
virtual
ICmpObstructionManager::tag_t 
GetObstruction ()
 
virtual bool GetObstructionSquare (ICmpObstructionManager::ObstructionSquare &out)
 Gets the square corresponding to this obstruction shape. More...
 
virtual entity_pos_t GetUnitRadius ()
 
virtual bool IsControlPersistent ()
 
virtual EFoundationCheck CheckFoundation (std::string className)
 Test whether this entity is colliding with any obstruction that are set to block the creation of foundations. More...
 
virtual EFoundationCheck CheckFoundation (std::string className, bool onlyCenterPoint)
 
virtual bool CheckDuplicateFoundation ()
 Test whether this entity is colliding with any obstructions that share its control groups and block the creation of foundations. More...
 
virtual std::vector< entity_id_tGetEntityCollisions (bool checkStructures, bool checkUnits)
 Returns a list of entities that are colliding with this entity, filtered depending on type of entities that are requested. More...
 
virtual void SetMovingFlag (bool enabled)
 
virtual void SetControlGroup (entity_id_t group)
 Change the control group that the entity belongs to. More...
 
virtual void SetControlGroup2 (entity_id_t group2)
 
virtual entity_id_t GetControlGroup ()
 See SetControlGroup. More...
 
virtual entity_id_t GetControlGroup2 ()
 
void UpdateControlGroups ()
 
void ResolveFoundationCollisions ()
 Detects collisions between foundation-blocking entities and tries to fix them by setting control groups, if appropriate. More...
 
- Public Member Functions inherited from ICmpObstruction
virtual std::string CheckFoundation_wrapper (std::string className, bool onlyCenterPoint)
 CheckFoundation wrapper for script calls, to return friendly strings instead of an EFoundationCheck. More...
 
- Public Member Functions inherited from IComponent
virtual ~IComponent ()
 
CEntityHandle GetEntityHandle () const
 
void SetEntityHandle (CEntityHandle ent)
 
entity_id_t GetEntityId () const
 
CEntityHandle GetSystemEntity () const
 
const CSimContextGetSimContext () const
 
void SetSimContext (const CSimContext &context)
 
virtual JSClass * GetJSClass () const
 
virtual jsval GetJSInstance () const
 

Static Public Member Functions

static void ClassInit (CComponentManager &componentManager)
 
static IComponentAllocate (ScriptInterface &, jsval)
 
static void Deallocate (IComponent *cmp)
 
static std::string GetSchema ()
 
- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static u8 GetSerializationVersion ()
 

Public Attributes

enum CCmpObstruction:: { ... }  m_Type
 
entity_pos_t m_Size0
 
entity_pos_t m_Size1
 
flags_t m_TemplateFlags
 
std::vector< Shapem_Shapes
 
bool m_Active
 Whether the obstruction is actively obstructing or just an inactive placeholder. More...
 
bool m_Moving
 Whether the entity associated with this obstruction is currently moving. More...
 
bool m_ControlPersist
 Whether an obstruction's control group should be kept consistent and used to set control groups for entities that collide with it. More...
 
entity_id_t m_ControlGroup
 Primary control group identifier. More...
 
entity_id_t m_ControlGroup2
 Optional secondary control group identifier. More...
 
tag_t m_Tag
 Identifier of this entity's obstruction shape, as registered in the obstruction manager. More...
 
std::vector< tag_tm_ClusterTags
 
flags_t m_Flags
 Set of flags affecting the behaviour of this entity's obstruction shape. More...
 

Protected Member Functions

void AddClusterShapes (entity_pos_t x, entity_pos_t z, entity_angle_t a)
 
void RemoveClusterShapes ()
 

Detailed Description

Obstruction implementation.

This keeps the ICmpPathfinder's model of the world updated when the entities move and die, with shapes derived from ICmpFootprint.

Definition at line 36 of file CCmpObstruction.cpp.

Member Typedef Documentation

Definition at line 48 of file CCmpObstruction.cpp.

Definition at line 47 of file CCmpObstruction.cpp.

Member Enumeration Documentation

anonymous enum
Enumerator
STATIC 
UNIT 
CLUSTER 

Definition at line 52 of file CCmpObstruction.cpp.

Member Function Documentation

void CCmpObstruction::AddClusterShapes ( entity_pos_t  x,
entity_pos_t  z,
entity_angle_t  a 
)
inlineprotected

Definition at line 751 of file CCmpObstruction.cpp.

static IComponent* CCmpObstruction::Allocate ( ScriptInterface ,
jsval   
)
inlinestatic

Definition at line 45 of file CCmpObstruction.cpp.

virtual bool CCmpObstruction::CheckDuplicateFoundation ( )
inlinevirtual

Test whether this entity is colliding with any obstructions that share its control groups and block the creation of foundations.

Returns
true if foundation is valid (not obstructed)

Implements ICmpObstruction.

Definition at line 523 of file CCmpObstruction.cpp.

virtual EFoundationCheck CCmpObstruction::CheckFoundation ( std::string  className)
inlinevirtual

Test whether this entity is colliding with any obstruction that are set to block the creation of foundations.

Parameters
ignoredEntitiesList of entities to ignore during the test.
Returns
FOUNDATION_CHECK_SUCCESS if check passes, else an EFoundationCheck value describing the type of failure.

Implements ICmpObstruction.

Definition at line 481 of file CCmpObstruction.cpp.

virtual EFoundationCheck CCmpObstruction::CheckFoundation ( std::string  className,
bool  onlyCenterPoint 
)
inlinevirtual

Implements ICmpObstruction.

Definition at line 486 of file CCmpObstruction.cpp.

static void CCmpObstruction::ClassInit ( CComponentManager componentManager)
inlinestatic

Definition at line 39 of file CCmpObstruction.cpp.

static void CCmpObstruction::Deallocate ( IComponent cmp)
inlinestatic

Definition at line 45 of file CCmpObstruction.cpp.

virtual void CCmpObstruction::Deinit ( )
inlinevirtual

Implements IComponent.

Definition at line 243 of file CCmpObstruction.cpp.

virtual void CCmpObstruction::Deserialize ( const CParamNode paramNode,
IDeserializer deserialize 
)
inlinevirtual

Implements IComponent.

Definition at line 274 of file CCmpObstruction.cpp.

virtual bool CCmpObstruction::GetBlockMovementFlag ( )
inlinevirtual

Implements ICmpObstruction.

Definition at line 435 of file CCmpObstruction.cpp.

virtual entity_id_t CCmpObstruction::GetControlGroup ( )
inlinevirtual

See SetControlGroup.

Implements ICmpObstruction.

Definition at line 641 of file CCmpObstruction.cpp.

virtual entity_id_t CCmpObstruction::GetControlGroup2 ( )
inlinevirtual

Implements ICmpObstruction.

Definition at line 646 of file CCmpObstruction.cpp.

virtual std::vector<entity_id_t> CCmpObstruction::GetEntityCollisions ( bool  checkStructures,
bool  checkUnits 
)
inlinevirtual

Returns a list of entities that are colliding with this entity, filtered depending on type of entities that are requested.

Returns
vector of blocking entities

Implements ICmpObstruction.

Definition at line 555 of file CCmpObstruction.cpp.

virtual ICmpObstructionManager::tag_t CCmpObstruction::GetObstruction ( )
inlinevirtual

Implements ICmpObstruction.

Definition at line 440 of file CCmpObstruction.cpp.

virtual bool CCmpObstruction::GetObstructionSquare ( ICmpObstructionManager::ObstructionSquare out)
inlinevirtual

Gets the square corresponding to this obstruction shape.

Returns
true and updates out on success; false on failure (e.g. object not in the world).

Implements ICmpObstruction.

Definition at line 445 of file CCmpObstruction.cpp.

static std::string CCmpObstruction::GetSchema ( )
inlinestatic

Definition at line 107 of file CCmpObstruction.cpp.

virtual entity_pos_t CCmpObstruction::GetUnitRadius ( )
inlinevirtual

Implements ICmpObstruction.

Definition at line 468 of file CCmpObstruction.cpp.

virtual void CCmpObstruction::HandleMessage ( const CMessage msg,
bool  global 
)
inlinevirtual

Reimplemented from IComponent.

Definition at line 281 of file CCmpObstruction.cpp.

virtual void CCmpObstruction::Init ( const CParamNode paramNode)
inlinevirtual

Implements IComponent.

Definition at line 178 of file CCmpObstruction.cpp.

virtual bool CCmpObstruction::IsControlPersistent ( )
inlinevirtual

Implements ICmpObstruction.

Definition at line 476 of file CCmpObstruction.cpp.

void CCmpObstruction::RemoveClusterShapes ( )
inlineprotected

Definition at line 777 of file CCmpObstruction.cpp.

void CCmpObstruction::ResolveFoundationCollisions ( )
inlinevirtual

Detects collisions between foundation-blocking entities and tries to fix them by setting control groups, if appropriate.

Implements ICmpObstruction.

Definition at line 678 of file CCmpObstruction.cpp.

virtual void CCmpObstruction::Serialize ( ISerializer serialize)
inlinevirtual

Implements IComponent.

Definition at line 269 of file CCmpObstruction.cpp.

template<typename S >
void CCmpObstruction::SerializeCommon ( S &  serialize)
inline

Definition at line 257 of file CCmpObstruction.cpp.

virtual void CCmpObstruction::SetActive ( bool  active)
inlinevirtual

Implements ICmpObstruction.

Definition at line 353 of file CCmpObstruction.cpp.

virtual void CCmpObstruction::SetControlGroup ( entity_id_t  group)
inlinevirtual

Change the control group that the entity belongs to.

Control groups are used to let units ignore collisions with other units from the same group. Default is the entity's own ID.

Implements ICmpObstruction.

Definition at line 629 of file CCmpObstruction.cpp.

virtual void CCmpObstruction::SetControlGroup2 ( entity_id_t  group2)
inlinevirtual

Implements ICmpObstruction.

Definition at line 635 of file CCmpObstruction.cpp.

virtual void CCmpObstruction::SetDisableBlockMovementPathfinding ( bool  movementDisabled,
bool  pathfindingDisabled,
int32_t  shape 
)
inlinevirtual

Implements ICmpObstruction.

Definition at line 405 of file CCmpObstruction.cpp.

virtual void CCmpObstruction::SetMovingFlag ( bool  enabled)
inlinevirtual

Implements ICmpObstruction.

Definition at line 617 of file CCmpObstruction.cpp.

void CCmpObstruction::UpdateControlGroups ( )
inline

Definition at line 651 of file CCmpObstruction.cpp.

Member Data Documentation

bool CCmpObstruction::m_Active

Whether the obstruction is actively obstructing or just an inactive placeholder.

Definition at line 74 of file CCmpObstruction.cpp.

std::vector<tag_t> CCmpObstruction::m_ClusterTags

Definition at line 102 of file CCmpObstruction.cpp.

entity_id_t CCmpObstruction::m_ControlGroup

Primary control group identifier.

Indicates to which control group this entity's shape belongs. Typically used in combination with obstruction test filters to have member shapes ignore each other during obstruction tests. Defaults to the entity's ID. Must never be set to INVALID_ENTITY.

Definition at line 87 of file CCmpObstruction.cpp.

entity_id_t CCmpObstruction::m_ControlGroup2

Optional secondary control group identifier.

Similar to m_ControlGroup; if set to a valid value, then this field identifies an additional, secondary control group to which this entity's shape belongs. Set to INVALID_ENTITY to not assign any secondary group. Defaults to INVALID_ENTITY.

These are only necessary in case it is not sufficient for an entity to belong to only one control group. Otherwise, they can be ignored.

Definition at line 97 of file CCmpObstruction.cpp.

bool CCmpObstruction::m_ControlPersist

Whether an obstruction's control group should be kept consistent and used to set control groups for entities that collide with it.

Definition at line 80 of file CCmpObstruction.cpp.

flags_t CCmpObstruction::m_Flags

Set of flags affecting the behaviour of this entity's obstruction shape.

Definition at line 105 of file CCmpObstruction.cpp.

bool CCmpObstruction::m_Moving

Whether the entity associated with this obstruction is currently moving.

Only applicable for UNIT-type obstructions.

Definition at line 77 of file CCmpObstruction.cpp.

std::vector<Shape> CCmpObstruction::m_Shapes

Definition at line 69 of file CCmpObstruction.cpp.

entity_pos_t CCmpObstruction::m_Size0

Definition at line 58 of file CCmpObstruction.cpp.

entity_pos_t CCmpObstruction::m_Size1

Definition at line 59 of file CCmpObstruction.cpp.

tag_t CCmpObstruction::m_Tag

Identifier of this entity's obstruction shape, as registered in the obstruction manager.

Contains structure, but should be treated as opaque here.

Definition at line 101 of file CCmpObstruction.cpp.

flags_t CCmpObstruction::m_TemplateFlags

Definition at line 60 of file CCmpObstruction.cpp.

enum { ... } CCmpObstruction::m_Type

The documentation for this class was generated from the following file: