ProtoBot
Loading...
Searching...
No Matches
IdleState Class Reference

When any squad is created, it is assigned this state by default. This state does nothing. More...

#include <SquadStateTypes.h>

Inheritance diagram for IdleState:
SquadState

Public Member Functions

void Enter (Squad *squad)
 Squad is added to IdleSquads vector in CombatManager.
void Update (Squad *squad)
 Base state for all squads when first created.
These squads will be later reassigned after actions are received from StrategyManager.
Idle squads will not do anything until they are assigned a new state.
void Exit (Squad *squad)
 Squad is removed from IdleSquads vector in CombatManager and resets all command positions to invalid.

Static Public Member Functions

static SquadStategetInstance ()

Private Member Functions

 IdleState (const IdleState &)
IdleStateoperator= (const IdleState &)

Detailed Description

When any squad is created, it is assigned this state by default. This state does nothing.

Definition at line 124 of file SquadStateTypes.h.

Constructor & Destructor Documentation

◆ IdleState()

IdleState::IdleState ( )
inlineprivate

Definition at line 145 of file SquadStateTypes.h.

145{};

Member Function Documentation

◆ Enter()

void IdleState::Enter ( Squad * squad)
virtual

Squad is added to IdleSquads vector in CombatManager.

Parameters
squad

Implements SquadState.

Definition at line 246 of file SquadStateTypes.cpp.

246 {
247 CombatManager::IdleSquads.push_back(squad);
248
249#ifdef DEBUG_STATES
250 cout << "(" << squad->info.squadId << ")" << "Entered IDLE state" << endl;
251#endif
252}

◆ Exit()

void IdleState::Exit ( Squad * squad)
virtual

Squad is removed from IdleSquads vector in CombatManager and resets all command positions to invalid.

Parameters
squad

Implements SquadState.

Definition at line 255 of file SquadStateTypes.cpp.

255 {
256 CombatManager::IdleSquads.erase(remove(CombatManager::IdleSquads.begin(), CombatManager::IdleSquads.end(), squad), CombatManager::IdleSquads.end());
257 squad->info.kitePos = BWAPI::Positions::Invalid;
258 squad->info.currentPath = Path();
259 squad->info.currentPathIdx = 0;
260
261#ifdef DEBUG_STATES
262 cout << "(" << squad->info.squadId << ")" << "Exited IDLE state" << endl;
263#endif
264}

◆ getInstance()

SquadState & IdleState::getInstance ( )
static

Definition at line 266 of file SquadStateTypes.cpp.

267{
268 static IdleState singleton;
269 return singleton;
270}

◆ operator=()

IdleState & IdleState::operator= ( const IdleState & )
inlineprivate

Definition at line 147 of file SquadStateTypes.h.

147{};

◆ Update()

void IdleState::Update ( Squad * squad)
virtual

Base state for all squads when first created.
These squads will be later reassigned after actions are received from StrategyManager.
Idle squads will not do anything until they are assigned a new state.

Parameters
squad

Implements SquadState.

Definition at line 253 of file SquadStateTypes.cpp.

253 {
254}

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