1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Nullkiller: android build fixes

This commit is contained in:
Andrii Danylchenko 2021-05-15 21:57:44 +03:00 committed by Andrii Danylchenko
parent 3744125270
commit 01975e339b
7 changed files with 20 additions and 20 deletions

View File

@ -16,7 +16,7 @@ Nullkiller::Nullkiller()
dangerHitMap.reset(new DangerHitMapAnalyzer());
}
Goals::TSubgoal Nullkiller::choseBestTask(Goals::TGoalVec tasks)
Goals::TSubgoal Nullkiller::choseBestTask(Goals::TGoalVec & tasks) const
{
Goals::TSubgoal bestTask = *vstd::maxElementByFun(tasks, [](Goals::TSubgoal goal) -> float{
return goal->priority;
@ -25,15 +25,15 @@ Goals::TSubgoal Nullkiller::choseBestTask(Goals::TGoalVec tasks)
return bestTask;
}
Goals::TSubgoal Nullkiller::choseBestTask(Behavior & behavior)
Goals::TSubgoal Nullkiller::choseBestTask(std::shared_ptr<Behavior> behavior) const
{
logAi->debug("Checking behavior %s", behavior.toString());
logAi->debug("Checking behavior %s", behavior->toString());
auto tasks = behavior.getTasks();
auto tasks = behavior->getTasks();
if(tasks.empty())
{
logAi->debug("Behavior %s found no tasks", behavior.toString());
logAi->debug("Behavior %s found no tasks", behavior->toString());
return Goals::sptr(Goals::Invalid());
}
@ -45,7 +45,7 @@ Goals::TSubgoal Nullkiller::choseBestTask(Behavior & behavior)
auto task = choseBestTask(tasks);
logAi->debug("Behavior %s returns %s(%s), priority %f", behavior.toString(), task->name(), task->tile.toString(), task->priority);
logAi->debug("Behavior %s returns %s(%s), priority %f", behavior->toString(), task->name(), task->tile.toString(), task->priority);
return task;
}
@ -77,9 +77,9 @@ void Nullkiller::makeTurn()
updateAiState();
Goals::TGoalVec bestTasks = {
choseBestTask(BuyArmyBehavior()),
choseBestTask(CaptureObjectsBehavior()),
choseBestTask(RecruitHeroBehavior())
choseBestTask(std::make_shared<BuyArmyBehavior>()),
choseBestTask(std::make_shared<CaptureObjectsBehavior>()),
choseBestTask(std::make_shared<RecruitHeroBehavior>())
};
Goals::TSubgoal bestTask = choseBestTask(bestTasks);

View File

@ -24,6 +24,6 @@ public:
private:
void resetAiState();
void updateAiState();
Goals::TSubgoal choseBestTask(Behavior & behavior);
Goals::TSubgoal choseBestTask(Goals::TGoalVec tasks);
Goals::TSubgoal choseBestTask(std::shared_ptr<Behavior> behavior) const;
Goals::TSubgoal choseBestTask(Goals::TGoalVec & tasks) const;
};

View File

@ -12,8 +12,8 @@
#include "../VCAI.h"
#include "../FuzzyHelper.h"
#include "../AIhelper.h"
#include "../../lib/mapping/CMap.h" //for victory conditions
#include "../../lib/CPathfinder.h"
#include "../../../lib/mapping/CMap.h" //for victory conditions
#include "../../../lib/CPathfinder.h"
extern boost::thread_specific_ptr<CCallback> cb;
extern boost::thread_specific_ptr<VCAI> ai;

View File

@ -12,8 +12,8 @@
#include "../VCAI.h"
#include "../FuzzyHelper.h"
#include "../AIhelper.h"
#include "../../lib/mapping/CMap.h" //for victory conditions
#include "../../lib/CPathfinder.h"
#include "../../../lib/mapping/CMap.h" //for victory conditions
#include "../../../lib/CPathfinder.h"
extern boost::thread_specific_ptr<CCallback> cb;
extern boost::thread_specific_ptr<VCAI> ai;

View File

@ -11,7 +11,7 @@
#include "BuyArmy.h"
#include "../FuzzyHelper.h"
#include "../AIhelper.h"
#include "../../lib/mapObjects/CGTownInstance.h"
#include "../../../lib/mapObjects/CGTownInstance.h"
extern boost::thread_specific_ptr<CCallback> cb;

View File

@ -12,8 +12,8 @@
#include "../VCAI.h"
#include "../FuzzyHelper.h"
#include "../AIhelper.h"
#include "../../lib/mapping/CMap.h" //for victory conditions
#include "../../lib/CPathfinder.h"
#include "../../../lib/mapping/CMap.h" //for victory conditions
#include "../../../lib/CPathfinder.h"
extern boost::thread_specific_ptr<CCallback> cb;
extern boost::thread_specific_ptr<VCAI> ai;

View File

@ -13,8 +13,8 @@
#include "../VCAI.h"
#include "../FuzzyHelper.h"
#include "../AIhelper.h"
#include "../../lib/mapping/CMap.h" //for victory conditions
#include "../../lib/CPathfinder.h"
#include "../../../lib/mapping/CMap.h" //for victory conditions
#include "../../../lib/CPathfinder.h"
#include "../Engine/Nullkiller.h"
extern boost::thread_specific_ptr<CCallback> cb;