bool TrainAction::Execute() { LogActivity(Execute); EntityClassType traineeType = (EntityClassType)_params[PARAM_EntityClassId]; GameEntity *pGameTrainer; AbstractAdapter *pAdapter = g_OnlineCaseBasedPlanner->Reasoner()->Adapter(); bool executed = false; // Adapt trainer m_trainerId = pAdapter->AdaptBuildingForTraining(traineeType); if (m_trainerId != INVALID_TID) { // Issue train order pGameTrainer = g_Game->Self()->GetEntity(m_trainerId); _ASSERTE(pGameTrainer); executed = pGameTrainer->Train(traineeType); if (executed) { pGameTrainer->Lock(this); } } return executed; }
//---------------------------------------------------------------------------------------------- bool TrainAction::ExecuteAux(RtsGame& game, const WorldClock& clock) { LogActivity(ExecuteAux); EntityClassType traineeType = (EntityClassType)_params[PARAM_EntityClassId]; GameEntity *pGameTrainer; AbstractAdapter *pAdapter = g_OnlineCaseBasedPlanner->Reasoner()->Adapter(); bool executed = false; // Adapt trainer m_trainerId = pAdapter->AdaptBuildingForTraining(traineeType); if (m_trainerId != INVALID_TID) { // Issue train order pGameTrainer = game.Self()->GetEntity(m_trainerId); _ASSERTE(pGameTrainer); _ASSERTE(!m_requiredResources.IsNull()); m_requiredResources.Lock(this); executed = pGameTrainer->Train(traineeType); } return executed; }