Pārlūkot izejas kodu

Nullkiller: android build fixes

Andrii Danylchenko 4 gadi atpakaļ
vecāks
revīzija
01975e339b

+ 9 - 9
AI/Nullkiller/Engine/Nullkiller.cpp

@@ -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);

+ 2 - 2
AI/Nullkiller/Engine/Nullkiller.h

@@ -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;
 };

+ 2 - 2
AI/Nullkiller/Goals/AdventureSpellCast.cpp

@@ -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;

+ 2 - 2
AI/Nullkiller/Goals/BuildBoat.cpp

@@ -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;

+ 1 - 1
AI/Nullkiller/Goals/BuyArmy.cpp

@@ -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;

+ 2 - 2
AI/Nullkiller/Goals/CompleteQuest.cpp

@@ -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;

+ 2 - 2
AI/Nullkiller/Goals/ExecuteHeroChain.cpp

@@ -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;