Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
AIStateMachine Class Reference

#include <AIStateMachine.h>

Inherits StateMachine.

Inherited by ChinookAIStateMachine, HackInternetStateMachine, HeliAIStateMachine, and JetAIStateMachine.

Public Member Functions

 AIStateMachine (Object *owner, AsciiString name)
 
virtual void clear ()
 clear the machine's internals to a known, initialized state
 
virtual StateReturnType resetToDefaultState ()
 clear the machine's internals and set to the default state
 
virtual StateReturnType setState (StateID newStateID)
 change the current state of the machine (which may cause further state changes, due to onEnter)
 
void setGoalPath (const std::vector< Coord3D > *path)
 
void addToGoalPath (const Coord3D *pathPoint)
 
const Coord3DgetGoalPathPosition (Int i) const
 return path position at index "i"
 
Int getGoalPathSize () const
 
void setGoalWaypoint (const Waypoint *way)
 move toward this waypoint, continue if connected
 
const WaypointgetGoalWaypoint ()
 
void setGoalTeam (const Team *team)
 
void setGoalSquad (const Squad *squad)
 
void setGoalAIGroup (const AIGroup *group)
 
SquadgetGoalSquad (void)
 
StateReturnType setTemporaryState (StateID newStateID, Int frameLimitCoount)
 change the temporary state of the machine, and number of frames limit.
 
StateID getTemporaryState (void) const
 
virtual StateReturnType updateStateMachine ()
 run one step of the machine
 
- Public Member Functions inherited from StateMachine
 StateMachine (Object *owner, AsciiString name)
 
virtual StateReturnType initDefaultState ()
 
StateID getCurrentStateID () const
 return the id of the current state of the machine
 
Bool isInIdleState () const
 
Bool isInAttackState () const
 
Bool isInForceAttackState () const
 
Bool isInGuardIdleState () const
 
Bool isInBusyState () const
 
void lock (const char *msg)
 
void unlock ()
 
Bool isLocked () const
 
ObjectgetOwner ()
 
const ObjectgetOwner () const
 
void setGoalObject (const Object *obj)
 
ObjectgetGoalObject ()
 
const ObjectgetGoalObject () const
 
void setGoalPosition (const Coord3D *pos)
 
const Coord3DgetGoalPosition () const
 
Bool isGoalObjectDestroyed () const
 Returns true if we had a goal object, but it has been destroyed.
 
virtual void halt (void)
 Stops the state machine & disables it in preparation for deleting it.
 
StateReturnType internalSetState (StateID newStateID)
 for internal use only - change the current state of the machine
 
Bool getWantsDebugOutput () const
 
AsciiString getCurrentStateName () const
 
- Public Member Functions inherited from MemoryPoolObject
void deleteInstance ()
 
- Public Member Functions inherited from Snapshot
 Snapshot (void)
 
 ~Snapshot (void)
 

Protected Member Functions

virtual void crc (Xfer *xfer)
 
virtual void xfer (Xfer *xfer)
 
virtual void loadPostProcess ()
 
- Protected Member Functions inherited from StateMachine
void defineState (StateID id, State *state, StateID successID, StateID failureID, const StateConditionInfo *conditions=NULL)
 
StateinternalGetState (StateID id)
 
- Protected Member Functions inherited from MemoryPoolObject
virtual ~MemoryPoolObject ()
 
void * operator new (size_t s)
 
void operator delete (void *p)
 
virtual MemoryPoolgetObjectMemoryPool ()=0
 

Detailed Description

The AI state machine. This is used by AIUpdate to implement all of the commands in the AICommandInterface.

NOTE NOTE NOTE NOTE NOTE

Do NOT subclass this unless you want ALL of the states this machine possesses. If you only want SOME of the states, please make a new StateMachine, descended from StateMachine, NOT AIStateMachine. Thank you. (srj)

NOTE NOTE NOTE NOTE NOTE

Definition at line 133 of file AIStateMachine.h.

Constructor & Destructor Documentation

◆ AIStateMachine()

AIStateMachine::AIStateMachine ( Object * owner,
AsciiString name )

The implementation of this constructor defines the states used by this machine.

Definition at line 677 of file AIStates.cpp.

Member Function Documentation

◆ addToGoalPath()

void AIStateMachine::addToGoalPath ( const Coord3D * pathPoint)

Add a point to a simple path

Definition at line 980 of file AIStates.cpp.

◆ clear()

void AIStateMachine::clear ( )
virtual

clear the machine's internals to a known, initialized state

Clear the machine

Reimplemented from StateMachine.

Definition at line 1025 of file AIStates.cpp.

◆ crc()

void AIStateMachine::crc ( Xfer * xfer)
protectedvirtual

CRC

Reimplemented from StateMachine.

Definition at line 749 of file AIStates.cpp.

◆ getGoalPathPosition()

const Coord3D * AIStateMachine::getGoalPathPosition ( Int i) const

return path position at index "i"

Return path position at index "i"

Definition at line 997 of file AIStates.cpp.

◆ getGoalPathSize()

Int AIStateMachine::getGoalPathSize ( ) const
inline

Definition at line 152 of file AIStateMachine.h.

◆ getGoalSquad()

Squad * AIStateMachine::getGoalSquad ( void )

Definition at line 1093 of file AIStates.cpp.

◆ getGoalWaypoint()

const Waypoint * AIStateMachine::getGoalWaypoint ( )

Return the current goal waypoint

Definition at line 1019 of file AIStates.cpp.

◆ getTemporaryState()

StateID AIStateMachine::getTemporaryState ( void ) const
inline

Definition at line 166 of file AIStateMachine.h.

◆ loadPostProcess()

void AIStateMachine::loadPostProcess ( void )
protectedvirtual

Load post process

Reimplemented from StateMachine.

Definition at line 823 of file AIStates.cpp.

◆ resetToDefaultState()

StateReturnType AIStateMachine::resetToDefaultState ( )
virtual

clear the machine's internals and set to the default state

Reset the machine to its default state

Reimplemented from StateMachine.

Definition at line 1038 of file AIStates.cpp.

◆ setGoalAIGroup()

void AIStateMachine::setGoalAIGroup ( const AIGroup * group)

Definition at line 1083 of file AIStates.cpp.

◆ setGoalPath()

void AIStateMachine::setGoalPath ( const std::vector< Coord3D > * path)
Todo
Rethink state parameter passing. Continuing in this fashion will have a pile of params in the machine (MSB)

Define a simple path

Definition at line 832 of file AIStates.cpp.

◆ setGoalSquad()

void AIStateMachine::setGoalSquad ( const Squad * squad)

Definition at line 1073 of file AIStates.cpp.

◆ setGoalTeam()

void AIStateMachine::setGoalTeam ( const Team * team)

Definition at line 1063 of file AIStates.cpp.

◆ setGoalWaypoint()

void AIStateMachine::setGoalWaypoint ( const Waypoint * way)

move toward this waypoint, continue if connected

Set the current goal waypoint. If we reach this waypoint and there are connections to further points, continue on.

Definition at line 1010 of file AIStates.cpp.

◆ setState()

StateReturnType AIStateMachine::setState ( StateID newStateID)
virtual

change the current state of the machine (which may cause further state changes, due to onEnter)

Change the current state of the machine. This causes the old state's onExit() method to be invoked, and the new state's onEnter() method to be invoked.

Reimplemented from StateMachine.

Definition at line 1050 of file AIStates.cpp.

◆ setTemporaryState()

StateReturnType AIStateMachine::setTemporaryState ( StateID newStateID,
Int frameLimitCoount )

change the temporary state of the machine, and number of frames limit.

Change the temporary state of the machine, and number of frames limit.th

Definition at line 927 of file AIStates.cpp.

◆ updateStateMachine()

StateReturnType AIStateMachine::updateStateMachine ( )
virtual

run one step of the machine

Run one step of the machine

Reimplemented from StateMachine.

Definition at line 858 of file AIStates.cpp.

◆ xfer()

void AIStateMachine::xfer ( Xfer * xfer)
protectedvirtual

Xfer Method

Reimplemented from StateMachine.

Definition at line 757 of file AIStates.cpp.


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