SimpleAI
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ai::ICondition Class Referenceabstract

A condition can be placed on a TreeNode to decide which node is going to get executed. In general they are stateless. If they are not, it should explicitly get noted. More...

#include <ICondition.h>

Inheritance diagram for ai::ICondition:
[legend]
Collaboration diagram for ai::ICondition:
[legend]

Public Member Functions

 ICondition (const std::string &name, const std::string &parameters)
 
virtual bool evaluate (const AIPtr &entity)=0
 Checks whether the condition evaluates to true for the given entity. More...
 
const std::string & getName () const
 Returns the short name of the condition - without any related conditions or results.
 
const std::string & getParameters () const
 Returns the raw parameters of the condition.
 
std::string getNameWithConditions (const AIPtr &entity)
 Returns the full condition string with all related conditions and results of the evaluation method. More...
 
- Public Member Functions inherited from ai::_MemObject< AllocatorClass >
void * operator new (size_t size)
 
void * operator new (size_t, void *ptr)
 
void * operator new[] (size_t size)
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *)
 
void operator delete[] (void *ptr)
 

Protected Member Functions

virtual void getConditionNameWithValue (std::stringstream &s, const AIPtr &entity)
 Override this method to get a more detailed result in getNameWithConditions() More...
 

Static Protected Member Functions

static int getNextId ()
 

Protected Attributes

int _id
 Every node has an id to identify it. It's unique per type.
 
const std::string _name
 
const std::string _parameters
 

Detailed Description

A condition can be placed on a TreeNode to decide which node is going to get executed. In general they are stateless. If they are not, it should explicitly get noted.

Member Function Documentation

virtual bool ai::ICondition::evaluate ( const AIPtr &  entity)
pure virtual

Checks whether the condition evaluates to true for the given entity.

Parameters
[in,out]entityThe entity that is used to evaluate the condition
Returns
true if the condition is fulfilled, false otherwise.

Implemented in ai::LUACondition, ai::Filter, ai::IsCloseToGroup, ai::IsInGroup, ai::IsGroupLeader, ai::HasEnemies, ai::Not, ai::And, ai::Or, ai::False, and ai::True.

virtual void ai::ICondition::getConditionNameWithValue ( std::stringstream &  s,
const AIPtr &  entity 
)
inlineprotectedvirtual

Override this method to get a more detailed result in getNameWithConditions()

Parameters
[out]sThe string stream to write your details to
[in,out]entityThe entity that is used to evaluate a condition
See Also
getNameWithConditions()

Reimplemented in ai::Filter, and ai::Not.

std::string ai::ICondition::getNameWithConditions ( const AIPtr &  entity)
inline

Returns the full condition string with all related conditions and results of the evaluation method.

Parameters
[in,out]entityThe entity that is used to evaluate the condition
See Also
getConditionNameWithValue()

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