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

#include <StateMachine.h>

Inherits MemoryPoolObject, and Snapshot.

Inherited by AIAttackAimAtTargetState, AIAttackAreaState, AIAttackFireWeaponState, AIAttackSquadState, AIAttackState, AIBusyState, AIDeadState, AIDockProcessDockState, AIDockState, AIDockWaitForClearanceState, AIExitInstantlyState, AIExitState, AIFaceState, AIGuardAttackAggressorState, AIGuardIdleState, AIGuardInnerState, AIGuardOuterState, AIGuardRetaliateAttackAggressorState, AIGuardRetaliateIdleState, AIGuardRetaliateInnerState, AIGuardRetaliateOuterState, AIGuardRetaliateState, AIGuardState, AIHuntState, AIIdleState, AIInternalMoveToState, AIRappelState, AITNGuardAttackAggressorState, AITNGuardIdleState, AITNGuardInnerState, AITNGuardOuterState, AITunnelNetworkGuardState, AIWaitState, ActAsDozerState, ActAsSupplyTruckState, ApproachState, ChinookCombatDropState, ChinookEvacuateState, ChinookHeadOffMapState, ChinookRecordCreationState, ChinookTakeoffOrLandingState, CleanUpState, ConsiderNewApproachState, ContinueState, DeliveringState, DockingState, DozerActionDoActionState, DozerActionMoveToActionPosState, DozerActionPickActionPosState, DozerActionState, DozerPrimaryGoingHomeState, DozerPrimaryIdleState, FailureState, HackInternetState, HeadOffMapState, HeliTakeoffOrLandingState, JetAwaitingRunwayState, JetOrHeliCirclingDeadAirfieldState, JetOrHeliParkOrientState, JetOrHeliReloadAmmoState, PackingState, RecoverFromOffMapState, RegroupingState, SleepState, SuccessState, SupplyTruckBusyState, SupplyTruckIdleState, SupplyTruckWantsToPickUpOrDeliverBoxesState, TurretState, and UnpackingState.

Public Member Functions

 State (StateMachine *machine, AsciiString name)
 < this abstract class needs memory pool hooks
 
virtual StateReturnType onEnter ()
 executed once when entering state
 
virtual void onExit (StateExitType status)
 executed once when leaving state
 
virtual StateReturnType update ()=0
 implements this state's behavior, decides when to change state
 
virtual Bool isIdle () const
 
virtual Bool isAttack () const
 
virtual Bool isGuardIdle () const
 
virtual Bool isBusy () const
 
StateMachinegetMachine ()
 return the machine this state is part of
 
StateID getID () const
 get this state's id
 
ObjectgetMachineOwner ()
 
const ObjectgetMachineOwner () const
 
ObjectgetMachineGoalObject ()
 return the machine this state is part of
 
const ObjectgetMachineGoalObject () const
 return the machine this state is part of
 
const Coord3DgetMachineGoalPosition () const
 return the machine this state is part of
 
void friend_setID (StateID id)
 define this state's id (for use only by StateMachine class)
 
void friend_onSuccess (StateID toStateID)
 define which state to move to after successful completion
 
void friend_onFailure (StateID toStateID)
 define which state to move to after failure
 
void friend_onCondition (StateTransFuncPtr test, StateID toStateID, void *userData, const char *description=NULL)
 define when to change state
 
StateReturnType friend_checkForTransitions (StateReturnType status)
 given a return code, handle state transitions
 
StateReturnType friend_checkForSleepTransitions (StateReturnType status)
 given a return code, handle state transitions
 
- 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)=0
 run the "light" crc check on this data structure
 
virtual void xfer (Xfer *xfer)=0
 
virtual void loadPostProcess ()=0
 
- Protected Member Functions inherited from MemoryPoolObject
virtual ~MemoryPoolObject ()
 
void * operator new (size_t s)
 
void operator delete (void *p)
 
virtual MemoryPoolgetObjectMemoryPool ()=0
 

Detailed Description

An abstraction of a machine's "state".

Definition at line 144 of file StateMachine.h.

Constructor & Destructor Documentation

◆ State()

State::State ( StateMachine * machine,
AsciiString name )

< this abstract class needs memory pool hooks

Constructor

Definition at line 57 of file StateMachine.cpp.

Member Function Documentation

◆ crc()

virtual void State::crc ( Xfer * xfer)
protectedpure virtual

run the "light" crc check on this data structure

Implements Snapshot.

Implemented in ActAsDozerState, ActAsSupplyTruckState, AIAttackAimAtTargetState, AIAttackApproachTargetState, AIAttackAreaState, AIAttackFireWeaponState, AIAttackFollowWaypointPathState, AIAttackMoveToState, AIAttackPursueTargetState, AIAttackSquadState, AIAttackState, AIBusyState, AIDeadState, AIDockApproachState, AIDockProcessDockState, AIDockState, AIDockWaitForClearanceState, AIEnterState, AIExitInstantlyState, AIExitState, AIFaceState, AIFollowPathState, AIFollowWaypointPathExactState, AIFollowWaypointPathState, AIGuardAttackAggressorState, AIGuardIdleState, AIGuardInnerState, AIGuardOuterState, AIGuardRetaliateAttackAggressorState, AIGuardRetaliateIdleState, AIGuardRetaliateInnerState, AIGuardRetaliateOuterState, AIGuardRetaliateReturnState, AIGuardRetaliateState, AIGuardReturnState, AIGuardState, AIHuntState, AIIdleState, AIInternalMoveToState, AIMoveAndDeleteState, AIMoveAndEvacuateState, AIMoveAndTightenState, AIPanicState, AIPickUpCrateState, AIRappelState, AITNGuardAttackAggressorState, AITNGuardIdleState, AITNGuardInnerState, AITNGuardOuterState, AITNGuardReturnState, AITunnelNetworkGuardState, AIWaitState, AIWanderInPlaceState, AIWanderState, ApproachState, ChinookCombatDropState, ChinookEvacuateState, ChinookHeadOffMapState, ChinookMoveToBldgState, ChinookRecordCreationState, ChinookTakeoffOrLandingState, CleanUpState, ConsiderNewApproachState, ContinueState, DeliveringState, DockingState, DozerActionDoActionState, DozerActionMoveToActionPosState, DozerActionPickActionPosState, DozerActionState, DozerPrimaryGoingHomeState, DozerPrimaryIdleState, FailureState, HackInternetState, HeadOffMapState, HeliTakeoffOrLandingState, JetAwaitingRunwayState, JetOrHeliCirclingDeadAirfieldState, JetOrHeliParkOrientState, JetOrHeliReloadAmmoState, JetPauseBeforeTakeoffState, PackingState, RecoverFromOffMapState, RegroupingState, SleepState, SuccessState, SupplyTruckBusyState, SupplyTruckIdleState, SupplyTruckWantsToPickUpOrDeliverBoxesState, TurretAIAimTurretState, TurretAIHoldTurretState, TurretAIIdleScanState, TurretAIIdleState, TurretAIRecenterTurretState, and UnpackingState.

◆ friend_checkForSleepTransitions()

StateReturnType State::friend_checkForSleepTransitions ( StateReturnType status)

given a return code, handle state transitions

Given a return code, handle state transitions

Definition at line 209 of file StateMachine.cpp.

◆ friend_checkForTransitions()

StateReturnType State::friend_checkForTransitions ( StateReturnType status)

given a return code, handle state transitions

Given a return code, handle state transitions

Definition at line 116 of file StateMachine.cpp.

◆ friend_onCondition()

void State::friend_onCondition ( StateTransFuncPtr test,
StateID toStateID,
void * userData,
const char * description = NULL )

define when to change state

Add another state transition condition for this state

Definition at line 72 of file StateMachine.cpp.

◆ friend_onFailure()

void State::friend_onFailure ( StateID toStateID)
inline

define which state to move to after failure

Definition at line 179 of file StateMachine.h.

◆ friend_onSuccess()

void State::friend_onSuccess ( StateID toStateID)
inline

define which state to move to after successful completion

Definition at line 178 of file StateMachine.h.

◆ friend_setID()

void State::friend_setID ( StateID id)
inline

define this state's id (for use only by StateMachine class)

Definition at line 177 of file StateMachine.h.

◆ getID()

StateID State::getID ( ) const
inline

get this state's id

Definition at line 163 of file StateMachine.h.

◆ getMachine()

StateMachine * State::getMachine ( )
inline

return the machine this state is part of

Definition at line 162 of file StateMachine.h.

◆ getMachineGoalObject() [1/2]

Object * State::getMachineGoalObject ( )
inline

return the machine this state is part of

Definition at line 393 of file StateMachine.h.

◆ getMachineGoalObject() [2/2]

const Object * State::getMachineGoalObject ( ) const
inline

return the machine this state is part of

Definition at line 394 of file StateMachine.h.

◆ getMachineGoalPosition()

const Coord3D * State::getMachineGoalPosition ( ) const
inline

return the machine this state is part of

Definition at line 396 of file StateMachine.h.

◆ getMachineOwner() [1/2]

Object * State::getMachineOwner ( )
inline

Definition at line 390 of file StateMachine.h.

◆ getMachineOwner() [2/2]

const Object * State::getMachineOwner ( ) const
inline

Definition at line 391 of file StateMachine.h.

◆ isAttack()

◆ isBusy()

virtual Bool State::isBusy ( void ) const
inlinevirtual

Reimplemented in AIBusyState.

Definition at line 160 of file StateMachine.h.

◆ isGuardIdle()

virtual Bool State::isGuardIdle ( ) const
inlinevirtual

Reimplemented in AIGuardIdleState, and AIGuardState.

Definition at line 158 of file StateMachine.h.

◆ isIdle()

virtual Bool State::isIdle ( void ) const
inlinevirtual

Reimplemented in AIIdleState.

Definition at line 156 of file StateMachine.h.

◆ loadPostProcess()

virtual void State::loadPostProcess ( )
protectedpure virtual

post process phase for loading save games. All save systems have their xfer run using XferLoad mode, and then all systems each have their post process run

Implements Snapshot.

Implemented in ActAsDozerState, ActAsSupplyTruckState, AIAttackAimAtTargetState, AIAttackApproachTargetState, AIAttackAreaState, AIAttackFireWeaponState, AIAttackFollowWaypointPathState, AIAttackMoveToState, AIAttackPursueTargetState, AIAttackSquadState, AIAttackState, AIBusyState, AIDeadState, AIDockApproachState, AIDockProcessDockState, AIDockState, AIDockWaitForClearanceState, AIEnterState, AIExitInstantlyState, AIExitState, AIFaceState, AIFollowPathState, AIFollowWaypointPathExactState, AIFollowWaypointPathState, AIGuardAttackAggressorState, AIGuardIdleState, AIGuardInnerState, AIGuardOuterState, AIGuardRetaliateAttackAggressorState, AIGuardRetaliateIdleState, AIGuardRetaliateInnerState, AIGuardRetaliateOuterState, AIGuardRetaliateReturnState, AIGuardRetaliateState, AIGuardReturnState, AIGuardState, AIHuntState, AIIdleState, AIInternalMoveToState, AIMoveAndDeleteState, AIMoveAndEvacuateState, AIMoveAndTightenState, AIPanicState, AIPickUpCrateState, AIRappelState, AITNGuardAttackAggressorState, AITNGuardIdleState, AITNGuardInnerState, AITNGuardOuterState, AITNGuardReturnState, AITunnelNetworkGuardState, AIWaitState, AIWanderInPlaceState, AIWanderState, ApproachState, ChinookCombatDropState, ChinookEvacuateState, ChinookHeadOffMapState, ChinookMoveToBldgState, ChinookRecordCreationState, ChinookTakeoffOrLandingState, CleanUpState, ConsiderNewApproachState, ContinueState, DeliveringState, DockingState, DozerActionDoActionState, DozerActionMoveToActionPosState, DozerActionPickActionPosState, DozerActionState, DozerPrimaryGoingHomeState, DozerPrimaryIdleState, FailureState, HackInternetState, HeadOffMapState, HeliTakeoffOrLandingState, JetAwaitingRunwayState, JetOrHeliCirclingDeadAirfieldState, JetOrHeliParkOrientState, JetOrHeliReloadAmmoState, JetPauseBeforeTakeoffState, PackingState, RecoverFromOffMapState, RegroupingState, SleepState, SuccessState, SupplyTruckBusyState, SupplyTruckIdleState, SupplyTruckWantsToPickUpOrDeliverBoxesState, TurretAIAimTurretState, TurretAIHoldTurretState, TurretAIIdleScanState, TurretAIIdleState, TurretAIRecenterTurretState, and UnpackingState.

◆ onEnter()

virtual StateReturnType State::onEnter ( void )
inlinevirtual

executed once when entering state

Reimplemented in ActAsDozerState, ActAsSupplyTruckState, AIAttackAimAtTargetState, AIAttackApproachTargetState, AIAttackAreaState, AIAttackFireWeaponState, AIAttackFollowWaypointPathState, AIAttackMoveToState, AIAttackPursueTargetState, AIAttackSquadState, AIAttackState, AIBusyState, AIDeadState, AIDockAdvancePositionState, AIDockApproachState, AIDockMoveToDockState, AIDockMoveToEntryState, AIDockMoveToExitState, AIDockMoveToRallyState, AIDockProcessDockState, AIDockState, AIDockWaitForClearanceState, AIEnterState, AIExitInstantlyState, AIExitState, AIFaceState, AIFollowPathState, AIFollowWaypointPathExactState, AIFollowWaypointPathState, AIGuardAttackAggressorState, AIGuardIdleState, AIGuardInnerState, AIGuardOuterState, AIGuardPickUpCrateState, AIGuardRetaliateAttackAggressorState, AIGuardRetaliateIdleState, AIGuardRetaliateInnerState, AIGuardRetaliateOuterState, AIGuardRetaliatePickUpCrateState, AIGuardRetaliateReturnState, AIGuardRetaliateState, AIGuardReturnState, AIGuardState, AIHuntState, AIIdleState, AIInternalMoveToState, AIMoveAndDeleteState, AIMoveAndEvacuateState, AIMoveAndTightenState, AIMoveAwayFromRepulsorsState, AIMoveOutOfTheWayState, AIMoveToState, AIPanicState, AIPickUpCrateState, AIRappelState, AITNGuardAttackAggressorState, AITNGuardIdleState, AITNGuardInnerState, AITNGuardOuterState, AITNGuardPickUpCrateState, AITNGuardReturnState, AITunnelNetworkGuardState, AIWanderInPlaceState, AIWanderState, ApproachState, ChinookCombatDropState, ChinookEvacuateState, ChinookHeadOffMapState, ChinookMoveToBldgState, ChinookRecordCreationState, ChinookTakeoffOrLandingState, CleanUpState, ConsiderNewApproachState, ContinueState, DeliveringState, DockingState, DozerActionDoActionState, DozerActionState, DozerPrimaryIdleState, FailureState, HackInternetState, HeadOffMapState, HeliTakeoffOrLandingState, JetAwaitingRunwayState, JetOrHeliCirclingDeadAirfieldState, JetOrHeliParkOrientState, JetOrHeliReloadAmmoState, JetOrHeliReturnForLandingState, JetOrHeliReturningToDeadAirfieldState, JetOrHeliTaxiState, JetPauseBeforeTakeoffState, JetTakeoffOrLandingState, PackingState, RecoverFromOffMapState, RegroupingState, SleepState, SuccessState, SupplyTruckBusyState, SupplyTruckIdleState, SupplyTruckWantsToPickUpOrDeliverBoxesState, TurretAIAimTurretState, TurretAIHoldTurretState, TurretAIIdleScanState, TurretAIIdleState, TurretAIRecenterTurretState, and UnpackingState.

Definition at line 152 of file StateMachine.h.

◆ onExit()

virtual void State::onExit ( StateExitType status)
inlinevirtual

executed once when leaving state

Reimplemented in AIAttackAimAtTargetState, AIAttackApproachTargetState, AIAttackAreaState, AIAttackFireWeaponState, AIAttackFollowWaypointPathState, AIAttackMoveToState, AIAttackPursueTargetState, AIAttackSquadState, AIAttackState, AIBusyState, AIDeadState, AIDockAdvancePositionState, AIDockApproachState, AIDockMoveToDockState, AIDockMoveToEntryState, AIDockMoveToExitState, AIDockMoveToRallyState, AIDockProcessDockState, AIDockState, AIDockWaitForClearanceState, AIEnterState, AIExitInstantlyState, AIExitState, AIFaceState, AIFollowPathState, AIFollowWaypointPathExactState, AIFollowWaypointPathState, AIGuardAttackAggressorState, AIGuardIdleState, AIGuardInnerState, AIGuardOuterState, AIGuardPickUpCrateState, AIGuardRetaliateAttackAggressorState, AIGuardRetaliateIdleState, AIGuardRetaliateInnerState, AIGuardRetaliateOuterState, AIGuardRetaliatePickUpCrateState, AIGuardRetaliateReturnState, AIGuardRetaliateState, AIGuardReturnState, AIGuardState, AIHuntState, AIInternalMoveToState, AIMoveAndDeleteState, AIMoveAndEvacuateState, AIMoveAwayFromRepulsorsState, AIMoveOutOfTheWayState, AIMoveToState, AIPanicState, AIPickUpCrateState, AIRappelState, AITNGuardAttackAggressorState, AITNGuardIdleState, AITNGuardInnerState, AITNGuardOuterState, AITNGuardPickUpCrateState, AITNGuardReturnState, AITunnelNetworkGuardState, AIWanderInPlaceState, AIWanderState, ChinookCombatDropState, ChinookMoveToBldgState, ChinookTakeoffOrLandingState, ConsiderNewApproachState, DeliveringState, DockingState, DozerActionDoActionState, DozerActionState, DozerPrimaryIdleState, HackInternetState, HeliTakeoffOrLandingState, JetAwaitingRunwayState, JetOrHeliParkOrientState, JetOrHeliReloadAmmoState, JetOrHeliTaxiState, JetPauseBeforeTakeoffState, JetTakeoffOrLandingState, PackingState, RegroupingState, SupplyTruckBusyState, SupplyTruckIdleState, SupplyTruckWantsToPickUpOrDeliverBoxesState, TurretAIAimTurretState, TurretAIHoldTurretState, TurretAIIdleScanState, TurretAIRecenterTurretState, and UnpackingState.

Definition at line 153 of file StateMachine.h.

◆ update()

virtual StateReturnType State::update ( )
pure virtual

implements this state's behavior, decides when to change state

Implemented in ActAsDozerState, ActAsSupplyTruckState, AIAttackAimAtTargetState, AIAttackApproachTargetState, AIAttackAreaState, AIAttackFireWeaponState, AIAttackFollowWaypointPathState, AIAttackMoveToState, AIAttackPursueTargetState, AIAttackSquadState, AIAttackState, AIBusyState, AIDeadState, AIDockAdvancePositionState, AIDockApproachState, AIDockMoveToDockState, AIDockMoveToEntryState, AIDockMoveToExitState, AIDockMoveToRallyState, AIDockProcessDockState, AIDockState, AIDockWaitForClearanceState, AIEnterState, AIExitInstantlyState, AIExitState, AIFaceState, AIFollowPathState, AIFollowWaypointPathExactState, AIFollowWaypointPathState, AIGuardAttackAggressorState, AIGuardIdleState, AIGuardInnerState, AIGuardOuterState, AIGuardPickUpCrateState, AIGuardRetaliateAttackAggressorState, AIGuardRetaliateIdleState, AIGuardRetaliateInnerState, AIGuardRetaliateOuterState, AIGuardRetaliatePickUpCrateState, AIGuardRetaliateReturnState, AIGuardRetaliateState, AIGuardReturnState, AIGuardState, AIHuntState, AIIdleState, AIInternalMoveToState, AIMoveAndDeleteState, AIMoveAndEvacuateState, AIMoveAndTightenState, AIMoveAwayFromRepulsorsState, AIMoveOutOfTheWayState, AIMoveToState, AIPanicState, AIPickUpCrateState, AIRappelState, AITNGuardAttackAggressorState, AITNGuardIdleState, AITNGuardInnerState, AITNGuardOuterState, AITNGuardPickUpCrateState, AITNGuardReturnState, AITunnelNetworkGuardState, AIWaitState, AIWanderInPlaceState, AIWanderState, ApproachState, ChinookCombatDropState, ChinookEvacuateState, ChinookHeadOffMapState, ChinookMoveToBldgState, ChinookRecordCreationState, ChinookTakeoffOrLandingState, CleanUpState, ConsiderNewApproachState, ContinueState, DeliveringState, DockingState, DozerActionDoActionState, DozerActionMoveToActionPosState, DozerActionPickActionPosState, DozerActionState, DozerPrimaryGoingHomeState, DozerPrimaryIdleState, FailureState, HackInternetState, HeadOffMapState, HeliTakeoffOrLandingState, JetAwaitingRunwayState, JetOrHeliCirclingDeadAirfieldState, JetOrHeliParkOrientState, JetOrHeliReloadAmmoState, JetOrHeliTaxiState, JetPauseBeforeTakeoffState, JetTakeoffOrLandingState, PackingState, RecoverFromOffMapState, RegroupingState, SleepState, SuccessState, SupplyTruckBusyState, SupplyTruckIdleState, SupplyTruckWantsToPickUpOrDeliverBoxesState, TurretAIAimTurretState, TurretAIHoldTurretState, TurretAIIdleScanState, TurretAIIdleState, TurretAIRecenterTurretState, and UnpackingState.

◆ xfer()

virtual void State::xfer ( Xfer * xfer)
protectedpure virtual

run save, load, or deep CRC check on this data structure, the type depends on the setup of the Xfer pointer

Implements Snapshot.

Implemented in ActAsDozerState, ActAsSupplyTruckState, AIAttackAimAtTargetState, AIAttackApproachTargetState, AIAttackAreaState, AIAttackFireWeaponState, AIAttackFollowWaypointPathState, AIAttackMoveToState, AIAttackPursueTargetState, AIAttackSquadState, AIAttackState, AIBusyState, AIDeadState, AIDockApproachState, AIDockProcessDockState, AIDockState, AIDockWaitForClearanceState, AIEnterState, AIExitInstantlyState, AIExitState, AIFaceState, AIFollowPathState, AIFollowWaypointPathExactState, AIFollowWaypointPathState, AIGuardAttackAggressorState, AIGuardIdleState, AIGuardInnerState, AIGuardOuterState, AIGuardRetaliateAttackAggressorState, AIGuardRetaliateIdleState, AIGuardRetaliateInnerState, AIGuardRetaliateOuterState, AIGuardRetaliateReturnState, AIGuardRetaliateState, AIGuardReturnState, AIGuardState, AIHuntState, AIIdleState, AIInternalMoveToState, AIMoveAndDeleteState, AIMoveAndEvacuateState, AIMoveAndTightenState, AIPanicState, AIPickUpCrateState, AIRappelState, AITNGuardAttackAggressorState, AITNGuardIdleState, AITNGuardInnerState, AITNGuardOuterState, AITNGuardReturnState, AITunnelNetworkGuardState, AIWaitState, AIWanderInPlaceState, AIWanderState, ApproachState, ChinookCombatDropState, ChinookEvacuateState, ChinookHeadOffMapState, ChinookMoveToBldgState, ChinookRecordCreationState, ChinookTakeoffOrLandingState, CleanUpState, ConsiderNewApproachState, ContinueState, DeliveringState, DockingState, DozerActionDoActionState, DozerActionMoveToActionPosState, DozerActionPickActionPosState, DozerActionState, DozerPrimaryGoingHomeState, DozerPrimaryIdleState, FailureState, HackInternetState, HeadOffMapState, HeliTakeoffOrLandingState, JetAwaitingRunwayState, JetOrHeliCirclingDeadAirfieldState, JetOrHeliParkOrientState, JetOrHeliReloadAmmoState, JetPauseBeforeTakeoffState, PackingState, RecoverFromOffMapState, RegroupingState, SleepState, SuccessState, SupplyTruckBusyState, SupplyTruckIdleState, SupplyTruckWantsToPickUpOrDeliverBoxesState, TurretAIAimTurretState, TurretAIHoldTurretState, TurretAIIdleScanState, TurretAIIdleState, TurretAIRecenterTurretState, and UnpackingState.


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