void IMSystemManager::Update(const WorldClock& p_clock) { for (IMContainer::iterator itr = m_managedMaps.begin(); itr != m_managedMaps.end(); ++itr) { switch (itr->first) { case IM_BuildingData: if (p_clock.ElapsedGameCycles() % m_params.OccupanceIMUpdateInterval != 0) continue; break; case IM_GroundControl: if (p_clock.ElapsedGameCycles() % m_params.GrndCtrlIMUpdateInterval != 0) continue; break; } itr->second->Update(p_clock); } }
bool Action::IsCurrentStateTimeout(const WorldClock& p_clock) { unsigned timeout = _stateTimeout[INDEX(_state, ExecutionStateType)]; unsigned startTime = _stateStartTime[INDEX(_state, ExecutionStateType)]; // 0 means no timeout and thus meaning infinite timeout if (timeout == 0) return false; else return ((p_clock.ElapsedGameCycles() - startTime) > timeout); }
void Action::SetState(ExecutionStateType p_state, RtsGame& game, const WorldClock& p_clock) { PlanStepEx::SetState(p_state, game, p_clock); _stateStartTime[INDEX(p_state, ExecutionStateType)] = p_clock.ElapsedGameCycles(); switch (p_state) { case ESTATE_Succeeded: OnSucccess(game, p_clock); break; case ESTATE_Failed: OnFailure(game, p_clock); break; } }