Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Protected Attributes | List of all members
OpenSkyNet::AI::Wrapper Class Reference

#include <AIWrapper.h>

Inheritance diagram for OpenSkyNet::AI::Wrapper:
OpenSkyNet::Core::AIWrapperObject Tactics3D::NPC

Classes

struct  FSMWrapper
 

Public Member Functions

 Wrapper ()
 
virtual bool performLogic (bool includeGlobalKB_=false)
 returns true if state changed, false otherwise More...
 
virtual const StategetCurrentState () const
 
void enableSwitchingToFSM (FSM_IDS fSMId_, State *state_=0)
 
void disableSwitchingToFSM (FSM_IDS fSMId_)
 
bool setFSM (FSM_IDS fSMId_, State *state_=0, bool autoEnable_=true)
 
FSM_IDS getFSM () const
 
bool pushFSM (FSM_IDS fSMId_, State *state_=0, bool autoEnable_=true)
 
bool popFSM ()
 
bool setLogic (LOGIC_IDS logicId_)
 
LOGIC_IDS getCurrentLogicId ()
 
virtual KBgetKB ()
 
virtual void doAction ()
 to be implemented by derived or containing class More...
 
virtual ~Wrapper ()
 
virtual void init (LOGIC_IDS logicId_, FSM_IDS fSMId_, State *state_)
 
virtual void init (LOGIC_IDS logicId_, FSM_IDS fSMId_, State *state_, KB *kB_)
 

Protected Attributes

FSMWrapper _fSMs [FSM_MAX]
 
std::stack< FSMWrapper * > _stackFSMs
 
FSM_IDS _currFSMIndex
 
KB_kB
 
bool _wasKBCreatedHere
 
Logic_logic
 

Detailed Description

Wrapper - inherit or contain to endow an object with artificial intelligence

Constructor & Destructor Documentation

Wrapper::Wrapper ( )

default constructor

Wrapper::~Wrapper ( )
virtual

destructor - delete _kB if it was created by this class

Member Function Documentation

void OpenSkyNet::AI::Wrapper::disableSwitchingToFSM ( FSM_IDS  fSMId_)
inline
Parameters
fSMId_the ID of the FSM to disable
void Wrapper::doAction ( )
virtual

to be implemented by derived or containing class

Reimplemented in Tactics3D::NPC, and OpenSkyNet::Core::AIWrapperObject.

void Wrapper::enableSwitchingToFSM ( FSM_IDS  fSMId_,
State state_ = 0 
)
Parameters
fSMId_the ID of the FSM to enable
state_optionally set the current state of the FSM
LOGIC_IDS OpenSkyNet::AI::Wrapper::getCurrentLogicId ( )
inline

get the ID of the current logic processor

virtual const State* OpenSkyNet::AI::Wrapper::getCurrentState ( ) const
inlinevirtual

get the current state of the current finite state machine

Reimplemented in OpenSkyNet::Core::AIWrapperObject.

FSM_IDS OpenSkyNet::AI::Wrapper::getFSM ( ) const
inline

returns the current FSM ID or FSM_NONE if no FSM has been set for this object

virtual KB* OpenSkyNet::AI::Wrapper::getKB ( )
inlinevirtual

get the local KB used by this object

Reimplemented in OpenSkyNet::Core::AIWrapperObject.

void Wrapper::init ( LOGIC_IDS  logicId_,
FSM_IDS  fSMId_,
State state_ 
)
virtual

a class that inherits or contains a Wrapper MUST call init before calling other Wrapper methods

Parameters
logicId_the ID of the Logic class used to determine state transitions
fSMId_the ID of the initial finite state machine used by the object (automatically enabled)
state_the initial state of the object (can be different than the default initial state of the FSM)

Reimplemented in OpenSkyNet::Core::AIWrapperObject.

void Wrapper::init ( LOGIC_IDS  logicId_,
FSM_IDS  fSMId_,
State state_,
KB kB_ 
)
virtual
Parameters
logicId_the ID of the Logic class used to determine state transitions
fSMId_the ID of the initial finite state machine used by the object (automatically enabled)
state_the initial state of the object (can be different than the default initial state of the FSM)
kB_use an KB already created

Reimplemented in OpenSkyNet::Core::AIWrapperObject.

bool Wrapper::performLogic ( bool  includeGlobalKB_ = false)
virtual

returns true if state changed, false otherwise

change state if necessary

Parameters
includeGlobalKB_use the global KB? (in addition to any local one used)

Reimplemented in OpenSkyNet::Core::AIWrapperObject.

bool Wrapper::popFSM ( )

if there is an empty FSM stack, then this method does nothing (returns false). otherwise, it removes the top (current) FSM and switches to the one below it in the stack

bool Wrapper::pushFSM ( FSM_IDS  fSMId_,
State state_ = 0,
bool  autoEnable_ = true 
)

if fSMId_ is the same as the current FSM's ID, then this method does nothing (returns false). switching to another FSM via this method means that this object's previous FSM is stored in a stack NOTE: the default initial state of the FSM will be used

Parameters
fSMId_the ID of the FSM to switch to
state_optionally set the current state of the FSM
autoEnable_if true, enable this FSM if necessary NOTE: the default initial state will be used for FSMs that have to be enabled and when state_ == 0.
bool Wrapper::setFSM ( FSM_IDS  fSMId_,
State state_ = 0,
bool  autoEnable_ = true 
)

if fSMId_ is the same as the current FSM's ID, then this method does nothing (returns false). switching to another FSM via this method means that this object's previous FSM(s) is/are not tracked. NOTE: any previous FSM stack is cleared

Parameters
fSMId_the ID of the FSM to switch to
state_optionally set the current state of the FSM
autoEnable_if true, enable this FSM if necessary NOTE: the default initial state will be used for FSMs that have to be enabled and when state_ == 0.
bool Wrapper::setLogic ( LOGIC_IDS  logicId_)
Parameters
logicId_the _logicId of the Logic to switch to

Member Data Documentation

FSM_IDS OpenSkyNet::AI::Wrapper::_currFSMIndex
protected
FSMWrapper OpenSkyNet::AI::Wrapper::_fSMs[FSM_MAX]
protected
KB* OpenSkyNet::AI::Wrapper::_kB
protected
Logic* OpenSkyNet::AI::Wrapper::_logic
protected
std::stack<FSMWrapper*> OpenSkyNet::AI::Wrapper::_stackFSMs
protected
bool OpenSkyNet::AI::Wrapper::_wasKBCreatedHere
protected

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