From 87957e74c1af6019d241d76fe7fa47f529f693f2 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 31 Jul 2023 17:00:37 +0300 Subject: [PATCH] Replaced boost::thread_specific_ptr with thread_local --- AI/Nullkiller/AIGateway.cpp | 18 ++++++++++-------- AI/Nullkiller/AIUtility.cpp | 4 ---- AI/Nullkiller/AIUtility.h | 6 ++++-- AI/Nullkiller/Behaviors/BuildingBehavior.cpp | 3 --- AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp | 3 --- .../Behaviors/CaptureObjectsBehavior.cpp | 3 --- AI/Nullkiller/Behaviors/ClusterBehavior.cpp | 3 --- AI/Nullkiller/Behaviors/DefenceBehavior.cpp | 3 --- AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp | 3 --- .../Behaviors/RecruitHeroBehavior.cpp | 3 --- AI/Nullkiller/Behaviors/StartupBehavior.cpp | 3 --- AI/Nullkiller/Engine/DeepDecomposer.cpp | 3 --- AI/Nullkiller/Engine/FuzzyEngines.cpp | 2 -- AI/Nullkiller/Engine/Nullkiller.cpp | 5 +---- AI/Nullkiller/Goals/AbstractGoal.cpp | 3 --- AI/Nullkiller/Goals/AdventureSpellCast.cpp | 3 --- AI/Nullkiller/Goals/BuildBoat.cpp | 3 --- AI/Nullkiller/Goals/BuildThis.cpp | 4 ---- AI/Nullkiller/Goals/BuyArmy.cpp | 3 --- AI/Nullkiller/Goals/CaptureObject.cpp | 2 -- AI/Nullkiller/Goals/CompleteQuest.cpp | 3 --- AI/Nullkiller/Goals/Composition.cpp | 3 --- AI/Nullkiller/Goals/DigAtTile.cpp | 3 --- AI/Nullkiller/Goals/DismissHero.cpp | 3 --- AI/Nullkiller/Goals/ExchangeSwapTownHeroes.cpp | 3 --- AI/Nullkiller/Goals/ExecuteHeroChain.cpp | 3 --- AI/Nullkiller/Goals/RecruitHero.cpp | 3 --- AI/Nullkiller/Goals/SaveResources.cpp | 3 --- AI/Nullkiller/Markers/ArmyUpgrade.cpp | 3 --- AI/Nullkiller/Markers/HeroExchange.cpp | 3 --- AI/Nullkiller/Markers/UnlockCluster.cpp | 3 --- .../Pathfinding/Actions/BattleAction.cpp | 3 --- .../Pathfinding/Actions/BoatActions.cpp | 7 ++----- .../Pathfinding/Actions/BuyArmyAction.cpp | 3 --- .../Pathfinding/Actions/QuestAction.cpp | 3 --- .../Pathfinding/Actions/TownPortalAction.cpp | 5 +---- AI/VCAI/AIUtility.cpp | 4 ---- AI/VCAI/AIUtility.h | 6 ++++-- AI/VCAI/FuzzyEngines.cpp | 3 --- AI/VCAI/FuzzyHelper.cpp | 5 +---- AI/VCAI/FuzzyHelper.h | 2 ++ AI/VCAI/Goals/AbstractGoal.cpp | 4 ---- AI/VCAI/Goals/AdventureSpellCast.cpp | 4 ---- AI/VCAI/Goals/Build.cpp | 5 ----- AI/VCAI/Goals/BuildBoat.cpp | 4 ---- AI/VCAI/Goals/BuildThis.cpp | 5 ----- AI/VCAI/Goals/BuyArmy.cpp | 5 ----- AI/VCAI/Goals/ClearWayTo.cpp | 5 ----- AI/VCAI/Goals/CollectRes.cpp | 5 ----- AI/VCAI/Goals/CompleteQuest.cpp | 4 ---- AI/VCAI/Goals/Conquer.cpp | 5 ----- AI/VCAI/Goals/DigAtTile.cpp | 5 ----- AI/VCAI/Goals/Explore.cpp | 8 ++------ AI/VCAI/Goals/FindObj.cpp | 4 ---- AI/VCAI/Goals/GatherArmy.cpp | 5 ----- AI/VCAI/Goals/GatherTroops.cpp | 5 ----- AI/VCAI/Goals/GetArtOfType.cpp | 7 +------ AI/VCAI/Goals/RecruitHero.cpp | 5 ----- AI/VCAI/Goals/VisitHero.cpp | 4 ---- AI/VCAI/Goals/VisitObj.cpp | 5 ----- AI/VCAI/Goals/VisitTile.cpp | 5 ----- AI/VCAI/Goals/Win.cpp | 5 ----- AI/VCAI/VCAI.cpp | 18 ++++++++++-------- client/mainmenu/CMainMenu.cpp | 4 +++- test/CMakeLists.txt | 2 -- test/vcai/ResourceManagerTest.h | 13 ------------- test/vcai/ResurceManagerTest.cpp | 1 - 67 files changed, 41 insertions(+), 255 deletions(-) delete mode 100644 test/vcai/ResourceManagerTest.h diff --git a/AI/Nullkiller/AIGateway.cpp b/AI/Nullkiller/AIGateway.cpp index 8be0aa310..c0b87dc4f 100644 --- a/AI/Nullkiller/AIGateway.cpp +++ b/AI/Nullkiller/AIGateway.cpp @@ -34,26 +34,26 @@ const float RETREAT_THRESHOLD = 0.3f; const double RETREAT_ABSOLUTE_THRESHOLD = 10000.; //one thread may be turn of AI and another will be handling a side effect for AI2 -boost::thread_specific_ptr cb; -boost::thread_specific_ptr ai; +thread_local CCallback * cb = nullptr; +thread_local AIGateway * ai = nullptr; //helper RAII to manage global ai/cb ptrs struct SetGlobalState { SetGlobalState(AIGateway * AI) { - assert(!ai.get()); - assert(!cb.get()); + assert(!ai); + assert(!cb); - ai.reset(AI); - cb.reset(AI->myCb.get()); + ai = AI; + cb = AI->myCb.get(); } ~SetGlobalState() { //TODO: how to handle rm? shouldn't be called after ai is destroyed, hopefully //TODO: to ensure that, make rm unique_ptr - ai.release(); - cb.release(); + ai = nullptr; + cb = nullptr; } }; @@ -1472,6 +1472,8 @@ void AIGateway::requestActionASAP(std::function whatToDo) boost::shared_lock gsLock(CGameState::mutex); whatToDo(); }); + + newThread.detach(); } void AIGateway::lostHero(HeroPtr h) diff --git a/AI/Nullkiller/AIUtility.cpp b/AI/Nullkiller/AIUtility.cpp index e6962673e..a866f3686 100644 --- a/AI/Nullkiller/AIUtility.cpp +++ b/AI/Nullkiller/AIUtility.cpp @@ -25,10 +25,6 @@ namespace NKAI { -extern boost::thread_specific_ptr ai; - -//extern static const int3 dirs[8]; - const CGObjectInstance * ObjectIdRef::operator->() const { return cb->getObj(id, false); diff --git a/AI/Nullkiller/AIUtility.h b/AI/Nullkiller/AIUtility.h index 60fef0f24..e8e4636ef 100644 --- a/AI/Nullkiller/AIUtility.h +++ b/AI/Nullkiller/AIUtility.h @@ -57,6 +57,7 @@ using dwellingContent = std::pair>; namespace NKAI { struct creInfo; +class AIGateway; class Nullkiller; const int GOLD_MINE_PRODUCTION = 1000, WOOD_ORE_MINE_PRODUCTION = 2, RESOURCE_MINE_PRODUCTION = 1; @@ -67,7 +68,8 @@ const int ALLOWED_ROAMING_HEROES = 8; extern const float SAFE_ATTACK_CONSTANT; extern const int GOLD_RESERVE; -extern boost::thread_specific_ptr cb; +extern thread_local CCallback * cb; +extern thread_local AIGateway * ai; enum HeroRole { @@ -201,7 +203,7 @@ void foreach_tile_pos(CCallback * cbp, const Func & foo) // avoid costly retriev template void foreach_neighbour(const int3 & pos, const Func & foo) { - CCallback * cbp = cb.get(); // avoid costly retrieval of thread-specific pointer + CCallback * cbp = cb; // avoid costly retrieval of thread-specific pointer for(const int3 & dir : int3::getDirs()) { const int3 n = pos + dir; diff --git a/AI/Nullkiller/Behaviors/BuildingBehavior.cpp b/AI/Nullkiller/Behaviors/BuildingBehavior.cpp index 3220ff891..d21b92965 100644 --- a/AI/Nullkiller/Behaviors/BuildingBehavior.cpp +++ b/AI/Nullkiller/Behaviors/BuildingBehavior.cpp @@ -20,9 +20,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; std::string BuildingBehavior::toString() const diff --git a/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp b/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp index 7b2a57396..b5260ac3a 100644 --- a/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp +++ b/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp @@ -17,9 +17,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; std::string BuyArmyBehavior::toString() const diff --git a/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.cpp b/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.cpp index 155f45af6..9ce74a72f 100644 --- a/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.cpp +++ b/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.cpp @@ -19,9 +19,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; template diff --git a/AI/Nullkiller/Behaviors/ClusterBehavior.cpp b/AI/Nullkiller/Behaviors/ClusterBehavior.cpp index ff0679564..cc376acb8 100644 --- a/AI/Nullkiller/Behaviors/ClusterBehavior.cpp +++ b/AI/Nullkiller/Behaviors/ClusterBehavior.cpp @@ -19,9 +19,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; std::string ClusterBehavior::toString() const diff --git a/AI/Nullkiller/Behaviors/DefenceBehavior.cpp b/AI/Nullkiller/Behaviors/DefenceBehavior.cpp index d9bdf3904..ded687924 100644 --- a/AI/Nullkiller/Behaviors/DefenceBehavior.cpp +++ b/AI/Nullkiller/Behaviors/DefenceBehavior.cpp @@ -25,9 +25,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - const float TREAT_IGNORE_RATIO = 2; using namespace Goals; diff --git a/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp b/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp index c73b374c0..935e782f5 100644 --- a/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp +++ b/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp @@ -23,9 +23,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; std::string GatherArmyBehavior::toString() const diff --git a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp index 8f9b80f6d..885cc7af2 100644 --- a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp +++ b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp @@ -17,9 +17,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; std::string RecruitHeroBehavior::toString() const diff --git a/AI/Nullkiller/Behaviors/StartupBehavior.cpp b/AI/Nullkiller/Behaviors/StartupBehavior.cpp index 820beb75f..84abb41fe 100644 --- a/AI/Nullkiller/Behaviors/StartupBehavior.cpp +++ b/AI/Nullkiller/Behaviors/StartupBehavior.cpp @@ -21,9 +21,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; std::string StartupBehavior::toString() const diff --git a/AI/Nullkiller/Engine/DeepDecomposer.cpp b/AI/Nullkiller/Engine/DeepDecomposer.cpp index 8e649634f..88fd3ed5b 100644 --- a/AI/Nullkiller/Engine/DeepDecomposer.cpp +++ b/AI/Nullkiller/Engine/DeepDecomposer.cpp @@ -24,9 +24,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; void DeepDecomposer::reset() diff --git a/AI/Nullkiller/Engine/FuzzyEngines.cpp b/AI/Nullkiller/Engine/FuzzyEngines.cpp index 2afe4f5ef..c20b39143 100644 --- a/AI/Nullkiller/Engine/FuzzyEngines.cpp +++ b/AI/Nullkiller/Engine/FuzzyEngines.cpp @@ -20,8 +20,6 @@ namespace NKAI #define MIN_AI_STRENGTH (0.5f) //lower when combat AI gets smarter #define UNGUARDED_OBJECT (100.0f) //we consider unguarded objects 100 times weaker than us -extern boost::thread_specific_ptr ai; - engineBase::engineBase() { rules = new fl::RuleBlock(); diff --git a/AI/Nullkiller/Engine/Nullkiller.cpp b/AI/Nullkiller/Engine/Nullkiller.cpp index d6d7f41dc..8c75b8006 100644 --- a/AI/Nullkiller/Engine/Nullkiller.cpp +++ b/AI/Nullkiller/Engine/Nullkiller.cpp @@ -24,9 +24,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; #if NKAI_TRACE_LEVEL >= 1 @@ -341,7 +338,7 @@ void Nullkiller::executeTask(Goals::TTask task) try { - task->accept(ai.get()); + task->accept(ai); logAi->trace("Task %s completed in %lld", taskDescr, timeElapsed(start)); } catch(goalFulfilledException &) diff --git a/AI/Nullkiller/Goals/AbstractGoal.cpp b/AI/Nullkiller/Goals/AbstractGoal.cpp index fd27579c5..1cc45a12a 100644 --- a/AI/Nullkiller/Goals/AbstractGoal.cpp +++ b/AI/Nullkiller/Goals/AbstractGoal.cpp @@ -15,9 +15,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; TSubgoal Goals::sptr(const AbstractGoal & tmp) diff --git a/AI/Nullkiller/Goals/AdventureSpellCast.cpp b/AI/Nullkiller/Goals/AdventureSpellCast.cpp index 8a8a3cf96..7e62e7d42 100644 --- a/AI/Nullkiller/Goals/AdventureSpellCast.cpp +++ b/AI/Nullkiller/Goals/AdventureSpellCast.cpp @@ -14,9 +14,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; bool AdventureSpellCast::operator==(const AdventureSpellCast & other) const diff --git a/AI/Nullkiller/Goals/BuildBoat.cpp b/AI/Nullkiller/Goals/BuildBoat.cpp index e69b90d3e..86b274f5f 100644 --- a/AI/Nullkiller/Goals/BuildBoat.cpp +++ b/AI/Nullkiller/Goals/BuildBoat.cpp @@ -15,9 +15,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; bool BuildBoat::operator==(const BuildBoat & other) const diff --git a/AI/Nullkiller/Goals/BuildThis.cpp b/AI/Nullkiller/Goals/BuildThis.cpp index d61caae44..2f371346e 100644 --- a/AI/Nullkiller/Goals/BuildThis.cpp +++ b/AI/Nullkiller/Goals/BuildThis.cpp @@ -17,12 +17,8 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; - BuildThis::BuildThis(BuildingID Bid, const CGTownInstance * tid) : ElementarGoal(Goals::BUILD_STRUCTURE) { diff --git a/AI/Nullkiller/Goals/BuyArmy.cpp b/AI/Nullkiller/Goals/BuyArmy.cpp index f2e4aca05..3bc3c0faf 100644 --- a/AI/Nullkiller/Goals/BuyArmy.cpp +++ b/AI/Nullkiller/Goals/BuyArmy.cpp @@ -17,9 +17,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; bool BuyArmy::operator==(const BuyArmy & other) const diff --git a/AI/Nullkiller/Goals/CaptureObject.cpp b/AI/Nullkiller/Goals/CaptureObject.cpp index 0dd71dc93..35a5d4417 100644 --- a/AI/Nullkiller/Goals/CaptureObject.cpp +++ b/AI/Nullkiller/Goals/CaptureObject.cpp @@ -18,8 +18,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; - using namespace Goals; bool CaptureObject::operator==(const CaptureObject & other) const diff --git a/AI/Nullkiller/Goals/CompleteQuest.cpp b/AI/Nullkiller/Goals/CompleteQuest.cpp index 6e39c3d47..e4d3fda47 100644 --- a/AI/Nullkiller/Goals/CompleteQuest.cpp +++ b/AI/Nullkiller/Goals/CompleteQuest.cpp @@ -17,9 +17,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; bool isKeyMaster(const QuestInfo & q) diff --git a/AI/Nullkiller/Goals/Composition.cpp b/AI/Nullkiller/Goals/Composition.cpp index 30d3791f9..ca77dc5e8 100644 --- a/AI/Nullkiller/Goals/Composition.cpp +++ b/AI/Nullkiller/Goals/Composition.cpp @@ -17,9 +17,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; bool Composition::operator==(const Composition & other) const diff --git a/AI/Nullkiller/Goals/DigAtTile.cpp b/AI/Nullkiller/Goals/DigAtTile.cpp index a573bfbd0..6dce16b59 100644 --- a/AI/Nullkiller/Goals/DigAtTile.cpp +++ b/AI/Nullkiller/Goals/DigAtTile.cpp @@ -16,9 +16,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; bool DigAtTile::operator==(const DigAtTile & other) const diff --git a/AI/Nullkiller/Goals/DismissHero.cpp b/AI/Nullkiller/Goals/DismissHero.cpp index ce26e4f10..543b16e29 100644 --- a/AI/Nullkiller/Goals/DismissHero.cpp +++ b/AI/Nullkiller/Goals/DismissHero.cpp @@ -14,9 +14,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; bool DismissHero::operator==(const DismissHero & other) const diff --git a/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.cpp b/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.cpp index 80e8af201..12ff31847 100644 --- a/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.cpp +++ b/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.cpp @@ -16,9 +16,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; ExchangeSwapTownHeroes::ExchangeSwapTownHeroes( diff --git a/AI/Nullkiller/Goals/ExecuteHeroChain.cpp b/AI/Nullkiller/Goals/ExecuteHeroChain.cpp index d367f96b4..438c88b07 100644 --- a/AI/Nullkiller/Goals/ExecuteHeroChain.cpp +++ b/AI/Nullkiller/Goals/ExecuteHeroChain.cpp @@ -15,9 +15,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; ExecuteHeroChain::ExecuteHeroChain(const AIPath & path, const CGObjectInstance * obj) diff --git a/AI/Nullkiller/Goals/RecruitHero.cpp b/AI/Nullkiller/Goals/RecruitHero.cpp index e787c7529..fe4aaeb6f 100644 --- a/AI/Nullkiller/Goals/RecruitHero.cpp +++ b/AI/Nullkiller/Goals/RecruitHero.cpp @@ -17,9 +17,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; std::string RecruitHero::toString() const diff --git a/AI/Nullkiller/Goals/SaveResources.cpp b/AI/Nullkiller/Goals/SaveResources.cpp index 2cf03fc4c..6499ea457 100644 --- a/AI/Nullkiller/Goals/SaveResources.cpp +++ b/AI/Nullkiller/Goals/SaveResources.cpp @@ -15,9 +15,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; bool SaveResources::operator==(const SaveResources & other) const diff --git a/AI/Nullkiller/Markers/ArmyUpgrade.cpp b/AI/Nullkiller/Markers/ArmyUpgrade.cpp index 0f6d41090..ff61a6454 100644 --- a/AI/Nullkiller/Markers/ArmyUpgrade.cpp +++ b/AI/Nullkiller/Markers/ArmyUpgrade.cpp @@ -16,9 +16,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; ArmyUpgrade::ArmyUpgrade(const AIPath & upgradePath, const CGObjectInstance * upgrader, const ArmyUpgradeInfo & upgrade) diff --git a/AI/Nullkiller/Markers/HeroExchange.cpp b/AI/Nullkiller/Markers/HeroExchange.cpp index 499122327..cef89c1db 100644 --- a/AI/Nullkiller/Markers/HeroExchange.cpp +++ b/AI/Nullkiller/Markers/HeroExchange.cpp @@ -17,9 +17,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; bool HeroExchange::operator==(const HeroExchange & other) const diff --git a/AI/Nullkiller/Markers/UnlockCluster.cpp b/AI/Nullkiller/Markers/UnlockCluster.cpp index bbf7c99c7..c52ee8345 100644 --- a/AI/Nullkiller/Markers/UnlockCluster.cpp +++ b/AI/Nullkiller/Markers/UnlockCluster.cpp @@ -16,9 +16,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - using namespace Goals; bool UnlockCluster::operator==(const UnlockCluster & other) const diff --git a/AI/Nullkiller/Pathfinding/Actions/BattleAction.cpp b/AI/Nullkiller/Pathfinding/Actions/BattleAction.cpp index b85bff624..33248df50 100644 --- a/AI/Nullkiller/Pathfinding/Actions/BattleAction.cpp +++ b/AI/Nullkiller/Pathfinding/Actions/BattleAction.cpp @@ -16,9 +16,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - namespace AIPathfinding { void BattleAction::execute(const CGHeroInstance * hero) const diff --git a/AI/Nullkiller/Pathfinding/Actions/BoatActions.cpp b/AI/Nullkiller/Pathfinding/Actions/BoatActions.cpp index 9fcf052ce..bbd1e5297 100644 --- a/AI/Nullkiller/Pathfinding/Actions/BoatActions.cpp +++ b/AI/Nullkiller/Pathfinding/Actions/BoatActions.cpp @@ -20,14 +20,11 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - namespace AIPathfinding { void BuildBoatAction::execute(const CGHeroInstance * hero) const { - return Goals::BuildBoat(shipyard).accept(ai.get()); + return Goals::BuildBoat(shipyard).accept(ai); } Goals::TSubgoal BuildBoatAction::decompose(const CGHeroInstance * hero) const @@ -80,7 +77,7 @@ namespace AIPathfinding void SummonBoatAction::execute(const CGHeroInstance * hero) const { - Goals::AdventureSpellCast(hero, SpellID::SUMMON_BOAT).accept(ai.get()); + Goals::AdventureSpellCast(hero, SpellID::SUMMON_BOAT).accept(ai); } const ChainActor * SummonBoatAction::getActor(const ChainActor * sourceActor) const diff --git a/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.cpp b/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.cpp index 683f42246..a676ad5c1 100644 --- a/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.cpp +++ b/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.cpp @@ -16,9 +16,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - namespace AIPathfinding { void BuyArmyAction::execute(const CGHeroInstance * hero) const diff --git a/AI/Nullkiller/Pathfinding/Actions/QuestAction.cpp b/AI/Nullkiller/Pathfinding/Actions/QuestAction.cpp index a552ff2af..dae8c7bb2 100644 --- a/AI/Nullkiller/Pathfinding/Actions/QuestAction.cpp +++ b/AI/Nullkiller/Pathfinding/Actions/QuestAction.cpp @@ -16,9 +16,6 @@ namespace NKAI { -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - namespace AIPathfinding { bool QuestAction::canAct(const AIPathNode * node) const diff --git a/AI/Nullkiller/Pathfinding/Actions/TownPortalAction.cpp b/AI/Nullkiller/Pathfinding/Actions/TownPortalAction.cpp index 2304e39dd..e32a13231 100644 --- a/AI/Nullkiller/Pathfinding/Actions/TownPortalAction.cpp +++ b/AI/Nullkiller/Pathfinding/Actions/TownPortalAction.cpp @@ -18,9 +18,6 @@ namespace NKAI using namespace AIPathfinding; -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; - void TownPortalAction::execute(const CGHeroInstance * hero) const { auto goal = Goals::AdventureSpellCast(hero, SpellID::TOWN_PORTAL); @@ -28,7 +25,7 @@ void TownPortalAction::execute(const CGHeroInstance * hero) const goal.town = target; goal.tile = target->visitablePos(); - goal.accept(ai.get()); + goal.accept(ai); } std::string TownPortalAction::toString() const diff --git a/AI/VCAI/AIUtility.cpp b/AI/VCAI/AIUtility.cpp index e73ddf191..ff70a870d 100644 --- a/AI/VCAI/AIUtility.cpp +++ b/AI/VCAI/AIUtility.cpp @@ -21,12 +21,8 @@ #include "../../lib/mapObjects/CQuest.h" #include "../../lib/mapping/CMapDefines.h" -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; extern FuzzyHelper * fh; -//extern static const int3 dirs[8]; - const CGObjectInstance * ObjectIdRef::operator->() const { return cb->getObj(id, false); diff --git a/AI/VCAI/AIUtility.h b/AI/VCAI/AIUtility.h index ab1dc6521..fb1346382 100644 --- a/AI/VCAI/AIUtility.h +++ b/AI/VCAI/AIUtility.h @@ -18,6 +18,7 @@ #include "../../lib/mapObjects/CGHeroInstance.h" #include "../../CCallback.h" +class VCAI; class CCallback; struct creInfo; @@ -33,7 +34,8 @@ const int ALLOWED_ROAMING_HEROES = 8; extern const double SAFE_ATTACK_CONSTANT; extern const int GOLD_RESERVE; -extern boost::thread_specific_ptr cb; +extern thread_local CCallback * cb; +extern thread_local VCAI * ai; //provisional class for AI to store a reference to an owned hero object //checks if it's valid on access, should be used in place of const CGHeroInstance* @@ -192,7 +194,7 @@ void foreach_tile_pos(CCallback * cbp, const Func & foo) // avoid costly retriev template void foreach_neighbour(const int3 & pos, const Func & foo) { - CCallback * cbp = cb.get(); // avoid costly retrieval of thread-specific pointer + CCallback * cbp = cb; // avoid costly retrieval of thread-specific pointer for(const int3 & dir : int3::getDirs()) { const int3 n = pos + dir; diff --git a/AI/VCAI/FuzzyEngines.cpp b/AI/VCAI/FuzzyEngines.cpp index 39003ee2f..91ba40139 100644 --- a/AI/VCAI/FuzzyEngines.cpp +++ b/AI/VCAI/FuzzyEngines.cpp @@ -18,9 +18,6 @@ #define MIN_AI_STRENGTH (0.5f) //lower when combat AI gets smarter #define UNGUARDED_OBJECT (100.0f) //we consider unguarded objects 100 times weaker than us -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - engineBase::engineBase() { rules = new fl::RuleBlock(); diff --git a/AI/VCAI/FuzzyHelper.cpp b/AI/VCAI/FuzzyHelper.cpp index e6973b597..78595c49c 100644 --- a/AI/VCAI/FuzzyHelper.cpp +++ b/AI/VCAI/FuzzyHelper.cpp @@ -23,9 +23,6 @@ FuzzyHelper * fh; -extern boost::thread_specific_ptr ai; -extern boost::thread_specific_ptr cb; - Goals::TSubgoal FuzzyHelper::chooseSolution(Goals::TGoalVec vec) { if(vec.empty()) @@ -216,7 +213,7 @@ void FuzzyHelper::setPriority(Goals::TSubgoal & g) //calls evaluate - Visitor pa ui64 FuzzyHelper::evaluateDanger(crint3 tile, const CGHeroInstance * visitor) { - return evaluateDanger(tile, visitor, ai.get()); + return evaluateDanger(tile, visitor, ai); } ui64 FuzzyHelper::evaluateDanger(crint3 tile, const CGHeroInstance * visitor, const VCAI * ai) diff --git a/AI/VCAI/FuzzyHelper.h b/AI/VCAI/FuzzyHelper.h index 6973df463..7542e7f70 100644 --- a/AI/VCAI/FuzzyHelper.h +++ b/AI/VCAI/FuzzyHelper.h @@ -51,3 +51,5 @@ public: ui64 evaluateDanger(crint3 tile, const CGHeroInstance * visitor, const VCAI * ai); ui64 evaluateDanger(crint3 tile, const CGHeroInstance * visitor); }; + +extern FuzzyHelper * fh; diff --git a/AI/VCAI/Goals/AbstractGoal.cpp b/AI/VCAI/Goals/AbstractGoal.cpp index 87a04f089..45b055d25 100644 --- a/AI/VCAI/Goals/AbstractGoal.cpp +++ b/AI/VCAI/Goals/AbstractGoal.cpp @@ -16,10 +16,6 @@ #include "../BuildingManager.h" #include "../../../lib/StringConstants.h" -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; TSubgoal Goals::sptr(const AbstractGoal & tmp) diff --git a/AI/VCAI/Goals/AdventureSpellCast.cpp b/AI/VCAI/Goals/AdventureSpellCast.cpp index c67d81d66..7c3f7500f 100644 --- a/AI/VCAI/Goals/AdventureSpellCast.cpp +++ b/AI/VCAI/Goals/AdventureSpellCast.cpp @@ -14,10 +14,6 @@ #include "../AIhelper.h" #include "../../../lib/mapObjects/CGTownInstance.h" -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool AdventureSpellCast::operator==(const AdventureSpellCast & other) const diff --git a/AI/VCAI/Goals/Build.cpp b/AI/VCAI/Goals/Build.cpp index 3bd78b9ef..182c8a4f4 100644 --- a/AI/VCAI/Goals/Build.cpp +++ b/AI/VCAI/Goals/Build.cpp @@ -19,11 +19,6 @@ #include "../../../lib/mapObjects/CGTownInstance.h" #include "../../../lib/StringConstants.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; TGoalVec Build::getAllPossibleSubgoals() diff --git a/AI/VCAI/Goals/BuildBoat.cpp b/AI/VCAI/Goals/BuildBoat.cpp index 76e76791f..9f7f452ca 100644 --- a/AI/VCAI/Goals/BuildBoat.cpp +++ b/AI/VCAI/Goals/BuildBoat.cpp @@ -13,10 +13,6 @@ #include "../FuzzyHelper.h" #include "../AIhelper.h" -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool BuildBoat::operator==(const BuildBoat & other) const diff --git a/AI/VCAI/Goals/BuildThis.cpp b/AI/VCAI/Goals/BuildThis.cpp index 9a62539a7..703f66784 100644 --- a/AI/VCAI/Goals/BuildThis.cpp +++ b/AI/VCAI/Goals/BuildThis.cpp @@ -18,11 +18,6 @@ #include "../../../lib/mapObjects/CGTownInstance.h" #include "../../../lib/StringConstants.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool BuildThis::operator==(const BuildThis & other) const diff --git a/AI/VCAI/Goals/BuyArmy.cpp b/AI/VCAI/Goals/BuyArmy.cpp index f442c3dc5..7c3facb29 100644 --- a/AI/VCAI/Goals/BuyArmy.cpp +++ b/AI/VCAI/Goals/BuyArmy.cpp @@ -13,11 +13,6 @@ #include "../AIhelper.h" #include "../../../lib/mapObjects/CGTownInstance.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool BuyArmy::operator==(const BuyArmy & other) const diff --git a/AI/VCAI/Goals/ClearWayTo.cpp b/AI/VCAI/Goals/ClearWayTo.cpp index e20c26ad5..ddea93732 100644 --- a/AI/VCAI/Goals/ClearWayTo.cpp +++ b/AI/VCAI/Goals/ClearWayTo.cpp @@ -16,11 +16,6 @@ #include "../FuzzyHelper.h" #include "../AIhelper.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool ClearWayTo::operator==(const ClearWayTo & other) const diff --git a/AI/VCAI/Goals/CollectRes.cpp b/AI/VCAI/Goals/CollectRes.cpp index 35d66413d..8494952e2 100644 --- a/AI/VCAI/Goals/CollectRes.cpp +++ b/AI/VCAI/Goals/CollectRes.cpp @@ -18,11 +18,6 @@ #include "../../../lib/mapObjects/CGMarket.h" #include "../../../lib/StringConstants.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool CollectRes::operator==(const CollectRes & other) const diff --git a/AI/VCAI/Goals/CompleteQuest.cpp b/AI/VCAI/Goals/CompleteQuest.cpp index 164aacb3c..f724e308b 100644 --- a/AI/VCAI/Goals/CompleteQuest.cpp +++ b/AI/VCAI/Goals/CompleteQuest.cpp @@ -14,10 +14,6 @@ #include "../AIhelper.h" #include "../../../lib/mapObjects/CQuest.h" -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool CompleteQuest::operator==(const CompleteQuest & other) const diff --git a/AI/VCAI/Goals/Conquer.cpp b/AI/VCAI/Goals/Conquer.cpp index 3f9f4b16c..f18b629ed 100644 --- a/AI/VCAI/Goals/Conquer.cpp +++ b/AI/VCAI/Goals/Conquer.cpp @@ -17,11 +17,6 @@ #include "../BuildingManager.h" #include "../../../lib/StringConstants.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool Conquer::operator==(const Conquer & other) const diff --git a/AI/VCAI/Goals/DigAtTile.cpp b/AI/VCAI/Goals/DigAtTile.cpp index 230d62a5e..2ff0343e9 100644 --- a/AI/VCAI/Goals/DigAtTile.cpp +++ b/AI/VCAI/Goals/DigAtTile.cpp @@ -13,11 +13,6 @@ #include "../VCAI.h" #include "../AIUtility.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool DigAtTile::operator==(const DigAtTile & other) const diff --git a/AI/VCAI/Goals/Explore.cpp b/AI/VCAI/Goals/Explore.cpp index 777b1a8ae..13571423f 100644 --- a/AI/VCAI/Goals/Explore.cpp +++ b/AI/VCAI/Goals/Explore.cpp @@ -18,10 +18,6 @@ #include "../../../lib/StringConstants.h" #include "../../../lib/CPlayerState.h" -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; namespace Goals @@ -41,8 +37,8 @@ namespace Goals ExplorationHelper(HeroPtr h, bool gatherArmy) { - cbp = cb.get(); - aip = ai.get(); + cbp = cb; + aip = ai; hero = h; ts = cbp->getPlayerTeam(ai->playerID); sightRadius = hero->getSightRadius(); diff --git a/AI/VCAI/Goals/FindObj.cpp b/AI/VCAI/Goals/FindObj.cpp index 4588ca4e5..e14c3320c 100644 --- a/AI/VCAI/Goals/FindObj.cpp +++ b/AI/VCAI/Goals/FindObj.cpp @@ -14,10 +14,6 @@ #include "../VCAI.h" #include "../AIUtility.h" -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool FindObj::operator==(const FindObj & other) const diff --git a/AI/VCAI/Goals/GatherArmy.cpp b/AI/VCAI/Goals/GatherArmy.cpp index c36e282e5..2e7ef718f 100644 --- a/AI/VCAI/Goals/GatherArmy.cpp +++ b/AI/VCAI/Goals/GatherArmy.cpp @@ -18,11 +18,6 @@ #include "../../../lib/mapObjects/CGTownInstance.h" #include "../../../lib/StringConstants.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool GatherArmy::operator==(const GatherArmy & other) const diff --git a/AI/VCAI/Goals/GatherTroops.cpp b/AI/VCAI/Goals/GatherTroops.cpp index a93960237..7af7098e2 100644 --- a/AI/VCAI/Goals/GatherTroops.cpp +++ b/AI/VCAI/Goals/GatherTroops.cpp @@ -18,11 +18,6 @@ #include "../../../lib/mapObjects/CGTownInstance.h" #include "../../../lib/StringConstants.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool GatherTroops::operator==(const GatherTroops & other) const diff --git a/AI/VCAI/Goals/GetArtOfType.cpp b/AI/VCAI/Goals/GetArtOfType.cpp index 5195796ec..2f0ef2227 100644 --- a/AI/VCAI/Goals/GetArtOfType.cpp +++ b/AI/VCAI/Goals/GetArtOfType.cpp @@ -13,11 +13,6 @@ #include "../VCAI.h" #include "../AIUtility.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool GetArtOfType::operator==(const GetArtOfType & other) const @@ -28,4 +23,4 @@ bool GetArtOfType::operator==(const GetArtOfType & other) const TSubgoal GetArtOfType::whatToDoToAchieve() { return sptr(FindObj(Obj::ARTIFACT, aid)); -} \ No newline at end of file +} diff --git a/AI/VCAI/Goals/RecruitHero.cpp b/AI/VCAI/Goals/RecruitHero.cpp index 73f24762c..99c5dd0f2 100644 --- a/AI/VCAI/Goals/RecruitHero.cpp +++ b/AI/VCAI/Goals/RecruitHero.cpp @@ -17,11 +17,6 @@ #include "../BuildingManager.h" #include "../../../lib/StringConstants.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; TSubgoal RecruitHero::whatToDoToAchieve() diff --git a/AI/VCAI/Goals/VisitHero.cpp b/AI/VCAI/Goals/VisitHero.cpp index efb4840d3..5e57743fd 100644 --- a/AI/VCAI/Goals/VisitHero.cpp +++ b/AI/VCAI/Goals/VisitHero.cpp @@ -18,10 +18,6 @@ #include "../ResourceManager.h" #include "../BuildingManager.h" -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool VisitHero::operator==(const VisitHero & other) const diff --git a/AI/VCAI/Goals/VisitObj.cpp b/AI/VCAI/Goals/VisitObj.cpp index 5aab8cf06..be52de94d 100644 --- a/AI/VCAI/Goals/VisitObj.cpp +++ b/AI/VCAI/Goals/VisitObj.cpp @@ -17,11 +17,6 @@ #include "../BuildingManager.h" #include "../../../lib/StringConstants.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool VisitObj::operator==(const VisitObj & other) const diff --git a/AI/VCAI/Goals/VisitTile.cpp b/AI/VCAI/Goals/VisitTile.cpp index eaec6efbb..369ba7380 100644 --- a/AI/VCAI/Goals/VisitTile.cpp +++ b/AI/VCAI/Goals/VisitTile.cpp @@ -17,11 +17,6 @@ #include "../BuildingManager.h" #include "../../../lib/StringConstants.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; bool VisitTile::operator==(const VisitTile & other) const diff --git a/AI/VCAI/Goals/Win.cpp b/AI/VCAI/Goals/Win.cpp index 4b4958ed7..f2a3b3dce 100644 --- a/AI/VCAI/Goals/Win.cpp +++ b/AI/VCAI/Goals/Win.cpp @@ -19,11 +19,6 @@ #include "../../../lib/mapObjects/CGTownInstance.h" #include "../../../lib/StringConstants.h" - -extern boost::thread_specific_ptr cb; -extern boost::thread_specific_ptr ai; -extern FuzzyHelper * fh; - using namespace Goals; TSubgoal Win::whatToDoToAchieve() diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index 8fd3ac923..7661dfba5 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -38,8 +38,8 @@ extern FuzzyHelper * fh; const double SAFE_ATTACK_CONSTANT = 1.5; //one thread may be turn of AI and another will be handling a side effect for AI2 -boost::thread_specific_ptr cb; -boost::thread_specific_ptr ai; +thread_local CCallback * cb = nullptr; +thread_local VCAI * ai = nullptr; //std::map > HeroView::infosCount; @@ -48,18 +48,18 @@ struct SetGlobalState { SetGlobalState(VCAI * AI) { - assert(!ai.get()); - assert(!cb.get()); + assert(!ai); + assert(!cb); - ai.reset(AI); - cb.reset(AI->myCb.get()); + ai = AI; + cb = AI->myCb.get(); } ~SetGlobalState() { //TODO: how to handle rm? shouldn't be called after ai is destroyed, hopefully //TODO: to ensure that, make rm unique_ptr - ai.release(); - cb.release(); + ai = nullptr; + cb = nullptr; } }; @@ -2497,6 +2497,8 @@ void VCAI::requestActionASAP(std::function whatToDo) boost::shared_lock gsLock(CGameState::mutex); whatToDo(); }); + + newThread.detach(); } void VCAI::lostHero(HeroPtr h) diff --git a/client/mainmenu/CMainMenu.cpp b/client/mainmenu/CMainMenu.cpp index 68cf793bf..407dc66eb 100644 --- a/client/mainmenu/CMainMenu.cpp +++ b/client/mainmenu/CMainMenu.cpp @@ -562,7 +562,9 @@ void CSimpleJoinScreen::startConnectThread(const std::string & addr, ui16 port) // https://github.com/libsdl-org/SDL/blob/main/docs/README-android.md#threads-and-the-java-vm CVCMIServer::reuseClientJNIEnv(SDL_AndroidGetJNIEnv()); #endif - boost::thread(&CSimpleJoinScreen::connectThread, this, addr, port); + boost::thread connector(&CSimpleJoinScreen::connectThread, this, addr, port); + + connector.detach(); } void CSimpleJoinScreen::connectThread(const std::string & addr, ui16 port) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 847978cb3..b0e26de4f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -92,8 +92,6 @@ set(test_HEADERS spells/targetConditions/TargetConditionItemFixture.h - vcai/ResourceManagerTest.h - mock/BattleFake.h mock/mock_BonusBearer.h mock/mock_IGameCallback.h diff --git a/test/vcai/ResourceManagerTest.h b/test/vcai/ResourceManagerTest.h deleted file mode 100644 index 4b3992cca..000000000 --- a/test/vcai/ResourceManagerTest.h +++ /dev/null @@ -1,13 +0,0 @@ -/* -* ResourceManagerTest.h, part of VCMI engine -* -* Authors: listed in file AUTHORS in main folder -* -* License: GNU General Public License v2.0 or later -* Full text of license available in license.txt file, in main folder -* -*/ - -#pragma once - -extern boost::thread_specific_ptr cb; \ No newline at end of file diff --git a/test/vcai/ResurceManagerTest.cpp b/test/vcai/ResurceManagerTest.cpp index df6fd90be..c7a4cb840 100644 --- a/test/vcai/ResurceManagerTest.cpp +++ b/test/vcai/ResurceManagerTest.cpp @@ -12,7 +12,6 @@ #include "gtest/gtest.h" #include "../AI/VCAI/VCAI.h" -#include "ResourceManagerTest.h" #include "../AI/VCAI/Goals/Goals.h" #include "mock_VCAI_CGoal.h" #include "mock_VCAI.h"