diff --git a/AI/Nullkiller/AIGateway.h b/AI/Nullkiller/AIGateway.h index 1577e3b30..c9eab5088 100644 --- a/AI/Nullkiller/AIGateway.h +++ b/AI/Nullkiller/AIGateway.h @@ -19,7 +19,7 @@ #include "../../lib/mapObjects/MiscObjects.h" #include "../../lib/spells/CSpellHandler.h" #include "Pathfinding/AIPathfinder.h" -#include "Engine/Nullkiller2.h" +#include "Engine/Nullkiller.h" VCMI_LIB_NAMESPACE_BEGIN class AsyncRunner; @@ -80,7 +80,7 @@ public: public: ObjectInstanceID selectedObject; - std::unique_ptr nullkiller2; + std::unique_ptr nullkiller2; AIGateway(); ~AIGateway(); diff --git a/AI/Nullkiller/AIUtility.cpp b/AI/Nullkiller/AIUtility.cpp index 717257b91..6b2c389d4 100644 --- a/AI/Nullkiller/AIUtility.cpp +++ b/AI/Nullkiller/AIUtility.cpp @@ -209,7 +209,7 @@ bool canBeEmbarkmentPoint(const TerrainTile * t, bool fromWater) return false; } -bool isObjectPassable(const Nullkiller2 * ai, const CGObjectInstance * obj) +bool isObjectPassable(const Nullkiller * ai, const CGObjectInstance * obj) { return isObjectPassable(obj, ai->playerID, ai->cb->getPlayerRelations(obj->tempOwner, ai->playerID)); } @@ -600,7 +600,7 @@ int64_t getArtifactScoreForHero(const CGHeroInstance * hero, const CArtifactInst return totalScore; } -bool isWeeklyRevisitable(const Nullkiller2 * ai, const CGObjectInstance * obj) +bool isWeeklyRevisitable(const Nullkiller * ai, const CGObjectInstance * obj) { if(!obj) return false; @@ -644,7 +644,7 @@ int getDuplicatingSlots(const CArmedInstance * army) } // todo: move to obj manager -bool shouldVisit(const Nullkiller2 * ai, const CGHeroInstance * h, const CGObjectInstance * obj) +bool shouldVisit(const Nullkiller * ai, const CGHeroInstance * h, const CGObjectInstance * obj) { auto relations = ai->cb->getPlayerRelations(obj->tempOwner, h->tempOwner); diff --git a/AI/Nullkiller/AIUtility.h b/AI/Nullkiller/AIUtility.h index 6b8a2b0b7..a6f85fe22 100644 --- a/AI/Nullkiller/AIUtility.h +++ b/AI/Nullkiller/AIUtility.h @@ -55,7 +55,7 @@ namespace NKAI { struct creInfo; class AIGateway; -class Nullkiller2; +class Nullkiller; const int GOLD_MINE_PRODUCTION = 1000; const int WOOD_ORE_MINE_PRODUCTION = 2; @@ -201,11 +201,11 @@ void foreach_neighbour(CCallback * cbp, const int3 & pos, const Func & foo) // a } bool canBeEmbarkmentPoint(const TerrainTile * t, bool fromWater); -bool isObjectPassable(const Nullkiller2 * ai, const CGObjectInstance * obj); +bool isObjectPassable(const Nullkiller * ai, const CGObjectInstance * obj); bool isObjectPassable(const CGObjectInstance * obj, PlayerColor playerColor, PlayerRelations objectRelations); bool isBlockVisitObj(const int3 & pos); -bool isWeeklyRevisitable(const Nullkiller2 * ai, const CGObjectInstance * obj); +bool isWeeklyRevisitable(const Nullkiller * ai, const CGObjectInstance * obj); bool isObjectRemovable(const CGObjectInstance * obj); //FIXME FIXME: move logic to object property! bool isSafeToVisit(const CGHeroInstance * h, uint64_t dangerStrength, float safeAttackRatio); @@ -222,7 +222,7 @@ uint64_t getHeroArmyStrengthWithCommander(const CGHeroInstance * hero, const CCr uint64_t timeElapsed(std::chrono::time_point start); // todo: move to obj manager -bool shouldVisit(const Nullkiller2 * ai, const CGHeroInstance * h, const CGObjectInstance * obj); +bool shouldVisit(const Nullkiller * ai, const CGHeroInstance * h, const CGObjectInstance * obj); int getDuplicatingSlots(const CArmedInstance * army); template diff --git a/AI/Nullkiller/Analyzers/ArmyManager.cpp b/AI/Nullkiller/Analyzers/ArmyManager.cpp index 0295b5d46..418a64cd8 100644 --- a/AI/Nullkiller/Analyzers/ArmyManager.cpp +++ b/AI/Nullkiller/Analyzers/ArmyManager.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ArmyManager.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/mapObjects/MapObjects.h" #include "../../../lib/mapping/TerrainTile.h" #include "../../../lib/IGameSettings.h" diff --git a/AI/Nullkiller/Analyzers/ArmyManager.h b/AI/Nullkiller/Analyzers/ArmyManager.h index f89fed6e7..b65a92821 100644 --- a/AI/Nullkiller/Analyzers/ArmyManager.h +++ b/AI/Nullkiller/Analyzers/ArmyManager.h @@ -18,7 +18,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; struct SlotInfo { @@ -83,11 +83,11 @@ class DLL_EXPORT ArmyManager : public IArmyManager { private: CPlayerSpecificInfoCallback * cb; //this is enough, but we downcast from CCallback - const Nullkiller2 * ai; + const Nullkiller * ai; std::map totalArmy; public: - ArmyManager(CPlayerSpecificInfoCallback * CB, const Nullkiller2 * ai): cb(CB), ai(ai) {} + ArmyManager(CPlayerSpecificInfoCallback * CB, const Nullkiller * ai): cb(CB), ai(ai) {} void update() override; ui64 howManyReinforcementsCanBuy(const CCreatureSet * target, const CGDwelling * source) const override; diff --git a/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp b/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp index 1d5cfa5cd..50632095d 100644 --- a/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp +++ b/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp @@ -8,8 +8,8 @@ * */ #include "../StdInc.h" -#include "../Engine/Nullkiller2.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/entities/building/CBuilding.h" #include "../../../lib/IGameSettings.h" @@ -405,7 +405,7 @@ BuildingInfo::BuildingInfo( const CCreature * creature, CreatureID baseCreature, const CGTownInstance * town, - Nullkiller2 * ai) + Nullkiller * ai) { id = building->bid; buildCost = building->resources; diff --git a/AI/Nullkiller/Analyzers/BuildAnalyzer.h b/AI/Nullkiller/Analyzers/BuildAnalyzer.h index ea28174ad..9625b9591 100644 --- a/AI/Nullkiller/Analyzers/BuildAnalyzer.h +++ b/AI/Nullkiller/Analyzers/BuildAnalyzer.h @@ -15,7 +15,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; class DLL_EXPORT BuildingInfo { @@ -44,7 +44,7 @@ public: const CCreature * creature, CreatureID baseCreature, const CGTownInstance * town, - Nullkiller2 * ai); + Nullkiller * ai); std::string toString() const; }; @@ -85,10 +85,10 @@ private: TResources armyCost; TResources dailyIncome; float goldPressure; - Nullkiller2 * ai; + Nullkiller * ai; public: - BuildAnalyzer(Nullkiller2 * ai) : ai(ai) {} + BuildAnalyzer(Nullkiller * ai) : ai(ai) {} void update(); TResources getResourcesRequiredNow() const; diff --git a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp index 23508bcac..2076640ed 100644 --- a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp +++ b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp @@ -10,7 +10,7 @@ #include "../StdInc.h" #include "DangerHitMapAnalyzer.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../pforeach.h" #include "../../../lib/callback/GameRandomizer.h" #include "../../../lib/logging/VisualLogger.h" diff --git a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.h b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.h index 3605f7859..7e9a66c8a 100644 --- a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.h +++ b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.h @@ -75,11 +75,11 @@ private: tbb::concurrent_vector enemyHeroAccessibleObjects; bool hitMapUpToDate = false; bool tileOwnersUpToDate = false; - const Nullkiller2 * ai; + const Nullkiller * ai; std::map> townThreats; public: - DangerHitMapAnalyzer(const Nullkiller2 * ai) :ai(ai) {} + DangerHitMapAnalyzer(const Nullkiller * ai) :ai(ai) {} void updateHitMap(); void calculateTileOwners(); diff --git a/AI/Nullkiller/Analyzers/HeroManager.cpp b/AI/Nullkiller/Analyzers/HeroManager.cpp index 66ae62503..0f3342b8c 100644 --- a/AI/Nullkiller/Analyzers/HeroManager.cpp +++ b/AI/Nullkiller/Analyzers/HeroManager.cpp @@ -9,7 +9,7 @@ */ #include "../StdInc.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/mapObjects/MapObjects.h" #include "../../../lib/IGameSettings.h" #include "../../../lib/spells/ISpellMechanics.h" diff --git a/AI/Nullkiller/Analyzers/HeroManager.h b/AI/Nullkiller/Analyzers/HeroManager.h index e5ee3910e..0b4799ba4 100644 --- a/AI/Nullkiller/Analyzers/HeroManager.h +++ b/AI/Nullkiller/Analyzers/HeroManager.h @@ -43,12 +43,12 @@ private: static const SecondarySkillEvaluator scountSkillsScores; CCallback * cb; //this is enough, but we downcast from CCallback - const Nullkiller2 * ai; + const Nullkiller * ai; std::map heroRoles; std::map knownFightingStrength; public: - HeroManager(CCallback * CB, const Nullkiller2 * ai) : cb(CB), ai(ai) {} + HeroManager(CCallback * CB, const Nullkiller * ai) : cb(CB), ai(ai) {} const std::map & getHeroRoles() const; HeroRole getHeroRole(const HeroPtr & hero) const; int selectBestSkill(const HeroPtr & hero, const std::vector & skills) const; diff --git a/AI/Nullkiller/Analyzers/ObjectClusterizer.cpp b/AI/Nullkiller/Analyzers/ObjectClusterizer.cpp index c63fbbebe..701a145bb 100644 --- a/AI/Nullkiller/Analyzers/ObjectClusterizer.cpp +++ b/AI/Nullkiller/Analyzers/ObjectClusterizer.cpp @@ -11,7 +11,7 @@ #include "ObjectClusterizer.h" #include "../Goals/ExecuteHeroChain.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { diff --git a/AI/Nullkiller/Analyzers/ObjectClusterizer.h b/AI/Nullkiller/Analyzers/ObjectClusterizer.h index 9c0d143b2..b7f174934 100644 --- a/AI/Nullkiller/Analyzers/ObjectClusterizer.h +++ b/AI/Nullkiller/Analyzers/ObjectClusterizer.h @@ -66,7 +66,7 @@ private: ObjectCluster nearObjects; ObjectCluster farObjects; ClusterMap blockedObjects; - const Nullkiller2 * ai; + const Nullkiller * ai; RewardEvaluator valueEvaluator; bool isUpToDate; std::vector invalidated; @@ -79,7 +79,7 @@ public: const CGObjectInstance * getBlocker(const AIPath & path) const; std::optional getBlocker(const AIPathNodeInfo & node) const; - ObjectClusterizer(const Nullkiller2 * ai): ai(ai), valueEvaluator(ai), isUpToDate(false){} + ObjectClusterizer(const Nullkiller * ai): ai(ai), valueEvaluator(ai), isUpToDate(false){} void validateObjects(); void onObjectRemoved(ObjectInstanceID id); diff --git a/AI/Nullkiller/Behaviors/BuildingBehavior.cpp b/AI/Nullkiller/Behaviors/BuildingBehavior.cpp index 2116e8391..8642765fa 100644 --- a/AI/Nullkiller/Behaviors/BuildingBehavior.cpp +++ b/AI/Nullkiller/Behaviors/BuildingBehavior.cpp @@ -15,7 +15,7 @@ #include "../Goals/Composition.h" #include "../Goals/BuildThis.h" #include "../Goals/SaveResources.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { @@ -27,7 +27,7 @@ std::string BuildingBehavior::toString() const return "Build"; } -Goals::TGoalVec BuildingBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec BuildingBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; diff --git a/AI/Nullkiller/Behaviors/BuildingBehavior.h b/AI/Nullkiller/Behaviors/BuildingBehavior.h index ea46b9c4d..7762b7209 100644 --- a/AI/Nullkiller/Behaviors/BuildingBehavior.h +++ b/AI/Nullkiller/Behaviors/BuildingBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const BuildingBehavior & other) const override { diff --git a/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp b/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp index 9b5c4a711..8dcb851e6 100644 --- a/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp +++ b/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp @@ -12,7 +12,7 @@ #include "../AIGateway.h" #include "../AIUtility.h" #include "../Goals/BuyArmy.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { @@ -24,7 +24,7 @@ std::string BuyArmyBehavior::toString() const return "Buy army"; } -Goals::TGoalVec BuyArmyBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec BuyArmyBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; diff --git a/AI/Nullkiller/Behaviors/BuyArmyBehavior.h b/AI/Nullkiller/Behaviors/BuyArmyBehavior.h index b23e00d84..21efd9a94 100644 --- a/AI/Nullkiller/Behaviors/BuyArmyBehavior.h +++ b/AI/Nullkiller/Behaviors/BuyArmyBehavior.h @@ -20,7 +20,7 @@ namespace Goals class BuyArmyBehavior : public CGoal { public: - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const BuyArmyBehavior & other) const override { diff --git a/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.cpp b/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.cpp index e08ebeee8..38e71b675 100644 --- a/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.cpp +++ b/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.cpp @@ -9,7 +9,7 @@ */ #include "StdInc.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../Goals/Composition.h" #include "../Goals/ExecuteHeroChain.h" #include "../Goals/Invalid.h" @@ -49,7 +49,7 @@ bool CaptureObjectsBehavior::operator==(const CaptureObjectsBehavior & other) co Goals::TGoalVec CaptureObjectsBehavior::getVisitGoals( const std::vector & paths, - const Nullkiller2 * nullkiller, + const Nullkiller * nullkiller, const CGObjectInstance * objToVisit, bool force) { @@ -169,7 +169,7 @@ Goals::TGoalVec CaptureObjectsBehavior::getVisitGoals( void CaptureObjectsBehavior::decomposeObjects( Goals::TGoalVec & result, const std::vector & objs, - const Nullkiller2 * nullkiller) const + const Nullkiller * nullkiller) const { if(objs.empty()) { @@ -212,7 +212,7 @@ void CaptureObjectsBehavior::decomposeObjects( }); } -Goals::TGoalVec CaptureObjectsBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec CaptureObjectsBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; diff --git a/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.h b/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.h index 06da7084e..3de4a08e7 100644 --- a/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.h +++ b/AI/Nullkiller/Behaviors/CaptureObjectsBehavior.h @@ -49,7 +49,7 @@ namespace Goals specificObjects = true; } - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; CaptureObjectsBehavior & ofType(int type) @@ -70,7 +70,7 @@ namespace Goals static Goals::TGoalVec getVisitGoals( const std::vector & paths, - const Nullkiller2 * nullkiller, + const Nullkiller * nullkiller, const CGObjectInstance * objToVisit = nullptr, bool force = false); @@ -79,7 +79,7 @@ namespace Goals void decomposeObjects( Goals::TGoalVec & result, const std::vector & objs, - const Nullkiller2 * nullkiller) const; + const Nullkiller * nullkiller) const; }; } diff --git a/AI/Nullkiller/Behaviors/ClusterBehavior.cpp b/AI/Nullkiller/Behaviors/ClusterBehavior.cpp index 9deeefd6a..75913798a 100644 --- a/AI/Nullkiller/Behaviors/ClusterBehavior.cpp +++ b/AI/Nullkiller/Behaviors/ClusterBehavior.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ClusterBehavior.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" #include "../Markers/UnlockCluster.h" #include "../Goals/Composition.h" @@ -26,7 +26,7 @@ std::string ClusterBehavior::toString() const return "Unlock Clusters"; } -Goals::TGoalVec ClusterBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec ClusterBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; auto clusters = ai->objectClusterizer->getLockedClusters(); @@ -39,7 +39,7 @@ Goals::TGoalVec ClusterBehavior::decompose(const Nullkiller2 * ai) const return tasks; } -Goals::TGoalVec ClusterBehavior::decomposeCluster(const Nullkiller2 * ai, std::shared_ptr cluster) const +Goals::TGoalVec ClusterBehavior::decomposeCluster(const Nullkiller * ai, std::shared_ptr cluster) const { auto center = cluster->calculateCenter(ai->cb.get()); auto paths = ai->pathfinder->getPathInfo(center->visitablePos(), ai->isObjectGraphAllowed()); diff --git a/AI/Nullkiller/Behaviors/ClusterBehavior.h b/AI/Nullkiller/Behaviors/ClusterBehavior.h index e8b04e54e..271b91838 100644 --- a/AI/Nullkiller/Behaviors/ClusterBehavior.h +++ b/AI/Nullkiller/Behaviors/ClusterBehavior.h @@ -28,7 +28,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const ClusterBehavior & other) const override @@ -37,7 +37,7 @@ namespace Goals } private: - Goals::TGoalVec decomposeCluster(const Nullkiller2 * ai, std::shared_ptr cluster) const; + Goals::TGoalVec decomposeCluster(const Nullkiller * ai, std::shared_ptr cluster) const; }; } diff --git a/AI/Nullkiller/Behaviors/DefenceBehavior.cpp b/AI/Nullkiller/Behaviors/DefenceBehavior.cpp index 27e2c91f3..e3431add4 100644 --- a/AI/Nullkiller/Behaviors/DefenceBehavior.cpp +++ b/AI/Nullkiller/Behaviors/DefenceBehavior.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "DefenceBehavior.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" #include "../Goals/BuyArmy.h" #include "../Goals/ExecuteHeroChain.h" @@ -34,7 +34,7 @@ std::string DefenceBehavior::toString() const return "Defend towns"; } -Goals::TGoalVec DefenceBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec DefenceBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; @@ -46,7 +46,7 @@ Goals::TGoalVec DefenceBehavior::decompose(const Nullkiller2 * ai) const return tasks; } -bool isThreatUnderControl(const CGTownInstance * town, const HitMapInfo & threat, const Nullkiller2 * ai, const std::vector & paths) +bool isThreatUnderControl(const CGTownInstance * town, const HitMapInfo & threat, const Nullkiller * ai, const std::vector & paths) { int dayOfWeek = ai->cb->getDate(Date::DAY_OF_WEEK); @@ -81,7 +81,7 @@ void handleCounterAttack( const CGTownInstance * town, const HitMapInfo & threat, const HitMapInfo & maximumDanger, - const Nullkiller2 * ai, + const Nullkiller * ai, Goals::TGoalVec & tasks) { if(threat.hero.validAndSet() @@ -107,7 +107,7 @@ void handleCounterAttack( } } -bool handleGarrisonHeroFromPreviousTurn(const CGTownInstance * town, Goals::TGoalVec & tasks, const Nullkiller2 * ai) +bool handleGarrisonHeroFromPreviousTurn(const CGTownInstance * town, Goals::TGoalVec & tasks, const Nullkiller * ai) { if(ai->isHeroLocked(town->getGarrisonHero())) { @@ -149,7 +149,7 @@ bool handleGarrisonHeroFromPreviousTurn(const CGTownInstance * town, Goals::TGoa return false; } -void DefenceBehavior::evaluateDefence(Goals::TGoalVec & tasks, const CGTownInstance * town, const Nullkiller2 * ai) const +void DefenceBehavior::evaluateDefence(Goals::TGoalVec & tasks, const CGTownInstance * town, const Nullkiller * ai) const { #if NKAI_TRACE_LEVEL >= 1 logAi->trace("Evaluating defence for %s", town->getNameTranslated()); @@ -423,7 +423,7 @@ void DefenceBehavior::evaluateDefence(Goals::TGoalVec & tasks, const CGTownInsta logAi->debug("Found %d tasks", tasks.size()); } -void DefenceBehavior::evaluateRecruitingHero(Goals::TGoalVec & tasks, const HitMapInfo & threat, const CGTownInstance * town, const Nullkiller2 * ai) const +void DefenceBehavior::evaluateRecruitingHero(Goals::TGoalVec & tasks, const HitMapInfo & threat, const CGTownInstance * town, const Nullkiller * ai) const { if (threat.turn > 0 || town->getGarrisonHero() || town->getVisitingHero()) return; diff --git a/AI/Nullkiller/Behaviors/DefenceBehavior.h b/AI/Nullkiller/Behaviors/DefenceBehavior.h index c4d6dbf8f..e2953c4d4 100644 --- a/AI/Nullkiller/Behaviors/DefenceBehavior.h +++ b/AI/Nullkiller/Behaviors/DefenceBehavior.h @@ -28,7 +28,7 @@ namespace Goals { } - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const DefenceBehavior & other) const override @@ -37,8 +37,8 @@ namespace Goals } private: - void evaluateDefence(Goals::TGoalVec & tasks, const CGTownInstance * town, const Nullkiller2 * ai) const; - void evaluateRecruitingHero(Goals::TGoalVec & tasks, const HitMapInfo & threat, const CGTownInstance * town, const Nullkiller2 * ai) const; + void evaluateDefence(Goals::TGoalVec & tasks, const CGTownInstance * town, const Nullkiller * ai) const; + void evaluateRecruitingHero(Goals::TGoalVec & tasks, const HitMapInfo & threat, const CGTownInstance * town, const Nullkiller * ai) const; }; } diff --git a/AI/Nullkiller/Behaviors/ExplorationBehavior.cpp b/AI/Nullkiller/Behaviors/ExplorationBehavior.cpp index 03933e3a1..b9c6e568d 100644 --- a/AI/Nullkiller/Behaviors/ExplorationBehavior.cpp +++ b/AI/Nullkiller/Behaviors/ExplorationBehavior.cpp @@ -29,7 +29,7 @@ std::string ExplorationBehavior::toString() const return "Explore"; } -Goals::TGoalVec ExplorationBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec ExplorationBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; diff --git a/AI/Nullkiller/Behaviors/ExplorationBehavior.h b/AI/Nullkiller/Behaviors/ExplorationBehavior.h index 60b43940f..29bde6174 100644 --- a/AI/Nullkiller/Behaviors/ExplorationBehavior.h +++ b/AI/Nullkiller/Behaviors/ExplorationBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const ExplorationBehavior & other) const override diff --git a/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp b/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp index 7da384fa5..08dc4a146 100644 --- a/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp +++ b/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp @@ -9,7 +9,7 @@ */ #include "StdInc.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../Goals/ExecuteHeroChain.h" #include "../Goals/Composition.h" #include "../Goals/RecruitHero.h" @@ -30,7 +30,7 @@ std::string GatherArmyBehavior::toString() const return "Gather army"; } -Goals::TGoalVec GatherArmyBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec GatherArmyBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; @@ -59,7 +59,7 @@ Goals::TGoalVec GatherArmyBehavior::decompose(const Nullkiller2 * ai) const return tasks; } -Goals::TGoalVec GatherArmyBehavior::deliverArmyToHero(const Nullkiller2 * ai, const CGHeroInstance * hero) const +Goals::TGoalVec GatherArmyBehavior::deliverArmyToHero(const Nullkiller * ai, const CGHeroInstance * hero) const { Goals::TGoalVec tasks; const int3 pos = hero->visitablePos(); @@ -216,7 +216,7 @@ Goals::TGoalVec GatherArmyBehavior::deliverArmyToHero(const Nullkiller2 * ai, co return tasks; } -Goals::TGoalVec GatherArmyBehavior::upgradeArmy(const Nullkiller2 * ai, const CGTownInstance * upgrader) const +Goals::TGoalVec GatherArmyBehavior::upgradeArmy(const Nullkiller * ai, const CGTownInstance * upgrader) const { Goals::TGoalVec tasks; const int3 pos = upgrader->visitablePos(); diff --git a/AI/Nullkiller/Behaviors/GatherArmyBehavior.h b/AI/Nullkiller/Behaviors/GatherArmyBehavior.h index a9e4929de..f28785c49 100644 --- a/AI/Nullkiller/Behaviors/GatherArmyBehavior.h +++ b/AI/Nullkiller/Behaviors/GatherArmyBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const GatherArmyBehavior & other) const override @@ -34,8 +34,8 @@ namespace Goals } private: - TGoalVec deliverArmyToHero(const Nullkiller2 * ai, const CGHeroInstance * hero) const; - TGoalVec upgradeArmy(const Nullkiller2 * ai, const CGTownInstance * upgrader) const; + TGoalVec deliverArmyToHero(const Nullkiller * ai, const CGHeroInstance * hero) const; + TGoalVec upgradeArmy(const Nullkiller * ai, const CGTownInstance * upgrader) const; }; } diff --git a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp index 153750568..90410b9cf 100644 --- a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp +++ b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp @@ -24,7 +24,7 @@ std::string RecruitHeroBehavior::toString() const return "Recruit hero"; } -Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; auto towns = ai->cb->getTownsInfo(); diff --git a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.h b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.h index 5956a4bad..21c1a0c9f 100644 --- a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.h +++ b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const RecruitHeroBehavior & other) const override diff --git a/AI/Nullkiller/Behaviors/StartupBehavior.cpp b/AI/Nullkiller/Behaviors/StartupBehavior.cpp index f60021ef9..ad04f0a67 100644 --- a/AI/Nullkiller/Behaviors/StartupBehavior.cpp +++ b/AI/Nullkiller/Behaviors/StartupBehavior.cpp @@ -16,7 +16,7 @@ #include "../Goals/ExecuteHeroChain.h" #include "../Goals/ExchangeSwapTownHeroes.h" #include "../../../lib/mapObjects/CGResource.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { @@ -41,7 +41,7 @@ const AIPath getShortestPath(const CGTownInstance * town, const std::vectorpathfinder->getPathInfo(town->visitablePos()); @@ -59,7 +59,7 @@ const CGHeroInstance * getNearestHero(const Nullkiller2 * ai, const CGTownInstan return shortestPath.targetHero; } -bool needToRecruitHero(const Nullkiller2 * ai, const CGTownInstance * startupTown) +bool needToRecruitHero(const Nullkiller * ai, const CGTownInstance * startupTown) { if(!ai->heroManager->canRecruitHero(startupTown)) return false; @@ -108,7 +108,7 @@ bool needToRecruitHero(const Nullkiller2 * ai, const CGTownInstance * startupTow return cb->getHeroCount(ai->playerID, true) < basicCount + boost; } -Goals::TGoalVec StartupBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec StartupBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; auto towns = ai->cb->getTownsInfo(); diff --git a/AI/Nullkiller/Behaviors/StartupBehavior.h b/AI/Nullkiller/Behaviors/StartupBehavior.h index 4321747ad..fcae58335 100644 --- a/AI/Nullkiller/Behaviors/StartupBehavior.h +++ b/AI/Nullkiller/Behaviors/StartupBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const StartupBehavior & other) const override diff --git a/AI/Nullkiller/Behaviors/StayAtTownBehavior.cpp b/AI/Nullkiller/Behaviors/StayAtTownBehavior.cpp index be28fad94..106043540 100644 --- a/AI/Nullkiller/Behaviors/StayAtTownBehavior.cpp +++ b/AI/Nullkiller/Behaviors/StayAtTownBehavior.cpp @@ -15,7 +15,7 @@ #include "../Goals/Composition.h" #include "../Goals/ExecuteHeroChain.h" #include "lib/mapObjects/MapObjects.h" //for victory conditions -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { @@ -27,7 +27,7 @@ std::string StayAtTownBehavior::toString() const return "StayAtTownBehavior"; } -Goals::TGoalVec StayAtTownBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec StayAtTownBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; auto towns = ai->cb->getTownsInfo(); diff --git a/AI/Nullkiller/Behaviors/StayAtTownBehavior.h b/AI/Nullkiller/Behaviors/StayAtTownBehavior.h index 0b2f50481..053ce3d40 100644 --- a/AI/Nullkiller/Behaviors/StayAtTownBehavior.h +++ b/AI/Nullkiller/Behaviors/StayAtTownBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const StayAtTownBehavior & other) const override diff --git a/AI/Nullkiller/CMakeLists.txt b/AI/Nullkiller/CMakeLists.txt index f9df79f9c..6604b6899 100644 --- a/AI/Nullkiller/CMakeLists.txt +++ b/AI/Nullkiller/CMakeLists.txt @@ -47,7 +47,7 @@ set(Nullkiller_SRCS Markers/UnlockCluster.cpp Markers/DefendTown.cpp Markers/ExplorationPoint.cpp - Engine/Nullkiller2.cpp + Engine/Nullkiller.cpp Engine/DeepDecomposer.cpp Engine/PriorityEvaluator.cpp Analyzers/DangerHitMapAnalyzer.cpp @@ -123,7 +123,7 @@ set(Nullkiller_HEADERS Markers/UnlockCluster.h Markers/DefendTown.h Markers/ExplorationPoint.h - Engine/Nullkiller2.h + Engine/Nullkiller.h Engine/DeepDecomposer.h Engine/PriorityEvaluator.h Analyzers/DangerHitMapAnalyzer.h diff --git a/AI/Nullkiller/Engine/DeepDecomposer.cpp b/AI/Nullkiller/Engine/DeepDecomposer.cpp index 6a62b61a8..85625ecc5 100644 --- a/AI/Nullkiller/Engine/DeepDecomposer.cpp +++ b/AI/Nullkiller/Engine/DeepDecomposer.cpp @@ -26,7 +26,7 @@ namespace NKAI using namespace Goals; -DeepDecomposer::DeepDecomposer(const Nullkiller2 * ai) +DeepDecomposer::DeepDecomposer(const Nullkiller * ai) :ai(ai), depth(0) { } diff --git a/AI/Nullkiller/Engine/DeepDecomposer.h b/AI/Nullkiller/Engine/DeepDecomposer.h index e9c3d065f..7a30d99ee 100644 --- a/AI/Nullkiller/Engine/DeepDecomposer.h +++ b/AI/Nullkiller/Engine/DeepDecomposer.h @@ -30,10 +30,10 @@ private: std::vector goals; std::vector decompositionCache; int depth; - const Nullkiller2 * ai; + const Nullkiller * ai; public: - DeepDecomposer(const Nullkiller2 * ai); + DeepDecomposer(const Nullkiller * ai); void reset(); void decompose(Goals::TGoalVec & result, Goals::TSubgoal behavior, int depthLimit); diff --git a/AI/Nullkiller/Engine/FuzzyHelper.cpp b/AI/Nullkiller/Engine/FuzzyHelper.cpp index 57239b679..f3dd29bfb 100644 --- a/AI/Nullkiller/Engine/FuzzyHelper.cpp +++ b/AI/Nullkiller/Engine/FuzzyHelper.cpp @@ -11,7 +11,7 @@ #include "FuzzyHelper.h" #include "../Goals/Goals.h" -#include "Nullkiller2.h" +#include "Nullkiller.h" #include "../../../lib/mapObjectConstructors/AObjectTypeHandler.h" #include "../../../lib/mapObjectConstructors/CObjectClassesHandler.h" diff --git a/AI/Nullkiller/Engine/FuzzyHelper.h b/AI/Nullkiller/Engine/FuzzyHelper.h index 826816ee7..455da61e6 100644 --- a/AI/Nullkiller/Engine/FuzzyHelper.h +++ b/AI/Nullkiller/Engine/FuzzyHelper.h @@ -13,16 +13,16 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; class DLL_EXPORT FuzzyHelper { private: - const Nullkiller2 * ai; + const Nullkiller * ai; TacticalAdvantageEngine tacticalAdvantageEngine; public: - FuzzyHelper(const Nullkiller2 * ai): ai(ai) {} + FuzzyHelper(const Nullkiller * ai): ai(ai) {} ui64 evaluateDanger(const CGObjectInstance * obj); ui64 evaluateDanger(const int3 & tile, const CGHeroInstance * visitor, bool checkGuards = true); diff --git a/AI/Nullkiller/Engine/Nullkiller2.cpp b/AI/Nullkiller/Engine/Nullkiller.cpp similarity index 93% rename from AI/Nullkiller/Engine/Nullkiller2.cpp rename to AI/Nullkiller/Engine/Nullkiller.cpp index 1c0b412de..be301eba4 100644 --- a/AI/Nullkiller/Engine/Nullkiller2.cpp +++ b/AI/Nullkiller/Engine/Nullkiller.cpp @@ -8,7 +8,7 @@ * */ #include "StdInc.h" -#include "Nullkiller2.h" +#include "Nullkiller.h" #include "../AIGateway.h" #include "../Behaviors/CaptureObjectsBehavior.h" #include "../Behaviors/RecruitHeroBehavior.h" @@ -33,9 +33,9 @@ namespace NKAI using namespace Goals; // while we play vcmieagles graph can be shared -std::unique_ptr Nullkiller2::baseGraph; +std::unique_ptr Nullkiller::baseGraph; -Nullkiller2::Nullkiller2() +Nullkiller::Nullkiller() : activeHero(nullptr) , scanDepth(ScanDepth::MAIN_FULL) , useHeroChain(true) @@ -45,7 +45,7 @@ Nullkiller2::Nullkiller2() } -Nullkiller2::~Nullkiller2() = default; +Nullkiller::~Nullkiller() = default; bool canUseOpenMap(std::shared_ptr cb, PlayerColor playerID) { @@ -69,7 +69,7 @@ bool canUseOpenMap(std::shared_ptr cb, PlayerColor playerID) return true; } -void Nullkiller2::init(std::shared_ptr cb, AIGateway * gateway) +void Nullkiller::init(std::shared_ptr cb, AIGateway * gateway) { this->cb = cb; this->gateway = gateway; @@ -166,7 +166,7 @@ void TaskPlan::merge(TSubgoal task) tasks.emplace_back(task); } -Goals::TTask Nullkiller2::choseBestTask(Goals::TGoalVec & tasks) const +Goals::TTask Nullkiller::choseBestTask(Goals::TGoalVec & tasks) const { if(tasks.empty()) { @@ -187,7 +187,7 @@ Goals::TTask Nullkiller2::choseBestTask(Goals::TGoalVec & tasks) const return taskptr(*bestTask); } -Goals::TTaskVec Nullkiller2::buildPlan(TGoalVec & tasks, int priorityTier) const +Goals::TTaskVec Nullkiller::buildPlan(TGoalVec & tasks, int priorityTier) const { TaskPlan taskPlan; @@ -216,7 +216,7 @@ Goals::TTaskVec Nullkiller2::buildPlan(TGoalVec & tasks, int priorityTier) const return taskPlan.getTasks(); } -void Nullkiller2::decompose(Goals::TGoalVec & result, Goals::TSubgoal behavior, int decompositionMaxDepth) const +void Nullkiller::decompose(Goals::TGoalVec & result, Goals::TSubgoal behavior, int decompositionMaxDepth) const { makingTurnInterrupption.interruptionPoint(); @@ -234,7 +234,7 @@ void Nullkiller2::decompose(Goals::TGoalVec & result, Goals::TSubgoal behavior, timeElapsed(start)); } -void Nullkiller2::resetAiState() +void Nullkiller::resetAiState() { std::unique_lock lockGuard(aiStateMutex); @@ -252,12 +252,12 @@ void Nullkiller2::resetAiState() } } -void Nullkiller2::invalidatePathfinderData() +void Nullkiller::invalidatePathfinderData() { pathfinderInvalidated = true; } -void Nullkiller2::updateAiState(int pass, bool fast) +void Nullkiller::updateAiState(int pass, bool fast) { makingTurnInterrupption.interruptionPoint(); @@ -334,12 +334,12 @@ void Nullkiller2::updateAiState(int pass, bool fast) logAi->debug("AI state updated in %ld ms", timeElapsed(start)); } -bool Nullkiller2::isHeroLocked(const CGHeroInstance * hero) const +bool Nullkiller::isHeroLocked(const CGHeroInstance * hero) const { return getHeroLockedReason(hero) != HeroLockedReason::NOT_LOCKED; } -bool Nullkiller2::arePathHeroesLocked(const AIPath & path) const +bool Nullkiller::arePathHeroesLocked(const AIPath & path) const { if(getHeroLockedReason(path.targetHero) == HeroLockedReason::STARTUP) { @@ -365,14 +365,14 @@ bool Nullkiller2::arePathHeroesLocked(const AIPath & path) const return false; } -HeroLockedReason Nullkiller2::getHeroLockedReason(const CGHeroInstance * hero) const +HeroLockedReason Nullkiller::getHeroLockedReason(const CGHeroInstance * hero) const { auto found = lockedHeroes.find(hero); return found != lockedHeroes.end() ? found->second : HeroLockedReason::NOT_LOCKED; } -void Nullkiller2::makeTurn() +void Nullkiller::makeTurn() { std::lock_guard sharedStorageLock(AISharedStorage::locker); @@ -572,7 +572,7 @@ void Nullkiller2::makeTurn() } } -bool Nullkiller2::areAffectedObjectsPresent(Goals::TTask task) const +bool Nullkiller::areAffectedObjectsPresent(Goals::TTask task) const { auto affectedObjs = task->getAffectedObjects(); @@ -585,7 +585,7 @@ bool Nullkiller2::areAffectedObjectsPresent(Goals::TTask task) const return true; } -HeroRole Nullkiller2::getTaskRole(Goals::TTask task) const +HeroRole Nullkiller::getTaskRole(Goals::TTask task) const { HeroPtr hero = task->getHero(); HeroRole heroRole = HeroRole::MAIN; @@ -596,7 +596,7 @@ HeroRole Nullkiller2::getTaskRole(Goals::TTask task) const return heroRole; } -bool Nullkiller2::executeTask(Goals::TTask task) +bool Nullkiller::executeTask(Goals::TTask task) { auto start = std::chrono::high_resolution_clock::now(); std::string taskDescr = task->toString(); @@ -624,7 +624,7 @@ bool Nullkiller2::executeTask(Goals::TTask task) return true; } -TResources Nullkiller2::getFreeResources() const +TResources Nullkiller::getFreeResources() const { auto freeRes = cb->getResourceAmount() - lockedResources; @@ -633,12 +633,12 @@ TResources Nullkiller2::getFreeResources() const return freeRes; } -void Nullkiller2::lockResources(const TResources & res) +void Nullkiller::lockResources(const TResources & res) { lockedResources += res; } -bool Nullkiller2::handleTrading() +bool Nullkiller::handleTrading() { bool haveTraded = false; bool shouldTryToTrade = true; @@ -736,12 +736,12 @@ bool Nullkiller2::handleTrading() return haveTraded; } -std::shared_ptr Nullkiller2::getPathsInfo(const CGHeroInstance * h) const +std::shared_ptr Nullkiller::getPathsInfo(const CGHeroInstance * h) const { return pathfinderCache->getPathsInfo(h); } -void Nullkiller2::invalidatePaths() +void Nullkiller::invalidatePaths() { pathfinderCache->invalidatePaths(); } diff --git a/AI/Nullkiller/Engine/Nullkiller2.h b/AI/Nullkiller/Engine/Nullkiller.h similarity index 98% rename from AI/Nullkiller/Engine/Nullkiller2.h rename to AI/Nullkiller/Engine/Nullkiller.h index 6a0c6c018..810e9c904 100644 --- a/AI/Nullkiller/Engine/Nullkiller2.h +++ b/AI/Nullkiller/Engine/Nullkiller.h @@ -73,7 +73,7 @@ public: void merge(Goals::TSubgoal task); }; -class Nullkiller2 +class Nullkiller { private: const CGHeroInstance * activeHero; @@ -110,8 +110,8 @@ public: std::mutex aiStateMutex; mutable ThreadInterruption makingTurnInterrupption; - Nullkiller2(); - ~Nullkiller2(); + Nullkiller(); + ~Nullkiller(); void init(std::shared_ptr cb, AIGateway * gateway); void makeTurn(); bool isActive(const CGHeroInstance * hero) const { return activeHero == hero; } diff --git a/AI/Nullkiller/Engine/PriorityEvaluator.cpp b/AI/Nullkiller/Engine/PriorityEvaluator.cpp index 32ed548c7..047688632 100644 --- a/AI/Nullkiller/Engine/PriorityEvaluator.cpp +++ b/AI/Nullkiller/Engine/PriorityEvaluator.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include -#include "Nullkiller2.h" +#include "Nullkiller.h" #include "../../../lib/entities/artifact/CArtifact.h" #include "../../../lib/mapObjectConstructors/AObjectTypeHandler.h" #include "../../../lib/mapObjectConstructors/CObjectClassesHandler.h" @@ -37,7 +37,7 @@ namespace NKAI constexpr float MIN_CRITICAL_VALUE = 2.0f; -EvaluationContext::EvaluationContext(const Nullkiller2* ai) +EvaluationContext::EvaluationContext(const Nullkiller* ai) : movementCost(0.0), manaCost(0), danger(0), @@ -938,10 +938,10 @@ public: class ExecuteHeroChainEvaluationContextBuilder : public IEvaluationContextBuilder { private: - const Nullkiller2 * ai; + const Nullkiller * ai; public: - ExecuteHeroChainEvaluationContextBuilder(const Nullkiller2 * ai) : ai(ai) {} + ExecuteHeroChainEvaluationContextBuilder(const Nullkiller * ai) : ai(ai) {} void buildEvaluationContext(EvaluationContext & evaluationContext, Goals::TSubgoal task) const override { @@ -1057,7 +1057,7 @@ public: class ClusterEvaluationContextBuilder : public IEvaluationContextBuilder { public: - ClusterEvaluationContextBuilder(const Nullkiller2 * ai) {} + ClusterEvaluationContextBuilder(const Nullkiller * ai) {} void buildEvaluationContext(EvaluationContext & evaluationContext, Goals::TSubgoal task) const override { @@ -1141,10 +1141,10 @@ public: class DismissHeroContextBuilder : public IEvaluationContextBuilder { private: - const Nullkiller2 * ai; + const Nullkiller * ai; public: - DismissHeroContextBuilder(const Nullkiller2 * ai) : ai(ai) {} + DismissHeroContextBuilder(const Nullkiller * ai) : ai(ai) {} void buildEvaluationContext(EvaluationContext & evaluationContext, Goals::TSubgoal task) const override { @@ -1276,7 +1276,7 @@ uint64_t RewardEvaluator::getUpgradeArmyReward(const CGTownInstance * town, cons return upgradedPower - creaturesToUpgrade.power; } -PriorityEvaluator::PriorityEvaluator(const Nullkiller2 * ai) +PriorityEvaluator::PriorityEvaluator(const Nullkiller * ai) :ai(ai) { initVisitTile(); diff --git a/AI/Nullkiller/Engine/PriorityEvaluator.h b/AI/Nullkiller/Engine/PriorityEvaluator.h index 9f1d3c858..dc3ed4a9d 100644 --- a/AI/Nullkiller/Engine/PriorityEvaluator.h +++ b/AI/Nullkiller/Engine/PriorityEvaluator.h @@ -24,15 +24,15 @@ namespace NKAI { class BuildingInfo; -class Nullkiller2; +class Nullkiller; struct HitMapInfo; class RewardEvaluator { public: - const Nullkiller2 * ai; + const Nullkiller * ai; - RewardEvaluator(const Nullkiller2 * ai) : ai(ai) {} + RewardEvaluator(const Nullkiller * ai) : ai(ai) {} uint64_t getArmyReward(const CGObjectInstance * target, const CGHeroInstance * hero, const CCreatureSet * army, bool checkGold) const; uint64_t getArmyGrowth(const CGObjectInstance * target, const CGHeroInstance * hero, const CCreatureSet * army) const; @@ -86,7 +86,7 @@ struct DLL_EXPORT EvaluationContext int explorePriority; float powerRatio; - EvaluationContext(const Nullkiller2 * ai); + EvaluationContext(const Nullkiller * ai); void addNonCriticalStrategicalValue(float value); }; @@ -98,12 +98,12 @@ public: virtual void buildEvaluationContext(EvaluationContext & evaluationContext, Goals::TSubgoal goal) const = 0; }; -class Nullkiller2; +class Nullkiller; class PriorityEvaluator { public: - PriorityEvaluator(const Nullkiller2 * ai); + PriorityEvaluator(const Nullkiller * ai); ~PriorityEvaluator(); void initVisitTile(); @@ -125,7 +125,7 @@ public: }; private: - const Nullkiller2 * ai; + const Nullkiller * ai; fl::Engine * engine; fl::InputVariable * armyLossPersentageVariable; diff --git a/AI/Nullkiller/Goals/AbstractGoal.h b/AI/Nullkiller/Goals/AbstractGoal.h index 0549f6b95..d42a40a45 100644 --- a/AI/Nullkiller/Goals/AbstractGoal.h +++ b/AI/Nullkiller/Goals/AbstractGoal.h @@ -20,7 +20,7 @@ namespace NKAI struct HeroPtr; class AIGateway; class FuzzyHelper; -class Nullkiller2; +class Nullkiller; namespace Goals { @@ -133,7 +133,7 @@ namespace Goals return const_cast(this); } - virtual TGoalVec decompose(const Nullkiller2 * ai) const + virtual TGoalVec decompose(const Nullkiller * ai) const { return TGoalVec(); } diff --git a/AI/Nullkiller/Goals/BuyArmy.cpp b/AI/Nullkiller/Goals/BuyArmy.cpp index 06c2e087b..f561da3a8 100644 --- a/AI/Nullkiller/Goals/BuyArmy.cpp +++ b/AI/Nullkiller/Goals/BuyArmy.cpp @@ -11,7 +11,7 @@ #include "BuyArmy.h" #include "../../../lib/mapObjects/CGTownInstance.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI diff --git a/AI/Nullkiller/Goals/CGoal.h b/AI/Nullkiller/Goals/CGoal.h index 3a56f4812..c01097eb1 100644 --- a/AI/Nullkiller/Goals/CGoal.h +++ b/AI/Nullkiller/Goals/CGoal.h @@ -48,7 +48,7 @@ namespace Goals virtual bool operator==(const T & other) const = 0; - TGoalVec decompose(const Nullkiller2 * ai) const override + TGoalVec decompose(const Nullkiller * ai) const override { TSubgoal single = decomposeSingle(ai); @@ -59,7 +59,7 @@ namespace Goals } protected: - virtual TSubgoal decomposeSingle(const Nullkiller2 * ai) const + virtual TSubgoal decomposeSingle(const Nullkiller * ai) const { return TSubgoal(); } diff --git a/AI/Nullkiller/Goals/CaptureObject.cpp b/AI/Nullkiller/Goals/CaptureObject.cpp index a7d2b3c8c..7ca2ab266 100644 --- a/AI/Nullkiller/Goals/CaptureObject.cpp +++ b/AI/Nullkiller/Goals/CaptureObject.cpp @@ -11,7 +11,7 @@ #include "CaptureObject.h" #include "../../../lib/mapObjects/CGTownInstance.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../Behaviors/CaptureObjectsBehavior.h" @@ -35,7 +35,7 @@ std::string CaptureObject::toString() const return "Capture " + name + " at " + tile.toString(); } -TGoalVec CaptureObject::decompose(const Nullkiller2 * ai) const +TGoalVec CaptureObject::decompose(const Nullkiller * ai) const { return CaptureObjectsBehavior(ai->cb->getObj(ObjectInstanceID(objid))).decompose(ai); } diff --git a/AI/Nullkiller/Goals/CaptureObject.h b/AI/Nullkiller/Goals/CaptureObject.h index bff2c0848..2073cd2fe 100644 --- a/AI/Nullkiller/Goals/CaptureObject.h +++ b/AI/Nullkiller/Goals/CaptureObject.h @@ -35,7 +35,7 @@ namespace Goals } bool operator==(const CaptureObject & other) const override; - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool hasHash() const override { return true; } uint64_t getHash() const override; diff --git a/AI/Nullkiller/Goals/CompleteQuest.cpp b/AI/Nullkiller/Goals/CompleteQuest.cpp index 04547146e..1ad7f7c29 100644 --- a/AI/Nullkiller/Goals/CompleteQuest.cpp +++ b/AI/Nullkiller/Goals/CompleteQuest.cpp @@ -31,7 +31,7 @@ std::string CompleteQuest::toString() const return "Complete quest " + questToString(); } -TGoalVec CompleteQuest::decompose(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::decompose(const Nullkiller * ai) const { if(isKeyMaster(q)) { @@ -106,7 +106,7 @@ std::string CompleteQuest::questToString() const return ms.toString(); } -TGoalVec CompleteQuest::tryCompleteQuest(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::tryCompleteQuest(const Nullkiller * ai) const { auto paths = ai->pathfinder->getPathInfo(q.getObject(cb)->visitablePos()); @@ -118,7 +118,7 @@ TGoalVec CompleteQuest::tryCompleteQuest(const Nullkiller2 * ai) const return CaptureObjectsBehavior::getVisitGoals(paths, ai, q.getObject(cb)); } -TGoalVec CompleteQuest::missionArt(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionArt(const Nullkiller * ai) const { TGoalVec solutions = tryCompleteQuest(ai); @@ -135,7 +135,7 @@ TGoalVec CompleteQuest::missionArt(const Nullkiller2 * ai) const return solutions; } -TGoalVec CompleteQuest::missionHero(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionHero(const Nullkiller * ai) const { TGoalVec solutions = tryCompleteQuest(ai); @@ -148,7 +148,7 @@ TGoalVec CompleteQuest::missionHero(const Nullkiller2 * ai) const return solutions; } -TGoalVec CompleteQuest::missionArmy(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionArmy(const Nullkiller * ai) const { auto paths = ai->pathfinder->getPathInfo(q.getObject(cb)->visitablePos()); @@ -160,17 +160,17 @@ TGoalVec CompleteQuest::missionArmy(const Nullkiller2 * ai) const return CaptureObjectsBehavior::getVisitGoals(paths, ai, q.getObject(cb)); } -TGoalVec CompleteQuest::missionIncreasePrimaryStat(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionIncreasePrimaryStat(const Nullkiller * ai) const { return tryCompleteQuest(ai); } -TGoalVec CompleteQuest::missionLevel(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionLevel(const Nullkiller * ai) const { return tryCompleteQuest(ai); } -TGoalVec CompleteQuest::missionKeymaster(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionKeymaster(const Nullkiller * ai) const { if(isObjectPassable(ai, q.getObject(cb))) { @@ -182,13 +182,13 @@ TGoalVec CompleteQuest::missionKeymaster(const Nullkiller2 * ai) const } } -TGoalVec CompleteQuest::missionResources(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionResources(const Nullkiller * ai) const { TGoalVec solutions = tryCompleteQuest(ai); return solutions; } -TGoalVec CompleteQuest::missionDestroyObj(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionDestroyObj(const Nullkiller * ai) const { auto obj = ai->cb->getObj(q.getQuest(cb)->killTarget); diff --git a/AI/Nullkiller/Goals/CompleteQuest.h b/AI/Nullkiller/Goals/CompleteQuest.h index 0556eda60..2ea62be7c 100644 --- a/AI/Nullkiller/Goals/CompleteQuest.h +++ b/AI/Nullkiller/Goals/CompleteQuest.h @@ -28,7 +28,7 @@ namespace Goals { } - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool hasHash() const override { return true; } uint64_t getHash() const override; @@ -36,15 +36,15 @@ namespace Goals bool operator==(const CompleteQuest & other) const override; private: - TGoalVec tryCompleteQuest(const Nullkiller2 * ai) const; - TGoalVec missionArt(const Nullkiller2 * ai) const; - TGoalVec missionHero(const Nullkiller2 * ai) const; - TGoalVec missionArmy(const Nullkiller2 * ai) const; - TGoalVec missionResources(const Nullkiller2 * ai) const; - TGoalVec missionDestroyObj(const Nullkiller2 * ai) const; - TGoalVec missionIncreasePrimaryStat(const Nullkiller2 * ai) const; - TGoalVec missionLevel(const Nullkiller2 * ai) const; - TGoalVec missionKeymaster(const Nullkiller2 * ai) const; + TGoalVec tryCompleteQuest(const Nullkiller * ai) const; + TGoalVec missionArt(const Nullkiller * ai) const; + TGoalVec missionHero(const Nullkiller * ai) const; + TGoalVec missionArmy(const Nullkiller * ai) const; + TGoalVec missionResources(const Nullkiller * ai) const; + TGoalVec missionDestroyObj(const Nullkiller * ai) const; + TGoalVec missionIncreasePrimaryStat(const Nullkiller * ai) const; + TGoalVec missionLevel(const Nullkiller * ai) const; + TGoalVec missionKeymaster(const Nullkiller * ai) const; std::string questToString() const; }; } diff --git a/AI/Nullkiller/Goals/Composition.cpp b/AI/Nullkiller/Goals/Composition.cpp index 33569df1e..190767a6b 100644 --- a/AI/Nullkiller/Goals/Composition.cpp +++ b/AI/Nullkiller/Goals/Composition.cpp @@ -59,7 +59,7 @@ void Composition::accept(AIGateway * ai) } } -TGoalVec Composition::decompose(const Nullkiller2 * ai) const +TGoalVec Composition::decompose(const Nullkiller * ai) const { TGoalVec result; diff --git a/AI/Nullkiller/Goals/Composition.h b/AI/Nullkiller/Goals/Composition.h index 1b5a99de3..b8a6bdd07 100644 --- a/AI/Nullkiller/Goals/Composition.h +++ b/AI/Nullkiller/Goals/Composition.h @@ -32,7 +32,7 @@ namespace Goals Composition & addNext(const AbstractGoal & goal); Composition & addNext(TSubgoal goal); Composition & addNextSequence(const TGoalVec & taskSequence); - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; bool isElementar() const override; int getHeroExchangeCount() const override; diff --git a/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.cpp b/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.cpp index 6a3944e96..b1acadfb5 100644 --- a/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.cpp +++ b/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.cpp @@ -11,7 +11,7 @@ #include "ExchangeSwapTownHeroes.h" #include "ExecuteHeroChain.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { diff --git a/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.h b/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.h index 7d4298dfb..714350a7b 100644 --- a/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.h +++ b/AI/Nullkiller/Goals/ExchangeSwapTownHeroes.h @@ -10,7 +10,7 @@ #pragma once #include "CGoal.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { diff --git a/AI/Nullkiller/Goals/ExecuteHeroChain.cpp b/AI/Nullkiller/Goals/ExecuteHeroChain.cpp index f124bb9e1..4ee0b1031 100644 --- a/AI/Nullkiller/Goals/ExecuteHeroChain.cpp +++ b/AI/Nullkiller/Goals/ExecuteHeroChain.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ExecuteHeroChain.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { diff --git a/AI/Nullkiller/Goals/Invalid.h b/AI/Nullkiller/Goals/Invalid.h index 2073f9486..6207f1bb0 100644 --- a/AI/Nullkiller/Goals/Invalid.h +++ b/AI/Nullkiller/Goals/Invalid.h @@ -27,7 +27,7 @@ namespace Goals { priority = -1; } - TGoalVec decompose(const Nullkiller2 * ai) const override + TGoalVec decompose(const Nullkiller * ai) const override { return TGoalVec(); } diff --git a/AI/Nullkiller/Goals/StayAtTown.cpp b/AI/Nullkiller/Goals/StayAtTown.cpp index b62ab30ef..5c3769bc5 100644 --- a/AI/Nullkiller/Goals/StayAtTown.cpp +++ b/AI/Nullkiller/Goals/StayAtTown.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "StayAtTown.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" namespace NKAI diff --git a/AI/Nullkiller/Helpers/ArmyFormation.h b/AI/Nullkiller/Helpers/ArmyFormation.h index c8ba70396..88fe0363b 100644 --- a/AI/Nullkiller/Helpers/ArmyFormation.h +++ b/AI/Nullkiller/Helpers/ArmyFormation.h @@ -20,7 +20,7 @@ namespace NKAI struct HeroPtr; class AIGateway; class FuzzyHelper; -class Nullkiller2; +class Nullkiller; class DLL_EXPORT ArmyFormation { @@ -28,7 +28,7 @@ private: std::shared_ptr cb; //this is enough, but we downcast from CCallback public: - ArmyFormation(std::shared_ptr CB, const Nullkiller2 * ai): cb(CB) {} + ArmyFormation(std::shared_ptr CB, const Nullkiller * ai): cb(CB) {} void rearrangeArmyForSiege(const CGTownInstance * town, const CGHeroInstance * attacker); diff --git a/AI/Nullkiller/Helpers/ExplorationHelper.cpp b/AI/Nullkiller/Helpers/ExplorationHelper.cpp index bd499e775..b0d093921 100644 --- a/AI/Nullkiller/Helpers/ExplorationHelper.cpp +++ b/AI/Nullkiller/Helpers/ExplorationHelper.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ExplorationHelper.h" #include "../../../lib/mapObjects/CGTownInstance.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../Goals/Invalid.h" #include "../Goals/Composition.h" #include "../Goals/ExecuteHeroChain.h" @@ -24,7 +24,7 @@ namespace NKAI using namespace Goals; -ExplorationHelper::ExplorationHelper(const CGHeroInstance * hero, const Nullkiller2 * ai, bool useCPathfinderAccessibility) +ExplorationHelper::ExplorationHelper(const CGHeroInstance * hero, const Nullkiller * ai, bool useCPathfinderAccessibility) :ai(ai), cbp(ai->cb.get()), hero(hero), useCPathfinderAccessibility(useCPathfinderAccessibility) { ts = cbp->getPlayerTeam(ai->playerID); diff --git a/AI/Nullkiller/Helpers/ExplorationHelper.h b/AI/Nullkiller/Helpers/ExplorationHelper.h index 401d3cf78..009d8a724 100644 --- a/AI/Nullkiller/Helpers/ExplorationHelper.h +++ b/AI/Nullkiller/Helpers/ExplorationHelper.h @@ -27,7 +27,7 @@ private: Goals::TSubgoal bestGoal; int3 bestTile; int bestTilesDiscovered; - const Nullkiller2 * ai; + const Nullkiller * ai; CCallback * cbp; const TeamState * ts; int3 ourPos; @@ -35,7 +35,7 @@ private: bool useCPathfinderAccessibility; public: - ExplorationHelper(const CGHeroInstance * hero, const Nullkiller2 * ai, bool useCPathfinderAccessibility = false); + ExplorationHelper(const CGHeroInstance * hero, const Nullkiller * ai, bool useCPathfinderAccessibility = false); Goals::TSubgoal makeComposition() const; bool scanSector(int scanRadius); bool scanMap(); diff --git a/AI/Nullkiller/Markers/ArmyUpgrade.cpp b/AI/Nullkiller/Markers/ArmyUpgrade.cpp index d73abda2e..21f060486 100644 --- a/AI/Nullkiller/Markers/ArmyUpgrade.cpp +++ b/AI/Nullkiller/Markers/ArmyUpgrade.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ArmyUpgrade.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" namespace NKAI diff --git a/AI/Nullkiller/Markers/DefendTown.cpp b/AI/Nullkiller/Markers/DefendTown.cpp index b06ab53ca..123b87b5e 100644 --- a/AI/Nullkiller/Markers/DefendTown.cpp +++ b/AI/Nullkiller/Markers/DefendTown.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "DefendTown.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" namespace NKAI diff --git a/AI/Nullkiller/Markers/ExplorationPoint.cpp b/AI/Nullkiller/Markers/ExplorationPoint.cpp index c4fa95b0f..916ac5b7f 100644 --- a/AI/Nullkiller/Markers/ExplorationPoint.cpp +++ b/AI/Nullkiller/Markers/ExplorationPoint.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ExplorationPoint.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" #include "../Analyzers/ArmyManager.h" diff --git a/AI/Nullkiller/Markers/HeroExchange.cpp b/AI/Nullkiller/Markers/HeroExchange.cpp index b0c28031c..80117aeeb 100644 --- a/AI/Nullkiller/Markers/HeroExchange.cpp +++ b/AI/Nullkiller/Markers/HeroExchange.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "HeroExchange.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" #include "../Analyzers/ArmyManager.h" @@ -29,7 +29,7 @@ std::string HeroExchange::toString() const return "Hero exchange for " +hero->getObjectName() + " by " + exchangePath.toString(); } -uint64_t HeroExchange::getReinforcementArmyStrength(const Nullkiller2 * ai) const +uint64_t HeroExchange::getReinforcementArmyStrength(const Nullkiller * ai) const { uint64_t armyValue = ai->armyManager->howManyReinforcementsCanGet(hero, exchangePath.heroArmy); diff --git a/AI/Nullkiller/Markers/HeroExchange.h b/AI/Nullkiller/Markers/HeroExchange.h index 9e922ba6e..2c741b8f3 100644 --- a/AI/Nullkiller/Markers/HeroExchange.h +++ b/AI/Nullkiller/Markers/HeroExchange.h @@ -31,7 +31,7 @@ namespace Goals bool operator==(const HeroExchange & other) const override; std::string toString() const override; - uint64_t getReinforcementArmyStrength(const Nullkiller2 * ai) const; + uint64_t getReinforcementArmyStrength(const Nullkiller * ai) const; }; } diff --git a/AI/Nullkiller/Markers/UnlockCluster.cpp b/AI/Nullkiller/Markers/UnlockCluster.cpp index 0808ce44b..c52ee8345 100644 --- a/AI/Nullkiller/Markers/UnlockCluster.cpp +++ b/AI/Nullkiller/Markers/UnlockCluster.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "UnlockCluster.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" namespace NKAI diff --git a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp index f34d7dfb9..c3e3d1043 100644 --- a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp +++ b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp @@ -11,7 +11,7 @@ #include "AINodeStorage.h" #include "Actions/TownPortalAction.h" #include "Actions/WhirlpoolAction.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/callback/IGameInfoCallback.h" #include "../../../lib/mapping/CMap.h" #include "../../../lib/pathfinder/CPathfinder.h" @@ -102,7 +102,7 @@ int AINodeStorage::getBucketSize() const return ai->settings->getPathfinderBucketSize(); } -AINodeStorage::AINodeStorage(const Nullkiller2 * ai, const int3 & Sizes) +AINodeStorage::AINodeStorage(const Nullkiller * ai, const int3 & Sizes) : sizes(Sizes), ai(ai), cb(ai->cb.get()), nodes(Sizes, ai->settings->getPathfinderBucketSize() * ai->settings->getPathfinderBucketsCount()) { accessibility = std::make_unique>( diff --git a/AI/Nullkiller/Pathfinding/AINodeStorage.h b/AI/Nullkiller/Pathfinding/AINodeStorage.h index e78b142aa..921816713 100644 --- a/AI/Nullkiller/Pathfinding/AINodeStorage.h +++ b/AI/Nullkiller/Pathfinding/AINodeStorage.h @@ -166,7 +166,7 @@ private: std::unique_ptr> accessibility; const CPlayerSpecificInfoCallback * cb; - const Nullkiller2 * ai; + const Nullkiller * ai; AISharedStorage nodes; std::vector> actors; std::vector heroChain; @@ -179,7 +179,7 @@ private: public: /// more than 1 chain layer for each hero allows us to have more than 1 path to each tile so we can chose more optimal one. - AINodeStorage(const Nullkiller2 * ai, const int3 & sizes); + AINodeStorage(const Nullkiller * ai, const int3 & sizes); ~AINodeStorage(); void initialize(const PathfinderOptions & options, const IGameInfoCallback & gameInfo) override; diff --git a/AI/Nullkiller/Pathfinding/AIPathfinder.cpp b/AI/Nullkiller/Pathfinding/AIPathfinder.cpp index 007ce81d4..a6c8c30b3 100644 --- a/AI/Nullkiller/Pathfinding/AIPathfinder.cpp +++ b/AI/Nullkiller/Pathfinding/AIPathfinder.cpp @@ -11,14 +11,14 @@ #include "AIPathfinder.h" #include "AIPathfinderConfig.h" #include "../../../lib/mapping/CMap.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { std::map> AIPathfinder::heroGraphs; -AIPathfinder::AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller2 * ai) +AIPathfinder::AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller * ai) :cb(cb), ai(ai) { } diff --git a/AI/Nullkiller/Pathfinding/AIPathfinder.h b/AI/Nullkiller/Pathfinding/AIPathfinder.h index 2bed191b8..cd490cda4 100644 --- a/AI/Nullkiller/Pathfinding/AIPathfinder.h +++ b/AI/Nullkiller/Pathfinding/AIPathfinder.h @@ -18,7 +18,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; struct PathfinderSettings { @@ -40,11 +40,11 @@ class AIPathfinder private: std::shared_ptr storage; CPlayerSpecificInfoCallback * cb; - Nullkiller2 * ai; + Nullkiller * ai; static std::map> heroGraphs; public: - AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller2 * ai); + AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller * ai); void calculatePathInfo(std::vector & paths, const int3 & tile, bool includeGraph = false) const; bool isTileAccessible(const HeroPtr & hero, const int3 & tile) const; void updatePaths(const std::map & heroes, PathfinderSettings pathfinderSettings); diff --git a/AI/Nullkiller/Pathfinding/AIPathfinderConfig.cpp b/AI/Nullkiller/Pathfinding/AIPathfinderConfig.cpp index 54a6e7009..e5c30d59b 100644 --- a/AI/Nullkiller/Pathfinding/AIPathfinderConfig.cpp +++ b/AI/Nullkiller/Pathfinding/AIPathfinderConfig.cpp @@ -13,7 +13,7 @@ #include "Rules/AIMovementAfterDestinationRule.h" #include "Rules/AIMovementToDestinationRule.h" #include "Rules/AIPreviousNodeRule.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/pathfinder/CPathfinder.h" @@ -23,7 +23,7 @@ namespace AIPathfinding { std::vector> makeRuleset( CPlayerSpecificInfoCallback * cb, - Nullkiller2 * ai, + Nullkiller * ai, std::shared_ptr nodeStorage, bool allowBypassObjects) { @@ -41,7 +41,7 @@ namespace AIPathfinding AIPathfinderConfig::AIPathfinderConfig( CPlayerSpecificInfoCallback * cb, - Nullkiller2 * ai, + Nullkiller * ai, std::shared_ptr nodeStorage, bool allowBypassObjects) :PathfinderConfig(nodeStorage, *cb, makeRuleset(cb, ai, nodeStorage, allowBypassObjects)), aiNodeStorage(nodeStorage) diff --git a/AI/Nullkiller/Pathfinding/AIPathfinderConfig.h b/AI/Nullkiller/Pathfinding/AIPathfinderConfig.h index a36601a04..7c0b10dc7 100644 --- a/AI/Nullkiller/Pathfinding/AIPathfinderConfig.h +++ b/AI/Nullkiller/Pathfinding/AIPathfinderConfig.h @@ -16,7 +16,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; namespace AIPathfinding { @@ -29,7 +29,7 @@ namespace AIPathfinding public: AIPathfinderConfig( CPlayerSpecificInfoCallback * cb, - Nullkiller2 * ai, + Nullkiller * ai, std::shared_ptr nodeStorage, bool allowBypassObjects); diff --git a/AI/Nullkiller/Pathfinding/Actions/AdventureSpellCastMovementActions.cpp b/AI/Nullkiller/Pathfinding/Actions/AdventureSpellCastMovementActions.cpp index 4074ef78b..4c9ce19b8 100644 --- a/AI/Nullkiller/Pathfinding/Actions/AdventureSpellCastMovementActions.cpp +++ b/AI/Nullkiller/Pathfinding/Actions/AdventureSpellCastMovementActions.cpp @@ -56,7 +56,7 @@ namespace AIPathfinding Goals::AdventureSpellCast(hero, spellToCast).accept(ai); } - bool AdventureCastAction::canAct(const Nullkiller2 * ai, const AIPathNode * source) const + bool AdventureCastAction::canAct(const Nullkiller * ai, const AIPathNode * source) const { assert(hero == this->hero); diff --git a/AI/Nullkiller/Pathfinding/Actions/AdventureSpellCastMovementActions.h b/AI/Nullkiller/Pathfinding/Actions/AdventureSpellCastMovementActions.h index 8ee3bec82..a88324e3e 100644 --- a/AI/Nullkiller/Pathfinding/Actions/AdventureSpellCastMovementActions.h +++ b/AI/Nullkiller/Pathfinding/Actions/AdventureSpellCastMovementActions.h @@ -38,7 +38,7 @@ namespace AIPathfinding AIPathNode * dstMode, const AIPathNode * srcNode) const override; - bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const override; + bool canAct(const Nullkiller * ai, const AIPathNode * source) const override; std::string toString() const override; }; diff --git a/AI/Nullkiller/Pathfinding/Actions/BoatActions.cpp b/AI/Nullkiller/Pathfinding/Actions/BoatActions.cpp index 5850589d2..50bb18f51 100644 --- a/AI/Nullkiller/Pathfinding/Actions/BoatActions.cpp +++ b/AI/Nullkiller/Pathfinding/Actions/BoatActions.cpp @@ -27,7 +27,7 @@ namespace AIPathfinding return Goals::BuildBoat(shipyard).accept(ai); } - Goals::TSubgoal BuildBoatAction::decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const + Goals::TSubgoal BuildBoatAction::decompose(const Nullkiller * ai, const CGHeroInstance * hero) const { if(cb->getPlayerRelations(ai->playerID, shipyard->getObject()->getOwner()) == PlayerRelations::ENEMIES) { @@ -37,7 +37,7 @@ namespace AIPathfinding return Goals::sptr(Goals::Invalid()); } - bool BuildBoatAction::canAct(const Nullkiller2 * ai, const CGHeroInstance * hero, const TResources & reservedResources) const + bool BuildBoatAction::canAct(const Nullkiller * ai, const CGHeroInstance * hero, const TResources & reservedResources) const { if(cb->getPlayerRelations(hero->tempOwner, shipyard->getObject()->getOwner()) == PlayerRelations::ENEMIES) { @@ -63,12 +63,12 @@ namespace AIPathfinding return true; } - bool BuildBoatAction::canAct(const Nullkiller2 * ai, const AIPathNode * source) const + bool BuildBoatAction::canAct(const Nullkiller * ai, const AIPathNode * source) const { return canAct(ai, source->actor->hero, source->actor->armyCost); } - bool BuildBoatAction::canAct(const Nullkiller2 * ai, const AIPathNodeInfo & source) const + bool BuildBoatAction::canAct(const Nullkiller * ai, const AIPathNodeInfo & source) const { TResources res; @@ -85,7 +85,7 @@ namespace AIPathfinding return sourceActor->resourceActor; } - std::shared_ptr BuildBoatActionFactory::create(const Nullkiller2 * ai) + std::shared_ptr BuildBoatActionFactory::create(const Nullkiller * ai) { return std::make_shared(ai->cb.get(), dynamic_cast(ai->cb->getObj(shipyard))); } @@ -116,7 +116,7 @@ namespace AIPathfinding return "Build Boat at " + shipyard->getObject()->visitablePos().toString(); } - bool SummonBoatAction::canAct(const Nullkiller2 * ai, const AIPathNode * source) const + bool SummonBoatAction::canAct(const Nullkiller * ai, const AIPathNode * source) const { auto hero = source->actor->hero; diff --git a/AI/Nullkiller/Pathfinding/Actions/BoatActions.h b/AI/Nullkiller/Pathfinding/Actions/BoatActions.h index 518a0c9ab..b9034f910 100644 --- a/AI/Nullkiller/Pathfinding/Actions/BoatActions.h +++ b/AI/Nullkiller/Pathfinding/Actions/BoatActions.h @@ -40,7 +40,7 @@ namespace AIPathfinding AIPathNode * dstMode, const AIPathNode * srcNode) const override; - bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const override; + bool canAct(const Nullkiller * ai, const AIPathNode * source) const override; const ChainActor * getActor(const ChainActor * sourceActor) const override; @@ -62,13 +62,13 @@ namespace AIPathfinding { } - bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const override; - bool canAct(const Nullkiller2 * ai, const AIPathNodeInfo & source) const override; - bool canAct(const Nullkiller2 * ai, const CGHeroInstance * hero, const TResources & reservedResources) const; + bool canAct(const Nullkiller * ai, const AIPathNode * source) const override; + bool canAct(const Nullkiller * ai, const AIPathNodeInfo & source) const override; + bool canAct(const Nullkiller * ai, const CGHeroInstance * hero, const TResources & reservedResources) const; void execute(AIGateway * ai, const CGHeroInstance * hero) const override; - Goals::TSubgoal decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const override; + Goals::TSubgoal decompose(const Nullkiller * ai, const CGHeroInstance * hero) const override; const ChainActor * getActor(const ChainActor * sourceActor) const override; @@ -87,7 +87,7 @@ namespace AIPathfinding { } - std::shared_ptr create(const Nullkiller2 * ai) override; + std::shared_ptr create(const Nullkiller * ai) override; }; } diff --git a/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.h b/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.h index 992b5dc0f..da8d53e5b 100644 --- a/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.h +++ b/AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.h @@ -21,7 +21,7 @@ namespace AIPathfinding private: public: - bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const override + bool canAct(const Nullkiller * ai, const AIPathNode * source) const override { return true; } diff --git a/AI/Nullkiller/Pathfinding/Actions/QuestAction.cpp b/AI/Nullkiller/Pathfinding/Actions/QuestAction.cpp index 9e286f593..a528157da 100644 --- a/AI/Nullkiller/Pathfinding/Actions/QuestAction.cpp +++ b/AI/Nullkiller/Pathfinding/Actions/QuestAction.cpp @@ -19,17 +19,17 @@ namespace NKAI namespace AIPathfinding { - bool QuestAction::canAct(const Nullkiller2 * ai, const AIPathNode * node) const + bool QuestAction::canAct(const Nullkiller * ai, const AIPathNode * node) const { return canAct(ai, node->actor->hero); } - bool QuestAction::canAct(const Nullkiller2 * ai, const AIPathNodeInfo & node) const + bool QuestAction::canAct(const Nullkiller * ai, const AIPathNodeInfo & node) const { return canAct(ai, node.targetHero); } - bool QuestAction::canAct(const Nullkiller2 * ai, const CGHeroInstance * hero) const + bool QuestAction::canAct(const Nullkiller * ai, const CGHeroInstance * hero) const { auto object = questInfo.getObject(ai->cb.get()); auto quest = questInfo.getQuest(ai->cb.get()); @@ -45,7 +45,7 @@ namespace AIPathfinding || quest->checkQuest(hero); } - Goals::TSubgoal QuestAction::decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const + Goals::TSubgoal QuestAction::decompose(const Nullkiller * ai, const CGHeroInstance * hero) const { return Goals::sptr(Goals::CompleteQuest(questInfo)); } diff --git a/AI/Nullkiller/Pathfinding/Actions/QuestAction.h b/AI/Nullkiller/Pathfinding/Actions/QuestAction.h index 668077165..cc0dd59de 100644 --- a/AI/Nullkiller/Pathfinding/Actions/QuestAction.h +++ b/AI/Nullkiller/Pathfinding/Actions/QuestAction.h @@ -28,11 +28,11 @@ namespace AIPathfinding { } - bool canAct(const Nullkiller2 * ai, const AIPathNode * node) const override; - bool canAct(const Nullkiller2 * ai, const AIPathNodeInfo & node) const override; - bool canAct(const Nullkiller2 * ai, const CGHeroInstance * hero) const; + bool canAct(const Nullkiller * ai, const AIPathNode * node) const override; + bool canAct(const Nullkiller * ai, const AIPathNodeInfo & node) const override; + bool canAct(const Nullkiller * ai, const CGHeroInstance * hero) const; - Goals::TSubgoal decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const override; + Goals::TSubgoal decompose(const Nullkiller * ai, const CGHeroInstance * hero) const override; void execute(AIGateway * ai, const CGHeroInstance * hero) const override; diff --git a/AI/Nullkiller/Pathfinding/Actions/SpecialAction.cpp b/AI/Nullkiller/Pathfinding/Actions/SpecialAction.cpp index b59569e9c..8e1595b18 100644 --- a/AI/Nullkiller/Pathfinding/Actions/SpecialAction.cpp +++ b/AI/Nullkiller/Pathfinding/Actions/SpecialAction.cpp @@ -17,7 +17,7 @@ namespace NKAI { -Goals::TSubgoal SpecialAction::decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const +Goals::TSubgoal SpecialAction::decompose(const Nullkiller * ai, const CGHeroInstance * hero) const { return Goals::sptr(Goals::Invalid()); } @@ -27,7 +27,7 @@ void SpecialAction::execute(AIGateway * ai, const CGHeroInstance * hero) const throw cannotFulfillGoalException("Can not execute " + toString()); } -bool CompositeAction::canAct(const Nullkiller2 * ai, const AIPathNode * source) const +bool CompositeAction::canAct(const Nullkiller * ai, const AIPathNode * source) const { for(auto part : parts) { @@ -37,7 +37,7 @@ bool CompositeAction::canAct(const Nullkiller2 * ai, const AIPathNode * source) return true; } -Goals::TSubgoal CompositeAction::decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const +Goals::TSubgoal CompositeAction::decompose(const Nullkiller * ai, const CGHeroInstance * hero) const { for(auto part : parts) { diff --git a/AI/Nullkiller/Pathfinding/Actions/SpecialAction.h b/AI/Nullkiller/Pathfinding/Actions/SpecialAction.h index 83b447958..3d8e48fb1 100644 --- a/AI/Nullkiller/Pathfinding/Actions/SpecialAction.h +++ b/AI/Nullkiller/Pathfinding/Actions/SpecialAction.h @@ -30,17 +30,17 @@ class SpecialAction public: virtual ~SpecialAction() = default; - virtual bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const + virtual bool canAct(const Nullkiller * ai, const AIPathNode * source) const { return true; } - virtual bool canAct(const Nullkiller2 * ai, const AIPathNodeInfo & source) const + virtual bool canAct(const Nullkiller * ai, const AIPathNodeInfo & source) const { return true; } - virtual Goals::TSubgoal decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const; + virtual Goals::TSubgoal decompose(const Nullkiller * ai, const CGHeroInstance * hero) const; virtual void execute(AIGateway * ai, const CGHeroInstance * hero) const; @@ -76,11 +76,11 @@ private: public: CompositeAction(std::vector> parts) : parts(parts) {} - bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const override; + bool canAct(const Nullkiller * ai, const AIPathNode * source) const override; void execute(AIGateway * ai, const CGHeroInstance * hero) const override; std::string toString() const override; const CGObjectInstance * targetObject() const override; - Goals::TSubgoal decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const override; + Goals::TSubgoal decompose(const Nullkiller * ai, const CGHeroInstance * hero) const override; std::vector> getParts() const override { @@ -98,7 +98,7 @@ public: class ISpecialActionFactory { public: - virtual std::shared_ptr create(const Nullkiller2 * ai) = 0; + virtual std::shared_ptr create(const Nullkiller * ai) = 0; virtual ~ISpecialActionFactory() = default; }; diff --git a/AI/Nullkiller/Pathfinding/Actors.cpp b/AI/Nullkiller/Pathfinding/Actors.cpp index 65784ae70..7df7776e3 100644 --- a/AI/Nullkiller/Pathfinding/Actors.cpp +++ b/AI/Nullkiller/Pathfinding/Actors.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "Actors.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/mapObjects/MapObjects.h" #include "../../../lib/mapping/TerrainTile.h" #include "../../../lib/pathfinder/TurnInfo.h" @@ -97,7 +97,7 @@ std::string ObjectActor::toString() const return object->getObjectName() + " at " + object->visitablePos().toString(); } -HeroActor::HeroActor(const CGHeroInstance * hero, HeroRole heroRole, uint64_t chainMask, const Nullkiller2 * ai) +HeroActor::HeroActor(const CGHeroInstance * hero, HeroRole heroRole, uint64_t chainMask, const Nullkiller * ai) :ChainActor(hero, heroRole, chainMask) { exchangeMap.reset(new HeroExchangeMap(this, ai)); @@ -108,7 +108,7 @@ HeroActor::HeroActor( const ChainActor * carrier, const ChainActor * other, const HeroExchangeArmy * army, - const Nullkiller2 * ai) + const Nullkiller * ai) :ChainActor(carrier, other, army) { exchangeMap.reset(new HeroExchangeMap(this, ai)); @@ -185,7 +185,7 @@ ExchangeResult HeroActor::tryExchangeNoLock(const ChainActor * specialActor, con return result; } -HeroExchangeMap::HeroExchangeMap(const HeroActor * actor, const Nullkiller2 * ai) +HeroExchangeMap::HeroExchangeMap(const HeroActor * actor, const Nullkiller * ai) :actor(actor), ai(ai), sync() { } diff --git a/AI/Nullkiller/Pathfinding/Actors.h b/AI/Nullkiller/Pathfinding/Actors.h index 3018f2c0d..d73f01ac3 100644 --- a/AI/Nullkiller/Pathfinding/Actors.h +++ b/AI/Nullkiller/Pathfinding/Actors.h @@ -21,7 +21,7 @@ extern const uint64_t MIN_ARMY_STRENGTH_FOR_CHAIN; class ChainActor; class HeroActor; -class Nullkiller2; +class Nullkiller; class HeroExchangeArmy : public CArmedInstance { @@ -92,11 +92,11 @@ class HeroExchangeMap private: const HeroActor * actor; std::map exchangeMap; - const Nullkiller2 * ai; + const Nullkiller * ai; std::shared_mutex sync; public: - HeroExchangeMap(const HeroActor * actor, const Nullkiller2 * ai); + HeroExchangeMap(const HeroActor * actor, const Nullkiller * ai); ~HeroExchangeMap(); ExchangeResult tryExchangeNoLock(const ChainActor * other); @@ -121,8 +121,8 @@ public: std::shared_ptr exchangeAction; // chain flags, can be combined meaning hero exchange and so on - HeroActor(const CGHeroInstance * hero, HeroRole heroRole, uint64_t chainMask, const Nullkiller2 * ai); - HeroActor(const ChainActor * carrier, const ChainActor * other, const HeroExchangeArmy * army, const Nullkiller2 * ai); + HeroActor(const CGHeroInstance * hero, HeroRole heroRole, uint64_t chainMask, const Nullkiller * ai); + HeroActor(const ChainActor * carrier, const ChainActor * other, const HeroExchangeArmy * army, const Nullkiller * ai); protected: ExchangeResult tryExchangeNoLock(const ChainActor * specialActor, const ChainActor * other) const override; diff --git a/AI/Nullkiller/Pathfinding/GraphPaths.cpp b/AI/Nullkiller/Pathfinding/GraphPaths.cpp index 9bc2e4a8c..2d1d186ec 100644 --- a/AI/Nullkiller/Pathfinding/GraphPaths.cpp +++ b/AI/Nullkiller/Pathfinding/GraphPaths.cpp @@ -13,7 +13,7 @@ #include "../../../lib/CRandomGenerator.h" #include "../../../lib/mapObjects/CQuest.h" #include "../../../lib/mapping/CMap.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/logging/VisualLogger.h" #include "Actions/QuestAction.h" #include "../pforeach.h" @@ -33,7 +33,7 @@ GraphPaths::GraphPaths() } std::shared_ptr getCompositeAction( - const Nullkiller2 * ai, + const Nullkiller * ai, std::shared_ptr linkActionFactory, std::shared_ptr transitionAction) { @@ -53,7 +53,7 @@ std::shared_ptr getCompositeAction( return std::make_shared(actionsArray); } -void GraphPaths::calculatePaths(const CGHeroInstance * targetHero, const Nullkiller2 * ai, uint8_t scanDepth) +void GraphPaths::calculatePaths(const CGHeroInstance * targetHero, const Nullkiller * ai, uint8_t scanDepth) { graph.copyFrom(*ai->baseGraph); graph.connectHeroes(ai); @@ -188,7 +188,7 @@ bool GraphPathNode::tryUpdate( return false; } -void GraphPaths::addChainInfo(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller2 * ai) const +void GraphPaths::addChainInfo(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const { auto nodes = pathNodes.find(tile); @@ -299,7 +299,7 @@ void GraphPaths::addChainInfo(std::vector & paths, int3 tile, const CGHe } } -void GraphPaths::quickAddChainInfoWithBlocker(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller2 * ai) const +void GraphPaths::quickAddChainInfoWithBlocker(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const { auto nodes = pathNodes.find(tile); diff --git a/AI/Nullkiller/Pathfinding/GraphPaths.h b/AI/Nullkiller/Pathfinding/GraphPaths.h index 824d01970..28dca8b1d 100644 --- a/AI/Nullkiller/Pathfinding/GraphPaths.h +++ b/AI/Nullkiller/Pathfinding/GraphPaths.h @@ -15,7 +15,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; struct GraphPathNode; @@ -92,9 +92,9 @@ class GraphPaths public: GraphPaths(); - void calculatePaths(const CGHeroInstance * targetHero, const Nullkiller2 * ai, uint8_t scanDepth); - void addChainInfo(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller2 * ai) const; - void quickAddChainInfoWithBlocker(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller2 * ai) const; + void calculatePaths(const CGHeroInstance * targetHero, const Nullkiller * ai, uint8_t scanDepth); + void addChainInfo(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const; + void quickAddChainInfoWithBlocker(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const; void dumpToLog() const; private: diff --git a/AI/Nullkiller/Pathfinding/ObjectGraph.cpp b/AI/Nullkiller/Pathfinding/ObjectGraph.cpp index a0f978a93..e4e6e0483 100644 --- a/AI/Nullkiller/Pathfinding/ObjectGraph.cpp +++ b/AI/Nullkiller/Pathfinding/ObjectGraph.cpp @@ -13,7 +13,7 @@ #include "AIPathfinderConfig.h" #include "../../../lib/CRandomGenerator.h" #include "../../../lib/mapping/CMap.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/logging/VisualLogger.h" #include "Actions/QuestAction.h" #include "../pforeach.h" @@ -44,7 +44,7 @@ void ObjectGraph::removeConnection(const int3 & from, const int3 & to) nodes[from].connections.erase(to); } -void ObjectGraph::updateGraph(const Nullkiller2 * ai) +void ObjectGraph::updateGraph(const Nullkiller * ai) { auto cb = ai->cb; @@ -95,7 +95,7 @@ void ObjectGraph::removeObject(const CGObjectInstance * obj) } } -void ObjectGraph::connectHeroes(const Nullkiller2 * ai) +void ObjectGraph::connectHeroes(const Nullkiller * ai) { for(auto obj : ai->memory->visitableObjs) { diff --git a/AI/Nullkiller/Pathfinding/ObjectGraph.h b/AI/Nullkiller/Pathfinding/ObjectGraph.h index 1670b7d1e..d60844025 100644 --- a/AI/Nullkiller/Pathfinding/ObjectGraph.h +++ b/AI/Nullkiller/Pathfinding/ObjectGraph.h @@ -16,7 +16,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; struct ObjectLink { @@ -71,11 +71,11 @@ public: { } - void updateGraph(const Nullkiller2 * ai); + void updateGraph(const Nullkiller * ai); void addObject(const CGObjectInstance * obj); void registerJunction(const int3 & pos); void addVirtualBoat(const int3 & pos, const CGObjectInstance * shipyard); - void connectHeroes(const Nullkiller2 * ai); + void connectHeroes(const Nullkiller * ai); void removeObject(const CGObjectInstance * obj); bool tryAddConnection(const int3 & from, const int3 & to, float cost, uint64_t danger); void removeConnection(const int3 & from, const int3 & to); diff --git a/AI/Nullkiller/Pathfinding/ObjectGraphCalculator.cpp b/AI/Nullkiller/Pathfinding/ObjectGraphCalculator.cpp index 7f7bcd251..589c05d41 100644 --- a/AI/Nullkiller/Pathfinding/ObjectGraphCalculator.cpp +++ b/AI/Nullkiller/Pathfinding/ObjectGraphCalculator.cpp @@ -12,7 +12,7 @@ #include "AIPathfinderConfig.h" #include "../../../lib/callback/GameRandomizer.h" #include "../../../lib/mapping/CMap.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/logging/VisualLogger.h" #include "Actions/QuestAction.h" #include "../pforeach.h" @@ -20,7 +20,7 @@ namespace NKAI { -ObjectGraphCalculator::ObjectGraphCalculator(ObjectGraph * target, const Nullkiller2 * ai) +ObjectGraphCalculator::ObjectGraphCalculator(ObjectGraph * target, const Nullkiller * ai) :ai(ai), target(target), syncLock() { } diff --git a/AI/Nullkiller/Pathfinding/ObjectGraphCalculator.h b/AI/Nullkiller/Pathfinding/ObjectGraphCalculator.h index fea3b9d93..812bd6985 100644 --- a/AI/Nullkiller/Pathfinding/ObjectGraphCalculator.h +++ b/AI/Nullkiller/Pathfinding/ObjectGraphCalculator.h @@ -27,7 +27,7 @@ class ObjectGraphCalculator { private: ObjectGraph * target; - const Nullkiller2 * ai; + const Nullkiller * ai; std::mutex syncLock; std::map actors; @@ -37,7 +37,7 @@ private: std::vector> temporaryActorHeroes; public: - ObjectGraphCalculator(ObjectGraph * target, const Nullkiller2 * ai); + ObjectGraphCalculator(ObjectGraph * target, const Nullkiller * ai); void setGraphObjects(); void calculateConnections(); float getNeighborConnectionsCost(const int3 & pos, std::vector & pathCache); diff --git a/AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.cpp b/AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.cpp index 1b7aeb924..e4f37bb0d 100644 --- a/AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.cpp +++ b/AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.cpp @@ -9,7 +9,7 @@ */ #include "StdInc.h" #include "AILayerTransitionRule.h" -#include "../../Engine/Nullkiller2.h" +#include "../../Engine/Nullkiller.h" #include "../../../../lib/pathfinder/CPathfinder.h" #include "../../../../lib/pathfinder/TurnInfo.h" #include "../../../../lib/spells/ISpellMechanics.h" @@ -21,7 +21,7 @@ namespace AIPathfinding { AILayerTransitionRule::AILayerTransitionRule( CPlayerSpecificInfoCallback * cb, - Nullkiller2 * ai, + Nullkiller * ai, std::shared_ptr nodeStorage) :cb(cb), ai(ai), nodeStorage(nodeStorage) { diff --git a/AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.h b/AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.h index c8ce607ae..1de94d4d6 100644 --- a/AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.h +++ b/AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.h @@ -25,7 +25,7 @@ namespace AIPathfinding { private: CPlayerSpecificInfoCallback * cb; - Nullkiller2 * ai; + Nullkiller * ai; std::map> virtualBoats; std::shared_ptr nodeStorage; std::map> summonableVirtualBoats; @@ -35,7 +35,7 @@ namespace AIPathfinding public: AILayerTransitionRule( CPlayerSpecificInfoCallback * cb, - Nullkiller2 * ai, + Nullkiller * ai, std::shared_ptr nodeStorage); virtual void process( diff --git a/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp b/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp index 1e6e14f6c..ef0e53c89 100644 --- a/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp +++ b/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp @@ -23,7 +23,7 @@ namespace NKAI namespace AIPathfinding { AIMovementAfterDestinationRule::AIMovementAfterDestinationRule( - const Nullkiller2 * ai, + const Nullkiller * ai, CPlayerSpecificInfoCallback * cb, std::shared_ptr nodeStorage, bool allowBypassObjects) diff --git a/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.h b/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.h index 3d3d21844..e24170a29 100644 --- a/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.h +++ b/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.h @@ -23,13 +23,13 @@ namespace AIPathfinding { private: CPlayerSpecificInfoCallback * cb; - const Nullkiller2 * ai; + const Nullkiller * ai; std::shared_ptr nodeStorage; bool allowBypassObjects; public: AIMovementAfterDestinationRule( - const Nullkiller2 * ai, + const Nullkiller * ai, CPlayerSpecificInfoCallback * cb, std::shared_ptr nodeStorage, bool allowBypassObjects); diff --git a/AI/Nullkiller/pforeach.h b/AI/Nullkiller/pforeach.h index 1628e3fef..d8e911936 100644 --- a/AI/Nullkiller/pforeach.h +++ b/AI/Nullkiller/pforeach.h @@ -1,6 +1,6 @@ #pragma once -#include "Engine/Nullkiller2.h" +#include "Engine/Nullkiller.h" namespace NKAI { @@ -26,7 +26,7 @@ void pforeachTilePos(const int3 & mapSize, TFunc fn) } template -void pforeachTilePaths(const int3 & mapSize, const Nullkiller2 * ai, TFunc fn) +void pforeachTilePaths(const int3 & mapSize, const Nullkiller * ai, TFunc fn) { for(int z = 0; z < mapSize.z; ++z) { diff --git a/AI/Nullkiller2/AIGateway.cpp b/AI/Nullkiller2/AIGateway.cpp index 86a5a6463..8702d9d5b 100644 --- a/AI/Nullkiller2/AIGateway.cpp +++ b/AI/Nullkiller2/AIGateway.cpp @@ -845,7 +845,7 @@ bool AIGateway::makePossibleUpgrades(const CArmedInstance * obj) void AIGateway::makeTurn() { - setThreadName("AIGateway::makeTurn"); + setThreadName("AIGateway2::makeTurn"); MAKING_TURN; auto day = cb->getDate(Date::DAY); diff --git a/AI/Nullkiller2/AIGateway.h b/AI/Nullkiller2/AIGateway.h index 1577e3b30..c9eab5088 100644 --- a/AI/Nullkiller2/AIGateway.h +++ b/AI/Nullkiller2/AIGateway.h @@ -19,7 +19,7 @@ #include "../../lib/mapObjects/MiscObjects.h" #include "../../lib/spells/CSpellHandler.h" #include "Pathfinding/AIPathfinder.h" -#include "Engine/Nullkiller2.h" +#include "Engine/Nullkiller.h" VCMI_LIB_NAMESPACE_BEGIN class AsyncRunner; @@ -80,7 +80,7 @@ public: public: ObjectInstanceID selectedObject; - std::unique_ptr nullkiller2; + std::unique_ptr nullkiller2; AIGateway(); ~AIGateway(); diff --git a/AI/Nullkiller2/AIUtility.cpp b/AI/Nullkiller2/AIUtility.cpp index 717257b91..6b2c389d4 100644 --- a/AI/Nullkiller2/AIUtility.cpp +++ b/AI/Nullkiller2/AIUtility.cpp @@ -209,7 +209,7 @@ bool canBeEmbarkmentPoint(const TerrainTile * t, bool fromWater) return false; } -bool isObjectPassable(const Nullkiller2 * ai, const CGObjectInstance * obj) +bool isObjectPassable(const Nullkiller * ai, const CGObjectInstance * obj) { return isObjectPassable(obj, ai->playerID, ai->cb->getPlayerRelations(obj->tempOwner, ai->playerID)); } @@ -600,7 +600,7 @@ int64_t getArtifactScoreForHero(const CGHeroInstance * hero, const CArtifactInst return totalScore; } -bool isWeeklyRevisitable(const Nullkiller2 * ai, const CGObjectInstance * obj) +bool isWeeklyRevisitable(const Nullkiller * ai, const CGObjectInstance * obj) { if(!obj) return false; @@ -644,7 +644,7 @@ int getDuplicatingSlots(const CArmedInstance * army) } // todo: move to obj manager -bool shouldVisit(const Nullkiller2 * ai, const CGHeroInstance * h, const CGObjectInstance * obj) +bool shouldVisit(const Nullkiller * ai, const CGHeroInstance * h, const CGObjectInstance * obj) { auto relations = ai->cb->getPlayerRelations(obj->tempOwner, h->tempOwner); diff --git a/AI/Nullkiller2/AIUtility.h b/AI/Nullkiller2/AIUtility.h index 6b8a2b0b7..a6f85fe22 100644 --- a/AI/Nullkiller2/AIUtility.h +++ b/AI/Nullkiller2/AIUtility.h @@ -55,7 +55,7 @@ namespace NKAI { struct creInfo; class AIGateway; -class Nullkiller2; +class Nullkiller; const int GOLD_MINE_PRODUCTION = 1000; const int WOOD_ORE_MINE_PRODUCTION = 2; @@ -201,11 +201,11 @@ void foreach_neighbour(CCallback * cbp, const int3 & pos, const Func & foo) // a } bool canBeEmbarkmentPoint(const TerrainTile * t, bool fromWater); -bool isObjectPassable(const Nullkiller2 * ai, const CGObjectInstance * obj); +bool isObjectPassable(const Nullkiller * ai, const CGObjectInstance * obj); bool isObjectPassable(const CGObjectInstance * obj, PlayerColor playerColor, PlayerRelations objectRelations); bool isBlockVisitObj(const int3 & pos); -bool isWeeklyRevisitable(const Nullkiller2 * ai, const CGObjectInstance * obj); +bool isWeeklyRevisitable(const Nullkiller * ai, const CGObjectInstance * obj); bool isObjectRemovable(const CGObjectInstance * obj); //FIXME FIXME: move logic to object property! bool isSafeToVisit(const CGHeroInstance * h, uint64_t dangerStrength, float safeAttackRatio); @@ -222,7 +222,7 @@ uint64_t getHeroArmyStrengthWithCommander(const CGHeroInstance * hero, const CCr uint64_t timeElapsed(std::chrono::time_point start); // todo: move to obj manager -bool shouldVisit(const Nullkiller2 * ai, const CGHeroInstance * h, const CGObjectInstance * obj); +bool shouldVisit(const Nullkiller * ai, const CGHeroInstance * h, const CGObjectInstance * obj); int getDuplicatingSlots(const CArmedInstance * army); template diff --git a/AI/Nullkiller2/Analyzers/ArmyManager.cpp b/AI/Nullkiller2/Analyzers/ArmyManager.cpp index 0295b5d46..418a64cd8 100644 --- a/AI/Nullkiller2/Analyzers/ArmyManager.cpp +++ b/AI/Nullkiller2/Analyzers/ArmyManager.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ArmyManager.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/mapObjects/MapObjects.h" #include "../../../lib/mapping/TerrainTile.h" #include "../../../lib/IGameSettings.h" diff --git a/AI/Nullkiller2/Analyzers/ArmyManager.h b/AI/Nullkiller2/Analyzers/ArmyManager.h index f89fed6e7..b65a92821 100644 --- a/AI/Nullkiller2/Analyzers/ArmyManager.h +++ b/AI/Nullkiller2/Analyzers/ArmyManager.h @@ -18,7 +18,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; struct SlotInfo { @@ -83,11 +83,11 @@ class DLL_EXPORT ArmyManager : public IArmyManager { private: CPlayerSpecificInfoCallback * cb; //this is enough, but we downcast from CCallback - const Nullkiller2 * ai; + const Nullkiller * ai; std::map totalArmy; public: - ArmyManager(CPlayerSpecificInfoCallback * CB, const Nullkiller2 * ai): cb(CB), ai(ai) {} + ArmyManager(CPlayerSpecificInfoCallback * CB, const Nullkiller * ai): cb(CB), ai(ai) {} void update() override; ui64 howManyReinforcementsCanBuy(const CCreatureSet * target, const CGDwelling * source) const override; diff --git a/AI/Nullkiller2/Analyzers/BuildAnalyzer.cpp b/AI/Nullkiller2/Analyzers/BuildAnalyzer.cpp index 1d5cfa5cd..50632095d 100644 --- a/AI/Nullkiller2/Analyzers/BuildAnalyzer.cpp +++ b/AI/Nullkiller2/Analyzers/BuildAnalyzer.cpp @@ -8,8 +8,8 @@ * */ #include "../StdInc.h" -#include "../Engine/Nullkiller2.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/entities/building/CBuilding.h" #include "../../../lib/IGameSettings.h" @@ -405,7 +405,7 @@ BuildingInfo::BuildingInfo( const CCreature * creature, CreatureID baseCreature, const CGTownInstance * town, - Nullkiller2 * ai) + Nullkiller * ai) { id = building->bid; buildCost = building->resources; diff --git a/AI/Nullkiller2/Analyzers/BuildAnalyzer.h b/AI/Nullkiller2/Analyzers/BuildAnalyzer.h index ea28174ad..9625b9591 100644 --- a/AI/Nullkiller2/Analyzers/BuildAnalyzer.h +++ b/AI/Nullkiller2/Analyzers/BuildAnalyzer.h @@ -15,7 +15,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; class DLL_EXPORT BuildingInfo { @@ -44,7 +44,7 @@ public: const CCreature * creature, CreatureID baseCreature, const CGTownInstance * town, - Nullkiller2 * ai); + Nullkiller * ai); std::string toString() const; }; @@ -85,10 +85,10 @@ private: TResources armyCost; TResources dailyIncome; float goldPressure; - Nullkiller2 * ai; + Nullkiller * ai; public: - BuildAnalyzer(Nullkiller2 * ai) : ai(ai) {} + BuildAnalyzer(Nullkiller * ai) : ai(ai) {} void update(); TResources getResourcesRequiredNow() const; diff --git a/AI/Nullkiller2/Analyzers/DangerHitMapAnalyzer.cpp b/AI/Nullkiller2/Analyzers/DangerHitMapAnalyzer.cpp index 23508bcac..2076640ed 100644 --- a/AI/Nullkiller2/Analyzers/DangerHitMapAnalyzer.cpp +++ b/AI/Nullkiller2/Analyzers/DangerHitMapAnalyzer.cpp @@ -10,7 +10,7 @@ #include "../StdInc.h" #include "DangerHitMapAnalyzer.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../pforeach.h" #include "../../../lib/callback/GameRandomizer.h" #include "../../../lib/logging/VisualLogger.h" diff --git a/AI/Nullkiller2/Analyzers/DangerHitMapAnalyzer.h b/AI/Nullkiller2/Analyzers/DangerHitMapAnalyzer.h index 3605f7859..7e9a66c8a 100644 --- a/AI/Nullkiller2/Analyzers/DangerHitMapAnalyzer.h +++ b/AI/Nullkiller2/Analyzers/DangerHitMapAnalyzer.h @@ -75,11 +75,11 @@ private: tbb::concurrent_vector enemyHeroAccessibleObjects; bool hitMapUpToDate = false; bool tileOwnersUpToDate = false; - const Nullkiller2 * ai; + const Nullkiller * ai; std::map> townThreats; public: - DangerHitMapAnalyzer(const Nullkiller2 * ai) :ai(ai) {} + DangerHitMapAnalyzer(const Nullkiller * ai) :ai(ai) {} void updateHitMap(); void calculateTileOwners(); diff --git a/AI/Nullkiller2/Analyzers/HeroManager.cpp b/AI/Nullkiller2/Analyzers/HeroManager.cpp index 178f1ba5a..d4a8a7971 100644 --- a/AI/Nullkiller2/Analyzers/HeroManager.cpp +++ b/AI/Nullkiller2/Analyzers/HeroManager.cpp @@ -9,7 +9,7 @@ */ #include "../StdInc.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/mapObjects/MapObjects.h" #include "../../../lib/IGameSettings.h" #include "../../../lib/spells/ISpellMechanics.h" diff --git a/AI/Nullkiller2/Analyzers/HeroManager.h b/AI/Nullkiller2/Analyzers/HeroManager.h index e5ee3910e..0b4799ba4 100644 --- a/AI/Nullkiller2/Analyzers/HeroManager.h +++ b/AI/Nullkiller2/Analyzers/HeroManager.h @@ -43,12 +43,12 @@ private: static const SecondarySkillEvaluator scountSkillsScores; CCallback * cb; //this is enough, but we downcast from CCallback - const Nullkiller2 * ai; + const Nullkiller * ai; std::map heroRoles; std::map knownFightingStrength; public: - HeroManager(CCallback * CB, const Nullkiller2 * ai) : cb(CB), ai(ai) {} + HeroManager(CCallback * CB, const Nullkiller * ai) : cb(CB), ai(ai) {} const std::map & getHeroRoles() const; HeroRole getHeroRole(const HeroPtr & hero) const; int selectBestSkill(const HeroPtr & hero, const std::vector & skills) const; diff --git a/AI/Nullkiller2/Analyzers/ObjectClusterizer.cpp b/AI/Nullkiller2/Analyzers/ObjectClusterizer.cpp index c63fbbebe..701a145bb 100644 --- a/AI/Nullkiller2/Analyzers/ObjectClusterizer.cpp +++ b/AI/Nullkiller2/Analyzers/ObjectClusterizer.cpp @@ -11,7 +11,7 @@ #include "ObjectClusterizer.h" #include "../Goals/ExecuteHeroChain.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { diff --git a/AI/Nullkiller2/Analyzers/ObjectClusterizer.h b/AI/Nullkiller2/Analyzers/ObjectClusterizer.h index 9c0d143b2..b7f174934 100644 --- a/AI/Nullkiller2/Analyzers/ObjectClusterizer.h +++ b/AI/Nullkiller2/Analyzers/ObjectClusterizer.h @@ -66,7 +66,7 @@ private: ObjectCluster nearObjects; ObjectCluster farObjects; ClusterMap blockedObjects; - const Nullkiller2 * ai; + const Nullkiller * ai; RewardEvaluator valueEvaluator; bool isUpToDate; std::vector invalidated; @@ -79,7 +79,7 @@ public: const CGObjectInstance * getBlocker(const AIPath & path) const; std::optional getBlocker(const AIPathNodeInfo & node) const; - ObjectClusterizer(const Nullkiller2 * ai): ai(ai), valueEvaluator(ai), isUpToDate(false){} + ObjectClusterizer(const Nullkiller * ai): ai(ai), valueEvaluator(ai), isUpToDate(false){} void validateObjects(); void onObjectRemoved(ObjectInstanceID id); diff --git a/AI/Nullkiller2/Behaviors/BuildingBehavior.cpp b/AI/Nullkiller2/Behaviors/BuildingBehavior.cpp index 2116e8391..8642765fa 100644 --- a/AI/Nullkiller2/Behaviors/BuildingBehavior.cpp +++ b/AI/Nullkiller2/Behaviors/BuildingBehavior.cpp @@ -15,7 +15,7 @@ #include "../Goals/Composition.h" #include "../Goals/BuildThis.h" #include "../Goals/SaveResources.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { @@ -27,7 +27,7 @@ std::string BuildingBehavior::toString() const return "Build"; } -Goals::TGoalVec BuildingBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec BuildingBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; diff --git a/AI/Nullkiller2/Behaviors/BuildingBehavior.h b/AI/Nullkiller2/Behaviors/BuildingBehavior.h index ea46b9c4d..7762b7209 100644 --- a/AI/Nullkiller2/Behaviors/BuildingBehavior.h +++ b/AI/Nullkiller2/Behaviors/BuildingBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const BuildingBehavior & other) const override { diff --git a/AI/Nullkiller2/Behaviors/BuyArmyBehavior.cpp b/AI/Nullkiller2/Behaviors/BuyArmyBehavior.cpp index 9b5c4a711..8dcb851e6 100644 --- a/AI/Nullkiller2/Behaviors/BuyArmyBehavior.cpp +++ b/AI/Nullkiller2/Behaviors/BuyArmyBehavior.cpp @@ -12,7 +12,7 @@ #include "../AIGateway.h" #include "../AIUtility.h" #include "../Goals/BuyArmy.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { @@ -24,7 +24,7 @@ std::string BuyArmyBehavior::toString() const return "Buy army"; } -Goals::TGoalVec BuyArmyBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec BuyArmyBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; diff --git a/AI/Nullkiller2/Behaviors/BuyArmyBehavior.h b/AI/Nullkiller2/Behaviors/BuyArmyBehavior.h index b23e00d84..21efd9a94 100644 --- a/AI/Nullkiller2/Behaviors/BuyArmyBehavior.h +++ b/AI/Nullkiller2/Behaviors/BuyArmyBehavior.h @@ -20,7 +20,7 @@ namespace Goals class BuyArmyBehavior : public CGoal { public: - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const BuyArmyBehavior & other) const override { diff --git a/AI/Nullkiller2/Behaviors/CaptureObjectsBehavior.cpp b/AI/Nullkiller2/Behaviors/CaptureObjectsBehavior.cpp index e08ebeee8..38e71b675 100644 --- a/AI/Nullkiller2/Behaviors/CaptureObjectsBehavior.cpp +++ b/AI/Nullkiller2/Behaviors/CaptureObjectsBehavior.cpp @@ -9,7 +9,7 @@ */ #include "StdInc.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../Goals/Composition.h" #include "../Goals/ExecuteHeroChain.h" #include "../Goals/Invalid.h" @@ -49,7 +49,7 @@ bool CaptureObjectsBehavior::operator==(const CaptureObjectsBehavior & other) co Goals::TGoalVec CaptureObjectsBehavior::getVisitGoals( const std::vector & paths, - const Nullkiller2 * nullkiller, + const Nullkiller * nullkiller, const CGObjectInstance * objToVisit, bool force) { @@ -169,7 +169,7 @@ Goals::TGoalVec CaptureObjectsBehavior::getVisitGoals( void CaptureObjectsBehavior::decomposeObjects( Goals::TGoalVec & result, const std::vector & objs, - const Nullkiller2 * nullkiller) const + const Nullkiller * nullkiller) const { if(objs.empty()) { @@ -212,7 +212,7 @@ void CaptureObjectsBehavior::decomposeObjects( }); } -Goals::TGoalVec CaptureObjectsBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec CaptureObjectsBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; diff --git a/AI/Nullkiller2/Behaviors/CaptureObjectsBehavior.h b/AI/Nullkiller2/Behaviors/CaptureObjectsBehavior.h index 06da7084e..3de4a08e7 100644 --- a/AI/Nullkiller2/Behaviors/CaptureObjectsBehavior.h +++ b/AI/Nullkiller2/Behaviors/CaptureObjectsBehavior.h @@ -49,7 +49,7 @@ namespace Goals specificObjects = true; } - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; CaptureObjectsBehavior & ofType(int type) @@ -70,7 +70,7 @@ namespace Goals static Goals::TGoalVec getVisitGoals( const std::vector & paths, - const Nullkiller2 * nullkiller, + const Nullkiller * nullkiller, const CGObjectInstance * objToVisit = nullptr, bool force = false); @@ -79,7 +79,7 @@ namespace Goals void decomposeObjects( Goals::TGoalVec & result, const std::vector & objs, - const Nullkiller2 * nullkiller) const; + const Nullkiller * nullkiller) const; }; } diff --git a/AI/Nullkiller2/Behaviors/ClusterBehavior.cpp b/AI/Nullkiller2/Behaviors/ClusterBehavior.cpp index 9deeefd6a..75913798a 100644 --- a/AI/Nullkiller2/Behaviors/ClusterBehavior.cpp +++ b/AI/Nullkiller2/Behaviors/ClusterBehavior.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ClusterBehavior.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" #include "../Markers/UnlockCluster.h" #include "../Goals/Composition.h" @@ -26,7 +26,7 @@ std::string ClusterBehavior::toString() const return "Unlock Clusters"; } -Goals::TGoalVec ClusterBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec ClusterBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; auto clusters = ai->objectClusterizer->getLockedClusters(); @@ -39,7 +39,7 @@ Goals::TGoalVec ClusterBehavior::decompose(const Nullkiller2 * ai) const return tasks; } -Goals::TGoalVec ClusterBehavior::decomposeCluster(const Nullkiller2 * ai, std::shared_ptr cluster) const +Goals::TGoalVec ClusterBehavior::decomposeCluster(const Nullkiller * ai, std::shared_ptr cluster) const { auto center = cluster->calculateCenter(ai->cb.get()); auto paths = ai->pathfinder->getPathInfo(center->visitablePos(), ai->isObjectGraphAllowed()); diff --git a/AI/Nullkiller2/Behaviors/ClusterBehavior.h b/AI/Nullkiller2/Behaviors/ClusterBehavior.h index e8b04e54e..271b91838 100644 --- a/AI/Nullkiller2/Behaviors/ClusterBehavior.h +++ b/AI/Nullkiller2/Behaviors/ClusterBehavior.h @@ -28,7 +28,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const ClusterBehavior & other) const override @@ -37,7 +37,7 @@ namespace Goals } private: - Goals::TGoalVec decomposeCluster(const Nullkiller2 * ai, std::shared_ptr cluster) const; + Goals::TGoalVec decomposeCluster(const Nullkiller * ai, std::shared_ptr cluster) const; }; } diff --git a/AI/Nullkiller2/Behaviors/DefenceBehavior.cpp b/AI/Nullkiller2/Behaviors/DefenceBehavior.cpp index 27e2c91f3..e3431add4 100644 --- a/AI/Nullkiller2/Behaviors/DefenceBehavior.cpp +++ b/AI/Nullkiller2/Behaviors/DefenceBehavior.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "DefenceBehavior.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" #include "../Goals/BuyArmy.h" #include "../Goals/ExecuteHeroChain.h" @@ -34,7 +34,7 @@ std::string DefenceBehavior::toString() const return "Defend towns"; } -Goals::TGoalVec DefenceBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec DefenceBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; @@ -46,7 +46,7 @@ Goals::TGoalVec DefenceBehavior::decompose(const Nullkiller2 * ai) const return tasks; } -bool isThreatUnderControl(const CGTownInstance * town, const HitMapInfo & threat, const Nullkiller2 * ai, const std::vector & paths) +bool isThreatUnderControl(const CGTownInstance * town, const HitMapInfo & threat, const Nullkiller * ai, const std::vector & paths) { int dayOfWeek = ai->cb->getDate(Date::DAY_OF_WEEK); @@ -81,7 +81,7 @@ void handleCounterAttack( const CGTownInstance * town, const HitMapInfo & threat, const HitMapInfo & maximumDanger, - const Nullkiller2 * ai, + const Nullkiller * ai, Goals::TGoalVec & tasks) { if(threat.hero.validAndSet() @@ -107,7 +107,7 @@ void handleCounterAttack( } } -bool handleGarrisonHeroFromPreviousTurn(const CGTownInstance * town, Goals::TGoalVec & tasks, const Nullkiller2 * ai) +bool handleGarrisonHeroFromPreviousTurn(const CGTownInstance * town, Goals::TGoalVec & tasks, const Nullkiller * ai) { if(ai->isHeroLocked(town->getGarrisonHero())) { @@ -149,7 +149,7 @@ bool handleGarrisonHeroFromPreviousTurn(const CGTownInstance * town, Goals::TGoa return false; } -void DefenceBehavior::evaluateDefence(Goals::TGoalVec & tasks, const CGTownInstance * town, const Nullkiller2 * ai) const +void DefenceBehavior::evaluateDefence(Goals::TGoalVec & tasks, const CGTownInstance * town, const Nullkiller * ai) const { #if NKAI_TRACE_LEVEL >= 1 logAi->trace("Evaluating defence for %s", town->getNameTranslated()); @@ -423,7 +423,7 @@ void DefenceBehavior::evaluateDefence(Goals::TGoalVec & tasks, const CGTownInsta logAi->debug("Found %d tasks", tasks.size()); } -void DefenceBehavior::evaluateRecruitingHero(Goals::TGoalVec & tasks, const HitMapInfo & threat, const CGTownInstance * town, const Nullkiller2 * ai) const +void DefenceBehavior::evaluateRecruitingHero(Goals::TGoalVec & tasks, const HitMapInfo & threat, const CGTownInstance * town, const Nullkiller * ai) const { if (threat.turn > 0 || town->getGarrisonHero() || town->getVisitingHero()) return; diff --git a/AI/Nullkiller2/Behaviors/DefenceBehavior.h b/AI/Nullkiller2/Behaviors/DefenceBehavior.h index c4d6dbf8f..e2953c4d4 100644 --- a/AI/Nullkiller2/Behaviors/DefenceBehavior.h +++ b/AI/Nullkiller2/Behaviors/DefenceBehavior.h @@ -28,7 +28,7 @@ namespace Goals { } - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const DefenceBehavior & other) const override @@ -37,8 +37,8 @@ namespace Goals } private: - void evaluateDefence(Goals::TGoalVec & tasks, const CGTownInstance * town, const Nullkiller2 * ai) const; - void evaluateRecruitingHero(Goals::TGoalVec & tasks, const HitMapInfo & threat, const CGTownInstance * town, const Nullkiller2 * ai) const; + void evaluateDefence(Goals::TGoalVec & tasks, const CGTownInstance * town, const Nullkiller * ai) const; + void evaluateRecruitingHero(Goals::TGoalVec & tasks, const HitMapInfo & threat, const CGTownInstance * town, const Nullkiller * ai) const; }; } diff --git a/AI/Nullkiller2/Behaviors/ExplorationBehavior.cpp b/AI/Nullkiller2/Behaviors/ExplorationBehavior.cpp index 03933e3a1..b9c6e568d 100644 --- a/AI/Nullkiller2/Behaviors/ExplorationBehavior.cpp +++ b/AI/Nullkiller2/Behaviors/ExplorationBehavior.cpp @@ -29,7 +29,7 @@ std::string ExplorationBehavior::toString() const return "Explore"; } -Goals::TGoalVec ExplorationBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec ExplorationBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; diff --git a/AI/Nullkiller2/Behaviors/ExplorationBehavior.h b/AI/Nullkiller2/Behaviors/ExplorationBehavior.h index 60b43940f..29bde6174 100644 --- a/AI/Nullkiller2/Behaviors/ExplorationBehavior.h +++ b/AI/Nullkiller2/Behaviors/ExplorationBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const ExplorationBehavior & other) const override diff --git a/AI/Nullkiller2/Behaviors/GatherArmyBehavior.cpp b/AI/Nullkiller2/Behaviors/GatherArmyBehavior.cpp index 7da384fa5..08dc4a146 100644 --- a/AI/Nullkiller2/Behaviors/GatherArmyBehavior.cpp +++ b/AI/Nullkiller2/Behaviors/GatherArmyBehavior.cpp @@ -9,7 +9,7 @@ */ #include "StdInc.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../Goals/ExecuteHeroChain.h" #include "../Goals/Composition.h" #include "../Goals/RecruitHero.h" @@ -30,7 +30,7 @@ std::string GatherArmyBehavior::toString() const return "Gather army"; } -Goals::TGoalVec GatherArmyBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec GatherArmyBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; @@ -59,7 +59,7 @@ Goals::TGoalVec GatherArmyBehavior::decompose(const Nullkiller2 * ai) const return tasks; } -Goals::TGoalVec GatherArmyBehavior::deliverArmyToHero(const Nullkiller2 * ai, const CGHeroInstance * hero) const +Goals::TGoalVec GatherArmyBehavior::deliverArmyToHero(const Nullkiller * ai, const CGHeroInstance * hero) const { Goals::TGoalVec tasks; const int3 pos = hero->visitablePos(); @@ -216,7 +216,7 @@ Goals::TGoalVec GatherArmyBehavior::deliverArmyToHero(const Nullkiller2 * ai, co return tasks; } -Goals::TGoalVec GatherArmyBehavior::upgradeArmy(const Nullkiller2 * ai, const CGTownInstance * upgrader) const +Goals::TGoalVec GatherArmyBehavior::upgradeArmy(const Nullkiller * ai, const CGTownInstance * upgrader) const { Goals::TGoalVec tasks; const int3 pos = upgrader->visitablePos(); diff --git a/AI/Nullkiller2/Behaviors/GatherArmyBehavior.h b/AI/Nullkiller2/Behaviors/GatherArmyBehavior.h index a9e4929de..f28785c49 100644 --- a/AI/Nullkiller2/Behaviors/GatherArmyBehavior.h +++ b/AI/Nullkiller2/Behaviors/GatherArmyBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const GatherArmyBehavior & other) const override @@ -34,8 +34,8 @@ namespace Goals } private: - TGoalVec deliverArmyToHero(const Nullkiller2 * ai, const CGHeroInstance * hero) const; - TGoalVec upgradeArmy(const Nullkiller2 * ai, const CGTownInstance * upgrader) const; + TGoalVec deliverArmyToHero(const Nullkiller * ai, const CGHeroInstance * hero) const; + TGoalVec upgradeArmy(const Nullkiller * ai, const CGTownInstance * upgrader) const; }; } diff --git a/AI/Nullkiller2/Behaviors/RecruitHeroBehavior.cpp b/AI/Nullkiller2/Behaviors/RecruitHeroBehavior.cpp index 153750568..90410b9cf 100644 --- a/AI/Nullkiller2/Behaviors/RecruitHeroBehavior.cpp +++ b/AI/Nullkiller2/Behaviors/RecruitHeroBehavior.cpp @@ -24,7 +24,7 @@ std::string RecruitHeroBehavior::toString() const return "Recruit hero"; } -Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; auto towns = ai->cb->getTownsInfo(); diff --git a/AI/Nullkiller2/Behaviors/RecruitHeroBehavior.h b/AI/Nullkiller2/Behaviors/RecruitHeroBehavior.h index 5956a4bad..21c1a0c9f 100644 --- a/AI/Nullkiller2/Behaviors/RecruitHeroBehavior.h +++ b/AI/Nullkiller2/Behaviors/RecruitHeroBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const RecruitHeroBehavior & other) const override diff --git a/AI/Nullkiller2/Behaviors/StartupBehavior.cpp b/AI/Nullkiller2/Behaviors/StartupBehavior.cpp index f60021ef9..ad04f0a67 100644 --- a/AI/Nullkiller2/Behaviors/StartupBehavior.cpp +++ b/AI/Nullkiller2/Behaviors/StartupBehavior.cpp @@ -16,7 +16,7 @@ #include "../Goals/ExecuteHeroChain.h" #include "../Goals/ExchangeSwapTownHeroes.h" #include "../../../lib/mapObjects/CGResource.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { @@ -41,7 +41,7 @@ const AIPath getShortestPath(const CGTownInstance * town, const std::vectorpathfinder->getPathInfo(town->visitablePos()); @@ -59,7 +59,7 @@ const CGHeroInstance * getNearestHero(const Nullkiller2 * ai, const CGTownInstan return shortestPath.targetHero; } -bool needToRecruitHero(const Nullkiller2 * ai, const CGTownInstance * startupTown) +bool needToRecruitHero(const Nullkiller * ai, const CGTownInstance * startupTown) { if(!ai->heroManager->canRecruitHero(startupTown)) return false; @@ -108,7 +108,7 @@ bool needToRecruitHero(const Nullkiller2 * ai, const CGTownInstance * startupTow return cb->getHeroCount(ai->playerID, true) < basicCount + boost; } -Goals::TGoalVec StartupBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec StartupBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; auto towns = ai->cb->getTownsInfo(); diff --git a/AI/Nullkiller2/Behaviors/StartupBehavior.h b/AI/Nullkiller2/Behaviors/StartupBehavior.h index 4321747ad..fcae58335 100644 --- a/AI/Nullkiller2/Behaviors/StartupBehavior.h +++ b/AI/Nullkiller2/Behaviors/StartupBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const StartupBehavior & other) const override diff --git a/AI/Nullkiller2/Behaviors/StayAtTownBehavior.cpp b/AI/Nullkiller2/Behaviors/StayAtTownBehavior.cpp index be28fad94..106043540 100644 --- a/AI/Nullkiller2/Behaviors/StayAtTownBehavior.cpp +++ b/AI/Nullkiller2/Behaviors/StayAtTownBehavior.cpp @@ -15,7 +15,7 @@ #include "../Goals/Composition.h" #include "../Goals/ExecuteHeroChain.h" #include "lib/mapObjects/MapObjects.h" //for victory conditions -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { @@ -27,7 +27,7 @@ std::string StayAtTownBehavior::toString() const return "StayAtTownBehavior"; } -Goals::TGoalVec StayAtTownBehavior::decompose(const Nullkiller2 * ai) const +Goals::TGoalVec StayAtTownBehavior::decompose(const Nullkiller * ai) const { Goals::TGoalVec tasks; auto towns = ai->cb->getTownsInfo(); diff --git a/AI/Nullkiller2/Behaviors/StayAtTownBehavior.h b/AI/Nullkiller2/Behaviors/StayAtTownBehavior.h index 0b2f50481..053ce3d40 100644 --- a/AI/Nullkiller2/Behaviors/StayAtTownBehavior.h +++ b/AI/Nullkiller2/Behaviors/StayAtTownBehavior.h @@ -25,7 +25,7 @@ namespace Goals { } - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool operator==(const StayAtTownBehavior & other) const override diff --git a/AI/Nullkiller2/CMakeLists.txt b/AI/Nullkiller2/CMakeLists.txt index 3cb765431..5f5d9f141 100644 --- a/AI/Nullkiller2/CMakeLists.txt +++ b/AI/Nullkiller2/CMakeLists.txt @@ -47,7 +47,7 @@ set(Nullkiller_SRCS Markers/UnlockCluster.cpp Markers/DefendTown.cpp Markers/ExplorationPoint.cpp - Engine/Nullkiller2.cpp + Engine/Nullkiller.cpp Engine/DeepDecomposer.cpp Engine/PriorityEvaluator.cpp Analyzers/DangerHitMapAnalyzer.cpp @@ -123,7 +123,7 @@ set(Nullkiller_HEADERS Markers/UnlockCluster.h Markers/DefendTown.h Markers/ExplorationPoint.h - Engine/Nullkiller2.h + Engine/Nullkiller.h Engine/DeepDecomposer.h Engine/PriorityEvaluator.h Analyzers/DangerHitMapAnalyzer.h diff --git a/AI/Nullkiller2/Engine/DeepDecomposer.cpp b/AI/Nullkiller2/Engine/DeepDecomposer.cpp index 6a62b61a8..85625ecc5 100644 --- a/AI/Nullkiller2/Engine/DeepDecomposer.cpp +++ b/AI/Nullkiller2/Engine/DeepDecomposer.cpp @@ -26,7 +26,7 @@ namespace NKAI using namespace Goals; -DeepDecomposer::DeepDecomposer(const Nullkiller2 * ai) +DeepDecomposer::DeepDecomposer(const Nullkiller * ai) :ai(ai), depth(0) { } diff --git a/AI/Nullkiller2/Engine/DeepDecomposer.h b/AI/Nullkiller2/Engine/DeepDecomposer.h index e9c3d065f..7a30d99ee 100644 --- a/AI/Nullkiller2/Engine/DeepDecomposer.h +++ b/AI/Nullkiller2/Engine/DeepDecomposer.h @@ -30,10 +30,10 @@ private: std::vector goals; std::vector decompositionCache; int depth; - const Nullkiller2 * ai; + const Nullkiller * ai; public: - DeepDecomposer(const Nullkiller2 * ai); + DeepDecomposer(const Nullkiller * ai); void reset(); void decompose(Goals::TGoalVec & result, Goals::TSubgoal behavior, int depthLimit); diff --git a/AI/Nullkiller2/Engine/FuzzyHelper.cpp b/AI/Nullkiller2/Engine/FuzzyHelper.cpp index 57239b679..f3dd29bfb 100644 --- a/AI/Nullkiller2/Engine/FuzzyHelper.cpp +++ b/AI/Nullkiller2/Engine/FuzzyHelper.cpp @@ -11,7 +11,7 @@ #include "FuzzyHelper.h" #include "../Goals/Goals.h" -#include "Nullkiller2.h" +#include "Nullkiller.h" #include "../../../lib/mapObjectConstructors/AObjectTypeHandler.h" #include "../../../lib/mapObjectConstructors/CObjectClassesHandler.h" diff --git a/AI/Nullkiller2/Engine/FuzzyHelper.h b/AI/Nullkiller2/Engine/FuzzyHelper.h index 826816ee7..455da61e6 100644 --- a/AI/Nullkiller2/Engine/FuzzyHelper.h +++ b/AI/Nullkiller2/Engine/FuzzyHelper.h @@ -13,16 +13,16 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; class DLL_EXPORT FuzzyHelper { private: - const Nullkiller2 * ai; + const Nullkiller * ai; TacticalAdvantageEngine tacticalAdvantageEngine; public: - FuzzyHelper(const Nullkiller2 * ai): ai(ai) {} + FuzzyHelper(const Nullkiller * ai): ai(ai) {} ui64 evaluateDanger(const CGObjectInstance * obj); ui64 evaluateDanger(const int3 & tile, const CGHeroInstance * visitor, bool checkGuards = true); diff --git a/AI/Nullkiller2/Engine/Nullkiller2.cpp b/AI/Nullkiller2/Engine/Nullkiller.cpp similarity index 93% rename from AI/Nullkiller2/Engine/Nullkiller2.cpp rename to AI/Nullkiller2/Engine/Nullkiller.cpp index 1c0b412de..be301eba4 100644 --- a/AI/Nullkiller2/Engine/Nullkiller2.cpp +++ b/AI/Nullkiller2/Engine/Nullkiller.cpp @@ -8,7 +8,7 @@ * */ #include "StdInc.h" -#include "Nullkiller2.h" +#include "Nullkiller.h" #include "../AIGateway.h" #include "../Behaviors/CaptureObjectsBehavior.h" #include "../Behaviors/RecruitHeroBehavior.h" @@ -33,9 +33,9 @@ namespace NKAI using namespace Goals; // while we play vcmieagles graph can be shared -std::unique_ptr Nullkiller2::baseGraph; +std::unique_ptr Nullkiller::baseGraph; -Nullkiller2::Nullkiller2() +Nullkiller::Nullkiller() : activeHero(nullptr) , scanDepth(ScanDepth::MAIN_FULL) , useHeroChain(true) @@ -45,7 +45,7 @@ Nullkiller2::Nullkiller2() } -Nullkiller2::~Nullkiller2() = default; +Nullkiller::~Nullkiller() = default; bool canUseOpenMap(std::shared_ptr cb, PlayerColor playerID) { @@ -69,7 +69,7 @@ bool canUseOpenMap(std::shared_ptr cb, PlayerColor playerID) return true; } -void Nullkiller2::init(std::shared_ptr cb, AIGateway * gateway) +void Nullkiller::init(std::shared_ptr cb, AIGateway * gateway) { this->cb = cb; this->gateway = gateway; @@ -166,7 +166,7 @@ void TaskPlan::merge(TSubgoal task) tasks.emplace_back(task); } -Goals::TTask Nullkiller2::choseBestTask(Goals::TGoalVec & tasks) const +Goals::TTask Nullkiller::choseBestTask(Goals::TGoalVec & tasks) const { if(tasks.empty()) { @@ -187,7 +187,7 @@ Goals::TTask Nullkiller2::choseBestTask(Goals::TGoalVec & tasks) const return taskptr(*bestTask); } -Goals::TTaskVec Nullkiller2::buildPlan(TGoalVec & tasks, int priorityTier) const +Goals::TTaskVec Nullkiller::buildPlan(TGoalVec & tasks, int priorityTier) const { TaskPlan taskPlan; @@ -216,7 +216,7 @@ Goals::TTaskVec Nullkiller2::buildPlan(TGoalVec & tasks, int priorityTier) const return taskPlan.getTasks(); } -void Nullkiller2::decompose(Goals::TGoalVec & result, Goals::TSubgoal behavior, int decompositionMaxDepth) const +void Nullkiller::decompose(Goals::TGoalVec & result, Goals::TSubgoal behavior, int decompositionMaxDepth) const { makingTurnInterrupption.interruptionPoint(); @@ -234,7 +234,7 @@ void Nullkiller2::decompose(Goals::TGoalVec & result, Goals::TSubgoal behavior, timeElapsed(start)); } -void Nullkiller2::resetAiState() +void Nullkiller::resetAiState() { std::unique_lock lockGuard(aiStateMutex); @@ -252,12 +252,12 @@ void Nullkiller2::resetAiState() } } -void Nullkiller2::invalidatePathfinderData() +void Nullkiller::invalidatePathfinderData() { pathfinderInvalidated = true; } -void Nullkiller2::updateAiState(int pass, bool fast) +void Nullkiller::updateAiState(int pass, bool fast) { makingTurnInterrupption.interruptionPoint(); @@ -334,12 +334,12 @@ void Nullkiller2::updateAiState(int pass, bool fast) logAi->debug("AI state updated in %ld ms", timeElapsed(start)); } -bool Nullkiller2::isHeroLocked(const CGHeroInstance * hero) const +bool Nullkiller::isHeroLocked(const CGHeroInstance * hero) const { return getHeroLockedReason(hero) != HeroLockedReason::NOT_LOCKED; } -bool Nullkiller2::arePathHeroesLocked(const AIPath & path) const +bool Nullkiller::arePathHeroesLocked(const AIPath & path) const { if(getHeroLockedReason(path.targetHero) == HeroLockedReason::STARTUP) { @@ -365,14 +365,14 @@ bool Nullkiller2::arePathHeroesLocked(const AIPath & path) const return false; } -HeroLockedReason Nullkiller2::getHeroLockedReason(const CGHeroInstance * hero) const +HeroLockedReason Nullkiller::getHeroLockedReason(const CGHeroInstance * hero) const { auto found = lockedHeroes.find(hero); return found != lockedHeroes.end() ? found->second : HeroLockedReason::NOT_LOCKED; } -void Nullkiller2::makeTurn() +void Nullkiller::makeTurn() { std::lock_guard sharedStorageLock(AISharedStorage::locker); @@ -572,7 +572,7 @@ void Nullkiller2::makeTurn() } } -bool Nullkiller2::areAffectedObjectsPresent(Goals::TTask task) const +bool Nullkiller::areAffectedObjectsPresent(Goals::TTask task) const { auto affectedObjs = task->getAffectedObjects(); @@ -585,7 +585,7 @@ bool Nullkiller2::areAffectedObjectsPresent(Goals::TTask task) const return true; } -HeroRole Nullkiller2::getTaskRole(Goals::TTask task) const +HeroRole Nullkiller::getTaskRole(Goals::TTask task) const { HeroPtr hero = task->getHero(); HeroRole heroRole = HeroRole::MAIN; @@ -596,7 +596,7 @@ HeroRole Nullkiller2::getTaskRole(Goals::TTask task) const return heroRole; } -bool Nullkiller2::executeTask(Goals::TTask task) +bool Nullkiller::executeTask(Goals::TTask task) { auto start = std::chrono::high_resolution_clock::now(); std::string taskDescr = task->toString(); @@ -624,7 +624,7 @@ bool Nullkiller2::executeTask(Goals::TTask task) return true; } -TResources Nullkiller2::getFreeResources() const +TResources Nullkiller::getFreeResources() const { auto freeRes = cb->getResourceAmount() - lockedResources; @@ -633,12 +633,12 @@ TResources Nullkiller2::getFreeResources() const return freeRes; } -void Nullkiller2::lockResources(const TResources & res) +void Nullkiller::lockResources(const TResources & res) { lockedResources += res; } -bool Nullkiller2::handleTrading() +bool Nullkiller::handleTrading() { bool haveTraded = false; bool shouldTryToTrade = true; @@ -736,12 +736,12 @@ bool Nullkiller2::handleTrading() return haveTraded; } -std::shared_ptr Nullkiller2::getPathsInfo(const CGHeroInstance * h) const +std::shared_ptr Nullkiller::getPathsInfo(const CGHeroInstance * h) const { return pathfinderCache->getPathsInfo(h); } -void Nullkiller2::invalidatePaths() +void Nullkiller::invalidatePaths() { pathfinderCache->invalidatePaths(); } diff --git a/AI/Nullkiller2/Engine/Nullkiller2.h b/AI/Nullkiller2/Engine/Nullkiller.h similarity index 98% rename from AI/Nullkiller2/Engine/Nullkiller2.h rename to AI/Nullkiller2/Engine/Nullkiller.h index 6a0c6c018..810e9c904 100644 --- a/AI/Nullkiller2/Engine/Nullkiller2.h +++ b/AI/Nullkiller2/Engine/Nullkiller.h @@ -73,7 +73,7 @@ public: void merge(Goals::TSubgoal task); }; -class Nullkiller2 +class Nullkiller { private: const CGHeroInstance * activeHero; @@ -110,8 +110,8 @@ public: std::mutex aiStateMutex; mutable ThreadInterruption makingTurnInterrupption; - Nullkiller2(); - ~Nullkiller2(); + Nullkiller(); + ~Nullkiller(); void init(std::shared_ptr cb, AIGateway * gateway); void makeTurn(); bool isActive(const CGHeroInstance * hero) const { return activeHero == hero; } diff --git a/AI/Nullkiller2/Engine/PriorityEvaluator.cpp b/AI/Nullkiller2/Engine/PriorityEvaluator.cpp index 32ed548c7..047688632 100644 --- a/AI/Nullkiller2/Engine/PriorityEvaluator.cpp +++ b/AI/Nullkiller2/Engine/PriorityEvaluator.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include -#include "Nullkiller2.h" +#include "Nullkiller.h" #include "../../../lib/entities/artifact/CArtifact.h" #include "../../../lib/mapObjectConstructors/AObjectTypeHandler.h" #include "../../../lib/mapObjectConstructors/CObjectClassesHandler.h" @@ -37,7 +37,7 @@ namespace NKAI constexpr float MIN_CRITICAL_VALUE = 2.0f; -EvaluationContext::EvaluationContext(const Nullkiller2* ai) +EvaluationContext::EvaluationContext(const Nullkiller* ai) : movementCost(0.0), manaCost(0), danger(0), @@ -938,10 +938,10 @@ public: class ExecuteHeroChainEvaluationContextBuilder : public IEvaluationContextBuilder { private: - const Nullkiller2 * ai; + const Nullkiller * ai; public: - ExecuteHeroChainEvaluationContextBuilder(const Nullkiller2 * ai) : ai(ai) {} + ExecuteHeroChainEvaluationContextBuilder(const Nullkiller * ai) : ai(ai) {} void buildEvaluationContext(EvaluationContext & evaluationContext, Goals::TSubgoal task) const override { @@ -1057,7 +1057,7 @@ public: class ClusterEvaluationContextBuilder : public IEvaluationContextBuilder { public: - ClusterEvaluationContextBuilder(const Nullkiller2 * ai) {} + ClusterEvaluationContextBuilder(const Nullkiller * ai) {} void buildEvaluationContext(EvaluationContext & evaluationContext, Goals::TSubgoal task) const override { @@ -1141,10 +1141,10 @@ public: class DismissHeroContextBuilder : public IEvaluationContextBuilder { private: - const Nullkiller2 * ai; + const Nullkiller * ai; public: - DismissHeroContextBuilder(const Nullkiller2 * ai) : ai(ai) {} + DismissHeroContextBuilder(const Nullkiller * ai) : ai(ai) {} void buildEvaluationContext(EvaluationContext & evaluationContext, Goals::TSubgoal task) const override { @@ -1276,7 +1276,7 @@ uint64_t RewardEvaluator::getUpgradeArmyReward(const CGTownInstance * town, cons return upgradedPower - creaturesToUpgrade.power; } -PriorityEvaluator::PriorityEvaluator(const Nullkiller2 * ai) +PriorityEvaluator::PriorityEvaluator(const Nullkiller * ai) :ai(ai) { initVisitTile(); diff --git a/AI/Nullkiller2/Engine/PriorityEvaluator.h b/AI/Nullkiller2/Engine/PriorityEvaluator.h index 9f1d3c858..dc3ed4a9d 100644 --- a/AI/Nullkiller2/Engine/PriorityEvaluator.h +++ b/AI/Nullkiller2/Engine/PriorityEvaluator.h @@ -24,15 +24,15 @@ namespace NKAI { class BuildingInfo; -class Nullkiller2; +class Nullkiller; struct HitMapInfo; class RewardEvaluator { public: - const Nullkiller2 * ai; + const Nullkiller * ai; - RewardEvaluator(const Nullkiller2 * ai) : ai(ai) {} + RewardEvaluator(const Nullkiller * ai) : ai(ai) {} uint64_t getArmyReward(const CGObjectInstance * target, const CGHeroInstance * hero, const CCreatureSet * army, bool checkGold) const; uint64_t getArmyGrowth(const CGObjectInstance * target, const CGHeroInstance * hero, const CCreatureSet * army) const; @@ -86,7 +86,7 @@ struct DLL_EXPORT EvaluationContext int explorePriority; float powerRatio; - EvaluationContext(const Nullkiller2 * ai); + EvaluationContext(const Nullkiller * ai); void addNonCriticalStrategicalValue(float value); }; @@ -98,12 +98,12 @@ public: virtual void buildEvaluationContext(EvaluationContext & evaluationContext, Goals::TSubgoal goal) const = 0; }; -class Nullkiller2; +class Nullkiller; class PriorityEvaluator { public: - PriorityEvaluator(const Nullkiller2 * ai); + PriorityEvaluator(const Nullkiller * ai); ~PriorityEvaluator(); void initVisitTile(); @@ -125,7 +125,7 @@ public: }; private: - const Nullkiller2 * ai; + const Nullkiller * ai; fl::Engine * engine; fl::InputVariable * armyLossPersentageVariable; diff --git a/AI/Nullkiller2/Goals/AbstractGoal.h b/AI/Nullkiller2/Goals/AbstractGoal.h index 0549f6b95..d42a40a45 100644 --- a/AI/Nullkiller2/Goals/AbstractGoal.h +++ b/AI/Nullkiller2/Goals/AbstractGoal.h @@ -20,7 +20,7 @@ namespace NKAI struct HeroPtr; class AIGateway; class FuzzyHelper; -class Nullkiller2; +class Nullkiller; namespace Goals { @@ -133,7 +133,7 @@ namespace Goals return const_cast(this); } - virtual TGoalVec decompose(const Nullkiller2 * ai) const + virtual TGoalVec decompose(const Nullkiller * ai) const { return TGoalVec(); } diff --git a/AI/Nullkiller2/Goals/BuyArmy.cpp b/AI/Nullkiller2/Goals/BuyArmy.cpp index 06c2e087b..f561da3a8 100644 --- a/AI/Nullkiller2/Goals/BuyArmy.cpp +++ b/AI/Nullkiller2/Goals/BuyArmy.cpp @@ -11,7 +11,7 @@ #include "BuyArmy.h" #include "../../../lib/mapObjects/CGTownInstance.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI diff --git a/AI/Nullkiller2/Goals/CGoal.h b/AI/Nullkiller2/Goals/CGoal.h index 3a56f4812..c01097eb1 100644 --- a/AI/Nullkiller2/Goals/CGoal.h +++ b/AI/Nullkiller2/Goals/CGoal.h @@ -48,7 +48,7 @@ namespace Goals virtual bool operator==(const T & other) const = 0; - TGoalVec decompose(const Nullkiller2 * ai) const override + TGoalVec decompose(const Nullkiller * ai) const override { TSubgoal single = decomposeSingle(ai); @@ -59,7 +59,7 @@ namespace Goals } protected: - virtual TSubgoal decomposeSingle(const Nullkiller2 * ai) const + virtual TSubgoal decomposeSingle(const Nullkiller * ai) const { return TSubgoal(); } diff --git a/AI/Nullkiller2/Goals/CaptureObject.cpp b/AI/Nullkiller2/Goals/CaptureObject.cpp index a7d2b3c8c..7ca2ab266 100644 --- a/AI/Nullkiller2/Goals/CaptureObject.cpp +++ b/AI/Nullkiller2/Goals/CaptureObject.cpp @@ -11,7 +11,7 @@ #include "CaptureObject.h" #include "../../../lib/mapObjects/CGTownInstance.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../Behaviors/CaptureObjectsBehavior.h" @@ -35,7 +35,7 @@ std::string CaptureObject::toString() const return "Capture " + name + " at " + tile.toString(); } -TGoalVec CaptureObject::decompose(const Nullkiller2 * ai) const +TGoalVec CaptureObject::decompose(const Nullkiller * ai) const { return CaptureObjectsBehavior(ai->cb->getObj(ObjectInstanceID(objid))).decompose(ai); } diff --git a/AI/Nullkiller2/Goals/CaptureObject.h b/AI/Nullkiller2/Goals/CaptureObject.h index bff2c0848..2073cd2fe 100644 --- a/AI/Nullkiller2/Goals/CaptureObject.h +++ b/AI/Nullkiller2/Goals/CaptureObject.h @@ -35,7 +35,7 @@ namespace Goals } bool operator==(const CaptureObject & other) const override; - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool hasHash() const override { return true; } uint64_t getHash() const override; diff --git a/AI/Nullkiller2/Goals/CompleteQuest.cpp b/AI/Nullkiller2/Goals/CompleteQuest.cpp index 04547146e..1ad7f7c29 100644 --- a/AI/Nullkiller2/Goals/CompleteQuest.cpp +++ b/AI/Nullkiller2/Goals/CompleteQuest.cpp @@ -31,7 +31,7 @@ std::string CompleteQuest::toString() const return "Complete quest " + questToString(); } -TGoalVec CompleteQuest::decompose(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::decompose(const Nullkiller * ai) const { if(isKeyMaster(q)) { @@ -106,7 +106,7 @@ std::string CompleteQuest::questToString() const return ms.toString(); } -TGoalVec CompleteQuest::tryCompleteQuest(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::tryCompleteQuest(const Nullkiller * ai) const { auto paths = ai->pathfinder->getPathInfo(q.getObject(cb)->visitablePos()); @@ -118,7 +118,7 @@ TGoalVec CompleteQuest::tryCompleteQuest(const Nullkiller2 * ai) const return CaptureObjectsBehavior::getVisitGoals(paths, ai, q.getObject(cb)); } -TGoalVec CompleteQuest::missionArt(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionArt(const Nullkiller * ai) const { TGoalVec solutions = tryCompleteQuest(ai); @@ -135,7 +135,7 @@ TGoalVec CompleteQuest::missionArt(const Nullkiller2 * ai) const return solutions; } -TGoalVec CompleteQuest::missionHero(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionHero(const Nullkiller * ai) const { TGoalVec solutions = tryCompleteQuest(ai); @@ -148,7 +148,7 @@ TGoalVec CompleteQuest::missionHero(const Nullkiller2 * ai) const return solutions; } -TGoalVec CompleteQuest::missionArmy(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionArmy(const Nullkiller * ai) const { auto paths = ai->pathfinder->getPathInfo(q.getObject(cb)->visitablePos()); @@ -160,17 +160,17 @@ TGoalVec CompleteQuest::missionArmy(const Nullkiller2 * ai) const return CaptureObjectsBehavior::getVisitGoals(paths, ai, q.getObject(cb)); } -TGoalVec CompleteQuest::missionIncreasePrimaryStat(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionIncreasePrimaryStat(const Nullkiller * ai) const { return tryCompleteQuest(ai); } -TGoalVec CompleteQuest::missionLevel(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionLevel(const Nullkiller * ai) const { return tryCompleteQuest(ai); } -TGoalVec CompleteQuest::missionKeymaster(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionKeymaster(const Nullkiller * ai) const { if(isObjectPassable(ai, q.getObject(cb))) { @@ -182,13 +182,13 @@ TGoalVec CompleteQuest::missionKeymaster(const Nullkiller2 * ai) const } } -TGoalVec CompleteQuest::missionResources(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionResources(const Nullkiller * ai) const { TGoalVec solutions = tryCompleteQuest(ai); return solutions; } -TGoalVec CompleteQuest::missionDestroyObj(const Nullkiller2 * ai) const +TGoalVec CompleteQuest::missionDestroyObj(const Nullkiller * ai) const { auto obj = ai->cb->getObj(q.getQuest(cb)->killTarget); diff --git a/AI/Nullkiller2/Goals/CompleteQuest.h b/AI/Nullkiller2/Goals/CompleteQuest.h index 0556eda60..2ea62be7c 100644 --- a/AI/Nullkiller2/Goals/CompleteQuest.h +++ b/AI/Nullkiller2/Goals/CompleteQuest.h @@ -28,7 +28,7 @@ namespace Goals { } - Goals::TGoalVec decompose(const Nullkiller2 * ai) const override; + Goals::TGoalVec decompose(const Nullkiller * ai) const override; std::string toString() const override; bool hasHash() const override { return true; } uint64_t getHash() const override; @@ -36,15 +36,15 @@ namespace Goals bool operator==(const CompleteQuest & other) const override; private: - TGoalVec tryCompleteQuest(const Nullkiller2 * ai) const; - TGoalVec missionArt(const Nullkiller2 * ai) const; - TGoalVec missionHero(const Nullkiller2 * ai) const; - TGoalVec missionArmy(const Nullkiller2 * ai) const; - TGoalVec missionResources(const Nullkiller2 * ai) const; - TGoalVec missionDestroyObj(const Nullkiller2 * ai) const; - TGoalVec missionIncreasePrimaryStat(const Nullkiller2 * ai) const; - TGoalVec missionLevel(const Nullkiller2 * ai) const; - TGoalVec missionKeymaster(const Nullkiller2 * ai) const; + TGoalVec tryCompleteQuest(const Nullkiller * ai) const; + TGoalVec missionArt(const Nullkiller * ai) const; + TGoalVec missionHero(const Nullkiller * ai) const; + TGoalVec missionArmy(const Nullkiller * ai) const; + TGoalVec missionResources(const Nullkiller * ai) const; + TGoalVec missionDestroyObj(const Nullkiller * ai) const; + TGoalVec missionIncreasePrimaryStat(const Nullkiller * ai) const; + TGoalVec missionLevel(const Nullkiller * ai) const; + TGoalVec missionKeymaster(const Nullkiller * ai) const; std::string questToString() const; }; } diff --git a/AI/Nullkiller2/Goals/Composition.cpp b/AI/Nullkiller2/Goals/Composition.cpp index 33569df1e..190767a6b 100644 --- a/AI/Nullkiller2/Goals/Composition.cpp +++ b/AI/Nullkiller2/Goals/Composition.cpp @@ -59,7 +59,7 @@ void Composition::accept(AIGateway * ai) } } -TGoalVec Composition::decompose(const Nullkiller2 * ai) const +TGoalVec Composition::decompose(const Nullkiller * ai) const { TGoalVec result; diff --git a/AI/Nullkiller2/Goals/Composition.h b/AI/Nullkiller2/Goals/Composition.h index 1b5a99de3..b8a6bdd07 100644 --- a/AI/Nullkiller2/Goals/Composition.h +++ b/AI/Nullkiller2/Goals/Composition.h @@ -32,7 +32,7 @@ namespace Goals Composition & addNext(const AbstractGoal & goal); Composition & addNext(TSubgoal goal); Composition & addNextSequence(const TGoalVec & taskSequence); - TGoalVec decompose(const Nullkiller2 * ai) const override; + TGoalVec decompose(const Nullkiller * ai) const override; bool isElementar() const override; int getHeroExchangeCount() const override; diff --git a/AI/Nullkiller2/Goals/ExchangeSwapTownHeroes.cpp b/AI/Nullkiller2/Goals/ExchangeSwapTownHeroes.cpp index 6a3944e96..b1acadfb5 100644 --- a/AI/Nullkiller2/Goals/ExchangeSwapTownHeroes.cpp +++ b/AI/Nullkiller2/Goals/ExchangeSwapTownHeroes.cpp @@ -11,7 +11,7 @@ #include "ExchangeSwapTownHeroes.h" #include "ExecuteHeroChain.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { diff --git a/AI/Nullkiller2/Goals/ExchangeSwapTownHeroes.h b/AI/Nullkiller2/Goals/ExchangeSwapTownHeroes.h index 7d4298dfb..714350a7b 100644 --- a/AI/Nullkiller2/Goals/ExchangeSwapTownHeroes.h +++ b/AI/Nullkiller2/Goals/ExchangeSwapTownHeroes.h @@ -10,7 +10,7 @@ #pragma once #include "CGoal.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { diff --git a/AI/Nullkiller2/Goals/ExecuteHeroChain.cpp b/AI/Nullkiller2/Goals/ExecuteHeroChain.cpp index f124bb9e1..4ee0b1031 100644 --- a/AI/Nullkiller2/Goals/ExecuteHeroChain.cpp +++ b/AI/Nullkiller2/Goals/ExecuteHeroChain.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ExecuteHeroChain.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { diff --git a/AI/Nullkiller2/Goals/Invalid.h b/AI/Nullkiller2/Goals/Invalid.h index 2073f9486..6207f1bb0 100644 --- a/AI/Nullkiller2/Goals/Invalid.h +++ b/AI/Nullkiller2/Goals/Invalid.h @@ -27,7 +27,7 @@ namespace Goals { priority = -1; } - TGoalVec decompose(const Nullkiller2 * ai) const override + TGoalVec decompose(const Nullkiller * ai) const override { return TGoalVec(); } diff --git a/AI/Nullkiller2/Goals/StayAtTown.cpp b/AI/Nullkiller2/Goals/StayAtTown.cpp index b62ab30ef..5c3769bc5 100644 --- a/AI/Nullkiller2/Goals/StayAtTown.cpp +++ b/AI/Nullkiller2/Goals/StayAtTown.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "StayAtTown.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" namespace NKAI diff --git a/AI/Nullkiller2/Helpers/ArmyFormation.h b/AI/Nullkiller2/Helpers/ArmyFormation.h index c8ba70396..88fe0363b 100644 --- a/AI/Nullkiller2/Helpers/ArmyFormation.h +++ b/AI/Nullkiller2/Helpers/ArmyFormation.h @@ -20,7 +20,7 @@ namespace NKAI struct HeroPtr; class AIGateway; class FuzzyHelper; -class Nullkiller2; +class Nullkiller; class DLL_EXPORT ArmyFormation { @@ -28,7 +28,7 @@ private: std::shared_ptr cb; //this is enough, but we downcast from CCallback public: - ArmyFormation(std::shared_ptr CB, const Nullkiller2 * ai): cb(CB) {} + ArmyFormation(std::shared_ptr CB, const Nullkiller * ai): cb(CB) {} void rearrangeArmyForSiege(const CGTownInstance * town, const CGHeroInstance * attacker); diff --git a/AI/Nullkiller2/Helpers/ExplorationHelper.cpp b/AI/Nullkiller2/Helpers/ExplorationHelper.cpp index bd499e775..b0d093921 100644 --- a/AI/Nullkiller2/Helpers/ExplorationHelper.cpp +++ b/AI/Nullkiller2/Helpers/ExplorationHelper.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ExplorationHelper.h" #include "../../../lib/mapObjects/CGTownInstance.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../Goals/Invalid.h" #include "../Goals/Composition.h" #include "../Goals/ExecuteHeroChain.h" @@ -24,7 +24,7 @@ namespace NKAI using namespace Goals; -ExplorationHelper::ExplorationHelper(const CGHeroInstance * hero, const Nullkiller2 * ai, bool useCPathfinderAccessibility) +ExplorationHelper::ExplorationHelper(const CGHeroInstance * hero, const Nullkiller * ai, bool useCPathfinderAccessibility) :ai(ai), cbp(ai->cb.get()), hero(hero), useCPathfinderAccessibility(useCPathfinderAccessibility) { ts = cbp->getPlayerTeam(ai->playerID); diff --git a/AI/Nullkiller2/Helpers/ExplorationHelper.h b/AI/Nullkiller2/Helpers/ExplorationHelper.h index 401d3cf78..009d8a724 100644 --- a/AI/Nullkiller2/Helpers/ExplorationHelper.h +++ b/AI/Nullkiller2/Helpers/ExplorationHelper.h @@ -27,7 +27,7 @@ private: Goals::TSubgoal bestGoal; int3 bestTile; int bestTilesDiscovered; - const Nullkiller2 * ai; + const Nullkiller * ai; CCallback * cbp; const TeamState * ts; int3 ourPos; @@ -35,7 +35,7 @@ private: bool useCPathfinderAccessibility; public: - ExplorationHelper(const CGHeroInstance * hero, const Nullkiller2 * ai, bool useCPathfinderAccessibility = false); + ExplorationHelper(const CGHeroInstance * hero, const Nullkiller * ai, bool useCPathfinderAccessibility = false); Goals::TSubgoal makeComposition() const; bool scanSector(int scanRadius); bool scanMap(); diff --git a/AI/Nullkiller2/Markers/ArmyUpgrade.cpp b/AI/Nullkiller2/Markers/ArmyUpgrade.cpp index d73abda2e..21f060486 100644 --- a/AI/Nullkiller2/Markers/ArmyUpgrade.cpp +++ b/AI/Nullkiller2/Markers/ArmyUpgrade.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ArmyUpgrade.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" namespace NKAI diff --git a/AI/Nullkiller2/Markers/DefendTown.cpp b/AI/Nullkiller2/Markers/DefendTown.cpp index b06ab53ca..123b87b5e 100644 --- a/AI/Nullkiller2/Markers/DefendTown.cpp +++ b/AI/Nullkiller2/Markers/DefendTown.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "DefendTown.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" namespace NKAI diff --git a/AI/Nullkiller2/Markers/ExplorationPoint.cpp b/AI/Nullkiller2/Markers/ExplorationPoint.cpp index c4fa95b0f..916ac5b7f 100644 --- a/AI/Nullkiller2/Markers/ExplorationPoint.cpp +++ b/AI/Nullkiller2/Markers/ExplorationPoint.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "ExplorationPoint.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" #include "../Analyzers/ArmyManager.h" diff --git a/AI/Nullkiller2/Markers/HeroExchange.cpp b/AI/Nullkiller2/Markers/HeroExchange.cpp index b0c28031c..80117aeeb 100644 --- a/AI/Nullkiller2/Markers/HeroExchange.cpp +++ b/AI/Nullkiller2/Markers/HeroExchange.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "HeroExchange.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" #include "../Analyzers/ArmyManager.h" @@ -29,7 +29,7 @@ std::string HeroExchange::toString() const return "Hero exchange for " +hero->getObjectName() + " by " + exchangePath.toString(); } -uint64_t HeroExchange::getReinforcementArmyStrength(const Nullkiller2 * ai) const +uint64_t HeroExchange::getReinforcementArmyStrength(const Nullkiller * ai) const { uint64_t armyValue = ai->armyManager->howManyReinforcementsCanGet(hero, exchangePath.heroArmy); diff --git a/AI/Nullkiller2/Markers/HeroExchange.h b/AI/Nullkiller2/Markers/HeroExchange.h index 9e922ba6e..2c741b8f3 100644 --- a/AI/Nullkiller2/Markers/HeroExchange.h +++ b/AI/Nullkiller2/Markers/HeroExchange.h @@ -31,7 +31,7 @@ namespace Goals bool operator==(const HeroExchange & other) const override; std::string toString() const override; - uint64_t getReinforcementArmyStrength(const Nullkiller2 * ai) const; + uint64_t getReinforcementArmyStrength(const Nullkiller * ai) const; }; } diff --git a/AI/Nullkiller2/Markers/UnlockCluster.cpp b/AI/Nullkiller2/Markers/UnlockCluster.cpp index 0808ce44b..c52ee8345 100644 --- a/AI/Nullkiller2/Markers/UnlockCluster.cpp +++ b/AI/Nullkiller2/Markers/UnlockCluster.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "UnlockCluster.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../AIUtility.h" namespace NKAI diff --git a/AI/Nullkiller2/Pathfinding/AINodeStorage.cpp b/AI/Nullkiller2/Pathfinding/AINodeStorage.cpp index f34d7dfb9..c3e3d1043 100644 --- a/AI/Nullkiller2/Pathfinding/AINodeStorage.cpp +++ b/AI/Nullkiller2/Pathfinding/AINodeStorage.cpp @@ -11,7 +11,7 @@ #include "AINodeStorage.h" #include "Actions/TownPortalAction.h" #include "Actions/WhirlpoolAction.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/callback/IGameInfoCallback.h" #include "../../../lib/mapping/CMap.h" #include "../../../lib/pathfinder/CPathfinder.h" @@ -102,7 +102,7 @@ int AINodeStorage::getBucketSize() const return ai->settings->getPathfinderBucketSize(); } -AINodeStorage::AINodeStorage(const Nullkiller2 * ai, const int3 & Sizes) +AINodeStorage::AINodeStorage(const Nullkiller * ai, const int3 & Sizes) : sizes(Sizes), ai(ai), cb(ai->cb.get()), nodes(Sizes, ai->settings->getPathfinderBucketSize() * ai->settings->getPathfinderBucketsCount()) { accessibility = std::make_unique>( diff --git a/AI/Nullkiller2/Pathfinding/AINodeStorage.h b/AI/Nullkiller2/Pathfinding/AINodeStorage.h index 3cf11cda3..649da8d3f 100644 --- a/AI/Nullkiller2/Pathfinding/AINodeStorage.h +++ b/AI/Nullkiller2/Pathfinding/AINodeStorage.h @@ -166,7 +166,7 @@ private: std::unique_ptr> accessibility; const CPlayerSpecificInfoCallback * cb; - const Nullkiller2 * ai; + const Nullkiller * ai; AISharedStorage nodes; std::vector> actors; std::vector heroChain; @@ -179,7 +179,7 @@ private: public: /// more than 1 chain layer for each hero allows us to have more than 1 path to each tile so we can chose more optimal one. - AINodeStorage(const Nullkiller2 * ai, const int3 & sizes); + AINodeStorage(const Nullkiller * ai, const int3 & sizes); ~AINodeStorage(); void initialize(const PathfinderOptions & options, const IGameInfoCallback & gameInfo) override; diff --git a/AI/Nullkiller2/Pathfinding/AIPathfinder.cpp b/AI/Nullkiller2/Pathfinding/AIPathfinder.cpp index 007ce81d4..a6c8c30b3 100644 --- a/AI/Nullkiller2/Pathfinding/AIPathfinder.cpp +++ b/AI/Nullkiller2/Pathfinding/AIPathfinder.cpp @@ -11,14 +11,14 @@ #include "AIPathfinder.h" #include "AIPathfinderConfig.h" #include "../../../lib/mapping/CMap.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" namespace NKAI { std::map> AIPathfinder::heroGraphs; -AIPathfinder::AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller2 * ai) +AIPathfinder::AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller * ai) :cb(cb), ai(ai) { } diff --git a/AI/Nullkiller2/Pathfinding/AIPathfinder.h b/AI/Nullkiller2/Pathfinding/AIPathfinder.h index 2bed191b8..cd490cda4 100644 --- a/AI/Nullkiller2/Pathfinding/AIPathfinder.h +++ b/AI/Nullkiller2/Pathfinding/AIPathfinder.h @@ -18,7 +18,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; struct PathfinderSettings { @@ -40,11 +40,11 @@ class AIPathfinder private: std::shared_ptr storage; CPlayerSpecificInfoCallback * cb; - Nullkiller2 * ai; + Nullkiller * ai; static std::map> heroGraphs; public: - AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller2 * ai); + AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller * ai); void calculatePathInfo(std::vector & paths, const int3 & tile, bool includeGraph = false) const; bool isTileAccessible(const HeroPtr & hero, const int3 & tile) const; void updatePaths(const std::map & heroes, PathfinderSettings pathfinderSettings); diff --git a/AI/Nullkiller2/Pathfinding/AIPathfinderConfig.cpp b/AI/Nullkiller2/Pathfinding/AIPathfinderConfig.cpp index 54a6e7009..e5c30d59b 100644 --- a/AI/Nullkiller2/Pathfinding/AIPathfinderConfig.cpp +++ b/AI/Nullkiller2/Pathfinding/AIPathfinderConfig.cpp @@ -13,7 +13,7 @@ #include "Rules/AIMovementAfterDestinationRule.h" #include "Rules/AIMovementToDestinationRule.h" #include "Rules/AIPreviousNodeRule.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/pathfinder/CPathfinder.h" @@ -23,7 +23,7 @@ namespace AIPathfinding { std::vector> makeRuleset( CPlayerSpecificInfoCallback * cb, - Nullkiller2 * ai, + Nullkiller * ai, std::shared_ptr nodeStorage, bool allowBypassObjects) { @@ -41,7 +41,7 @@ namespace AIPathfinding AIPathfinderConfig::AIPathfinderConfig( CPlayerSpecificInfoCallback * cb, - Nullkiller2 * ai, + Nullkiller * ai, std::shared_ptr nodeStorage, bool allowBypassObjects) :PathfinderConfig(nodeStorage, *cb, makeRuleset(cb, ai, nodeStorage, allowBypassObjects)), aiNodeStorage(nodeStorage) diff --git a/AI/Nullkiller2/Pathfinding/AIPathfinderConfig.h b/AI/Nullkiller2/Pathfinding/AIPathfinderConfig.h index a36601a04..7c0b10dc7 100644 --- a/AI/Nullkiller2/Pathfinding/AIPathfinderConfig.h +++ b/AI/Nullkiller2/Pathfinding/AIPathfinderConfig.h @@ -16,7 +16,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; namespace AIPathfinding { @@ -29,7 +29,7 @@ namespace AIPathfinding public: AIPathfinderConfig( CPlayerSpecificInfoCallback * cb, - Nullkiller2 * ai, + Nullkiller * ai, std::shared_ptr nodeStorage, bool allowBypassObjects); diff --git a/AI/Nullkiller2/Pathfinding/Actions/AdventureSpellCastMovementActions.cpp b/AI/Nullkiller2/Pathfinding/Actions/AdventureSpellCastMovementActions.cpp index 4074ef78b..4c9ce19b8 100644 --- a/AI/Nullkiller2/Pathfinding/Actions/AdventureSpellCastMovementActions.cpp +++ b/AI/Nullkiller2/Pathfinding/Actions/AdventureSpellCastMovementActions.cpp @@ -56,7 +56,7 @@ namespace AIPathfinding Goals::AdventureSpellCast(hero, spellToCast).accept(ai); } - bool AdventureCastAction::canAct(const Nullkiller2 * ai, const AIPathNode * source) const + bool AdventureCastAction::canAct(const Nullkiller * ai, const AIPathNode * source) const { assert(hero == this->hero); diff --git a/AI/Nullkiller2/Pathfinding/Actions/AdventureSpellCastMovementActions.h b/AI/Nullkiller2/Pathfinding/Actions/AdventureSpellCastMovementActions.h index 8ee3bec82..a88324e3e 100644 --- a/AI/Nullkiller2/Pathfinding/Actions/AdventureSpellCastMovementActions.h +++ b/AI/Nullkiller2/Pathfinding/Actions/AdventureSpellCastMovementActions.h @@ -38,7 +38,7 @@ namespace AIPathfinding AIPathNode * dstMode, const AIPathNode * srcNode) const override; - bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const override; + bool canAct(const Nullkiller * ai, const AIPathNode * source) const override; std::string toString() const override; }; diff --git a/AI/Nullkiller2/Pathfinding/Actions/BoatActions.cpp b/AI/Nullkiller2/Pathfinding/Actions/BoatActions.cpp index 5850589d2..50bb18f51 100644 --- a/AI/Nullkiller2/Pathfinding/Actions/BoatActions.cpp +++ b/AI/Nullkiller2/Pathfinding/Actions/BoatActions.cpp @@ -27,7 +27,7 @@ namespace AIPathfinding return Goals::BuildBoat(shipyard).accept(ai); } - Goals::TSubgoal BuildBoatAction::decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const + Goals::TSubgoal BuildBoatAction::decompose(const Nullkiller * ai, const CGHeroInstance * hero) const { if(cb->getPlayerRelations(ai->playerID, shipyard->getObject()->getOwner()) == PlayerRelations::ENEMIES) { @@ -37,7 +37,7 @@ namespace AIPathfinding return Goals::sptr(Goals::Invalid()); } - bool BuildBoatAction::canAct(const Nullkiller2 * ai, const CGHeroInstance * hero, const TResources & reservedResources) const + bool BuildBoatAction::canAct(const Nullkiller * ai, const CGHeroInstance * hero, const TResources & reservedResources) const { if(cb->getPlayerRelations(hero->tempOwner, shipyard->getObject()->getOwner()) == PlayerRelations::ENEMIES) { @@ -63,12 +63,12 @@ namespace AIPathfinding return true; } - bool BuildBoatAction::canAct(const Nullkiller2 * ai, const AIPathNode * source) const + bool BuildBoatAction::canAct(const Nullkiller * ai, const AIPathNode * source) const { return canAct(ai, source->actor->hero, source->actor->armyCost); } - bool BuildBoatAction::canAct(const Nullkiller2 * ai, const AIPathNodeInfo & source) const + bool BuildBoatAction::canAct(const Nullkiller * ai, const AIPathNodeInfo & source) const { TResources res; @@ -85,7 +85,7 @@ namespace AIPathfinding return sourceActor->resourceActor; } - std::shared_ptr BuildBoatActionFactory::create(const Nullkiller2 * ai) + std::shared_ptr BuildBoatActionFactory::create(const Nullkiller * ai) { return std::make_shared(ai->cb.get(), dynamic_cast(ai->cb->getObj(shipyard))); } @@ -116,7 +116,7 @@ namespace AIPathfinding return "Build Boat at " + shipyard->getObject()->visitablePos().toString(); } - bool SummonBoatAction::canAct(const Nullkiller2 * ai, const AIPathNode * source) const + bool SummonBoatAction::canAct(const Nullkiller * ai, const AIPathNode * source) const { auto hero = source->actor->hero; diff --git a/AI/Nullkiller2/Pathfinding/Actions/BoatActions.h b/AI/Nullkiller2/Pathfinding/Actions/BoatActions.h index 518a0c9ab..b9034f910 100644 --- a/AI/Nullkiller2/Pathfinding/Actions/BoatActions.h +++ b/AI/Nullkiller2/Pathfinding/Actions/BoatActions.h @@ -40,7 +40,7 @@ namespace AIPathfinding AIPathNode * dstMode, const AIPathNode * srcNode) const override; - bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const override; + bool canAct(const Nullkiller * ai, const AIPathNode * source) const override; const ChainActor * getActor(const ChainActor * sourceActor) const override; @@ -62,13 +62,13 @@ namespace AIPathfinding { } - bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const override; - bool canAct(const Nullkiller2 * ai, const AIPathNodeInfo & source) const override; - bool canAct(const Nullkiller2 * ai, const CGHeroInstance * hero, const TResources & reservedResources) const; + bool canAct(const Nullkiller * ai, const AIPathNode * source) const override; + bool canAct(const Nullkiller * ai, const AIPathNodeInfo & source) const override; + bool canAct(const Nullkiller * ai, const CGHeroInstance * hero, const TResources & reservedResources) const; void execute(AIGateway * ai, const CGHeroInstance * hero) const override; - Goals::TSubgoal decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const override; + Goals::TSubgoal decompose(const Nullkiller * ai, const CGHeroInstance * hero) const override; const ChainActor * getActor(const ChainActor * sourceActor) const override; @@ -87,7 +87,7 @@ namespace AIPathfinding { } - std::shared_ptr create(const Nullkiller2 * ai) override; + std::shared_ptr create(const Nullkiller * ai) override; }; } diff --git a/AI/Nullkiller2/Pathfinding/Actions/BuyArmyAction.h b/AI/Nullkiller2/Pathfinding/Actions/BuyArmyAction.h index 992b5dc0f..da8d53e5b 100644 --- a/AI/Nullkiller2/Pathfinding/Actions/BuyArmyAction.h +++ b/AI/Nullkiller2/Pathfinding/Actions/BuyArmyAction.h @@ -21,7 +21,7 @@ namespace AIPathfinding private: public: - bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const override + bool canAct(const Nullkiller * ai, const AIPathNode * source) const override { return true; } diff --git a/AI/Nullkiller2/Pathfinding/Actions/QuestAction.cpp b/AI/Nullkiller2/Pathfinding/Actions/QuestAction.cpp index 9e286f593..a528157da 100644 --- a/AI/Nullkiller2/Pathfinding/Actions/QuestAction.cpp +++ b/AI/Nullkiller2/Pathfinding/Actions/QuestAction.cpp @@ -19,17 +19,17 @@ namespace NKAI namespace AIPathfinding { - bool QuestAction::canAct(const Nullkiller2 * ai, const AIPathNode * node) const + bool QuestAction::canAct(const Nullkiller * ai, const AIPathNode * node) const { return canAct(ai, node->actor->hero); } - bool QuestAction::canAct(const Nullkiller2 * ai, const AIPathNodeInfo & node) const + bool QuestAction::canAct(const Nullkiller * ai, const AIPathNodeInfo & node) const { return canAct(ai, node.targetHero); } - bool QuestAction::canAct(const Nullkiller2 * ai, const CGHeroInstance * hero) const + bool QuestAction::canAct(const Nullkiller * ai, const CGHeroInstance * hero) const { auto object = questInfo.getObject(ai->cb.get()); auto quest = questInfo.getQuest(ai->cb.get()); @@ -45,7 +45,7 @@ namespace AIPathfinding || quest->checkQuest(hero); } - Goals::TSubgoal QuestAction::decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const + Goals::TSubgoal QuestAction::decompose(const Nullkiller * ai, const CGHeroInstance * hero) const { return Goals::sptr(Goals::CompleteQuest(questInfo)); } diff --git a/AI/Nullkiller2/Pathfinding/Actions/QuestAction.h b/AI/Nullkiller2/Pathfinding/Actions/QuestAction.h index 668077165..cc0dd59de 100644 --- a/AI/Nullkiller2/Pathfinding/Actions/QuestAction.h +++ b/AI/Nullkiller2/Pathfinding/Actions/QuestAction.h @@ -28,11 +28,11 @@ namespace AIPathfinding { } - bool canAct(const Nullkiller2 * ai, const AIPathNode * node) const override; - bool canAct(const Nullkiller2 * ai, const AIPathNodeInfo & node) const override; - bool canAct(const Nullkiller2 * ai, const CGHeroInstance * hero) const; + bool canAct(const Nullkiller * ai, const AIPathNode * node) const override; + bool canAct(const Nullkiller * ai, const AIPathNodeInfo & node) const override; + bool canAct(const Nullkiller * ai, const CGHeroInstance * hero) const; - Goals::TSubgoal decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const override; + Goals::TSubgoal decompose(const Nullkiller * ai, const CGHeroInstance * hero) const override; void execute(AIGateway * ai, const CGHeroInstance * hero) const override; diff --git a/AI/Nullkiller2/Pathfinding/Actions/SpecialAction.cpp b/AI/Nullkiller2/Pathfinding/Actions/SpecialAction.cpp index b59569e9c..8e1595b18 100644 --- a/AI/Nullkiller2/Pathfinding/Actions/SpecialAction.cpp +++ b/AI/Nullkiller2/Pathfinding/Actions/SpecialAction.cpp @@ -17,7 +17,7 @@ namespace NKAI { -Goals::TSubgoal SpecialAction::decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const +Goals::TSubgoal SpecialAction::decompose(const Nullkiller * ai, const CGHeroInstance * hero) const { return Goals::sptr(Goals::Invalid()); } @@ -27,7 +27,7 @@ void SpecialAction::execute(AIGateway * ai, const CGHeroInstance * hero) const throw cannotFulfillGoalException("Can not execute " + toString()); } -bool CompositeAction::canAct(const Nullkiller2 * ai, const AIPathNode * source) const +bool CompositeAction::canAct(const Nullkiller * ai, const AIPathNode * source) const { for(auto part : parts) { @@ -37,7 +37,7 @@ bool CompositeAction::canAct(const Nullkiller2 * ai, const AIPathNode * source) return true; } -Goals::TSubgoal CompositeAction::decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const +Goals::TSubgoal CompositeAction::decompose(const Nullkiller * ai, const CGHeroInstance * hero) const { for(auto part : parts) { diff --git a/AI/Nullkiller2/Pathfinding/Actions/SpecialAction.h b/AI/Nullkiller2/Pathfinding/Actions/SpecialAction.h index 83b447958..3d8e48fb1 100644 --- a/AI/Nullkiller2/Pathfinding/Actions/SpecialAction.h +++ b/AI/Nullkiller2/Pathfinding/Actions/SpecialAction.h @@ -30,17 +30,17 @@ class SpecialAction public: virtual ~SpecialAction() = default; - virtual bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const + virtual bool canAct(const Nullkiller * ai, const AIPathNode * source) const { return true; } - virtual bool canAct(const Nullkiller2 * ai, const AIPathNodeInfo & source) const + virtual bool canAct(const Nullkiller * ai, const AIPathNodeInfo & source) const { return true; } - virtual Goals::TSubgoal decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const; + virtual Goals::TSubgoal decompose(const Nullkiller * ai, const CGHeroInstance * hero) const; virtual void execute(AIGateway * ai, const CGHeroInstance * hero) const; @@ -76,11 +76,11 @@ private: public: CompositeAction(std::vector> parts) : parts(parts) {} - bool canAct(const Nullkiller2 * ai, const AIPathNode * source) const override; + bool canAct(const Nullkiller * ai, const AIPathNode * source) const override; void execute(AIGateway * ai, const CGHeroInstance * hero) const override; std::string toString() const override; const CGObjectInstance * targetObject() const override; - Goals::TSubgoal decompose(const Nullkiller2 * ai, const CGHeroInstance * hero) const override; + Goals::TSubgoal decompose(const Nullkiller * ai, const CGHeroInstance * hero) const override; std::vector> getParts() const override { @@ -98,7 +98,7 @@ public: class ISpecialActionFactory { public: - virtual std::shared_ptr create(const Nullkiller2 * ai) = 0; + virtual std::shared_ptr create(const Nullkiller * ai) = 0; virtual ~ISpecialActionFactory() = default; }; diff --git a/AI/Nullkiller2/Pathfinding/Actors.cpp b/AI/Nullkiller2/Pathfinding/Actors.cpp index 65784ae70..7df7776e3 100644 --- a/AI/Nullkiller2/Pathfinding/Actors.cpp +++ b/AI/Nullkiller2/Pathfinding/Actors.cpp @@ -10,7 +10,7 @@ #include "StdInc.h" #include "Actors.h" #include "../AIGateway.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/mapObjects/MapObjects.h" #include "../../../lib/mapping/TerrainTile.h" #include "../../../lib/pathfinder/TurnInfo.h" @@ -97,7 +97,7 @@ std::string ObjectActor::toString() const return object->getObjectName() + " at " + object->visitablePos().toString(); } -HeroActor::HeroActor(const CGHeroInstance * hero, HeroRole heroRole, uint64_t chainMask, const Nullkiller2 * ai) +HeroActor::HeroActor(const CGHeroInstance * hero, HeroRole heroRole, uint64_t chainMask, const Nullkiller * ai) :ChainActor(hero, heroRole, chainMask) { exchangeMap.reset(new HeroExchangeMap(this, ai)); @@ -108,7 +108,7 @@ HeroActor::HeroActor( const ChainActor * carrier, const ChainActor * other, const HeroExchangeArmy * army, - const Nullkiller2 * ai) + const Nullkiller * ai) :ChainActor(carrier, other, army) { exchangeMap.reset(new HeroExchangeMap(this, ai)); @@ -185,7 +185,7 @@ ExchangeResult HeroActor::tryExchangeNoLock(const ChainActor * specialActor, con return result; } -HeroExchangeMap::HeroExchangeMap(const HeroActor * actor, const Nullkiller2 * ai) +HeroExchangeMap::HeroExchangeMap(const HeroActor * actor, const Nullkiller * ai) :actor(actor), ai(ai), sync() { } diff --git a/AI/Nullkiller2/Pathfinding/Actors.h b/AI/Nullkiller2/Pathfinding/Actors.h index 3018f2c0d..d73f01ac3 100644 --- a/AI/Nullkiller2/Pathfinding/Actors.h +++ b/AI/Nullkiller2/Pathfinding/Actors.h @@ -21,7 +21,7 @@ extern const uint64_t MIN_ARMY_STRENGTH_FOR_CHAIN; class ChainActor; class HeroActor; -class Nullkiller2; +class Nullkiller; class HeroExchangeArmy : public CArmedInstance { @@ -92,11 +92,11 @@ class HeroExchangeMap private: const HeroActor * actor; std::map exchangeMap; - const Nullkiller2 * ai; + const Nullkiller * ai; std::shared_mutex sync; public: - HeroExchangeMap(const HeroActor * actor, const Nullkiller2 * ai); + HeroExchangeMap(const HeroActor * actor, const Nullkiller * ai); ~HeroExchangeMap(); ExchangeResult tryExchangeNoLock(const ChainActor * other); @@ -121,8 +121,8 @@ public: std::shared_ptr exchangeAction; // chain flags, can be combined meaning hero exchange and so on - HeroActor(const CGHeroInstance * hero, HeroRole heroRole, uint64_t chainMask, const Nullkiller2 * ai); - HeroActor(const ChainActor * carrier, const ChainActor * other, const HeroExchangeArmy * army, const Nullkiller2 * ai); + HeroActor(const CGHeroInstance * hero, HeroRole heroRole, uint64_t chainMask, const Nullkiller * ai); + HeroActor(const ChainActor * carrier, const ChainActor * other, const HeroExchangeArmy * army, const Nullkiller * ai); protected: ExchangeResult tryExchangeNoLock(const ChainActor * specialActor, const ChainActor * other) const override; diff --git a/AI/Nullkiller2/Pathfinding/GraphPaths.cpp b/AI/Nullkiller2/Pathfinding/GraphPaths.cpp index 9bc2e4a8c..2d1d186ec 100644 --- a/AI/Nullkiller2/Pathfinding/GraphPaths.cpp +++ b/AI/Nullkiller2/Pathfinding/GraphPaths.cpp @@ -13,7 +13,7 @@ #include "../../../lib/CRandomGenerator.h" #include "../../../lib/mapObjects/CQuest.h" #include "../../../lib/mapping/CMap.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/logging/VisualLogger.h" #include "Actions/QuestAction.h" #include "../pforeach.h" @@ -33,7 +33,7 @@ GraphPaths::GraphPaths() } std::shared_ptr getCompositeAction( - const Nullkiller2 * ai, + const Nullkiller * ai, std::shared_ptr linkActionFactory, std::shared_ptr transitionAction) { @@ -53,7 +53,7 @@ std::shared_ptr getCompositeAction( return std::make_shared(actionsArray); } -void GraphPaths::calculatePaths(const CGHeroInstance * targetHero, const Nullkiller2 * ai, uint8_t scanDepth) +void GraphPaths::calculatePaths(const CGHeroInstance * targetHero, const Nullkiller * ai, uint8_t scanDepth) { graph.copyFrom(*ai->baseGraph); graph.connectHeroes(ai); @@ -188,7 +188,7 @@ bool GraphPathNode::tryUpdate( return false; } -void GraphPaths::addChainInfo(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller2 * ai) const +void GraphPaths::addChainInfo(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const { auto nodes = pathNodes.find(tile); @@ -299,7 +299,7 @@ void GraphPaths::addChainInfo(std::vector & paths, int3 tile, const CGHe } } -void GraphPaths::quickAddChainInfoWithBlocker(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller2 * ai) const +void GraphPaths::quickAddChainInfoWithBlocker(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const { auto nodes = pathNodes.find(tile); diff --git a/AI/Nullkiller2/Pathfinding/GraphPaths.h b/AI/Nullkiller2/Pathfinding/GraphPaths.h index 824d01970..28dca8b1d 100644 --- a/AI/Nullkiller2/Pathfinding/GraphPaths.h +++ b/AI/Nullkiller2/Pathfinding/GraphPaths.h @@ -15,7 +15,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; struct GraphPathNode; @@ -92,9 +92,9 @@ class GraphPaths public: GraphPaths(); - void calculatePaths(const CGHeroInstance * targetHero, const Nullkiller2 * ai, uint8_t scanDepth); - void addChainInfo(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller2 * ai) const; - void quickAddChainInfoWithBlocker(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller2 * ai) const; + void calculatePaths(const CGHeroInstance * targetHero, const Nullkiller * ai, uint8_t scanDepth); + void addChainInfo(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const; + void quickAddChainInfoWithBlocker(std::vector & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const; void dumpToLog() const; private: diff --git a/AI/Nullkiller2/Pathfinding/ObjectGraph.cpp b/AI/Nullkiller2/Pathfinding/ObjectGraph.cpp index a0f978a93..e4e6e0483 100644 --- a/AI/Nullkiller2/Pathfinding/ObjectGraph.cpp +++ b/AI/Nullkiller2/Pathfinding/ObjectGraph.cpp @@ -13,7 +13,7 @@ #include "AIPathfinderConfig.h" #include "../../../lib/CRandomGenerator.h" #include "../../../lib/mapping/CMap.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/logging/VisualLogger.h" #include "Actions/QuestAction.h" #include "../pforeach.h" @@ -44,7 +44,7 @@ void ObjectGraph::removeConnection(const int3 & from, const int3 & to) nodes[from].connections.erase(to); } -void ObjectGraph::updateGraph(const Nullkiller2 * ai) +void ObjectGraph::updateGraph(const Nullkiller * ai) { auto cb = ai->cb; @@ -95,7 +95,7 @@ void ObjectGraph::removeObject(const CGObjectInstance * obj) } } -void ObjectGraph::connectHeroes(const Nullkiller2 * ai) +void ObjectGraph::connectHeroes(const Nullkiller * ai) { for(auto obj : ai->memory->visitableObjs) { diff --git a/AI/Nullkiller2/Pathfinding/ObjectGraph.h b/AI/Nullkiller2/Pathfinding/ObjectGraph.h index 1670b7d1e..d60844025 100644 --- a/AI/Nullkiller2/Pathfinding/ObjectGraph.h +++ b/AI/Nullkiller2/Pathfinding/ObjectGraph.h @@ -16,7 +16,7 @@ namespace NKAI { -class Nullkiller2; +class Nullkiller; struct ObjectLink { @@ -71,11 +71,11 @@ public: { } - void updateGraph(const Nullkiller2 * ai); + void updateGraph(const Nullkiller * ai); void addObject(const CGObjectInstance * obj); void registerJunction(const int3 & pos); void addVirtualBoat(const int3 & pos, const CGObjectInstance * shipyard); - void connectHeroes(const Nullkiller2 * ai); + void connectHeroes(const Nullkiller * ai); void removeObject(const CGObjectInstance * obj); bool tryAddConnection(const int3 & from, const int3 & to, float cost, uint64_t danger); void removeConnection(const int3 & from, const int3 & to); diff --git a/AI/Nullkiller2/Pathfinding/ObjectGraphCalculator.cpp b/AI/Nullkiller2/Pathfinding/ObjectGraphCalculator.cpp index 7f7bcd251..589c05d41 100644 --- a/AI/Nullkiller2/Pathfinding/ObjectGraphCalculator.cpp +++ b/AI/Nullkiller2/Pathfinding/ObjectGraphCalculator.cpp @@ -12,7 +12,7 @@ #include "AIPathfinderConfig.h" #include "../../../lib/callback/GameRandomizer.h" #include "../../../lib/mapping/CMap.h" -#include "../Engine/Nullkiller2.h" +#include "../Engine/Nullkiller.h" #include "../../../lib/logging/VisualLogger.h" #include "Actions/QuestAction.h" #include "../pforeach.h" @@ -20,7 +20,7 @@ namespace NKAI { -ObjectGraphCalculator::ObjectGraphCalculator(ObjectGraph * target, const Nullkiller2 * ai) +ObjectGraphCalculator::ObjectGraphCalculator(ObjectGraph * target, const Nullkiller * ai) :ai(ai), target(target), syncLock() { } diff --git a/AI/Nullkiller2/Pathfinding/ObjectGraphCalculator.h b/AI/Nullkiller2/Pathfinding/ObjectGraphCalculator.h index fea3b9d93..812bd6985 100644 --- a/AI/Nullkiller2/Pathfinding/ObjectGraphCalculator.h +++ b/AI/Nullkiller2/Pathfinding/ObjectGraphCalculator.h @@ -27,7 +27,7 @@ class ObjectGraphCalculator { private: ObjectGraph * target; - const Nullkiller2 * ai; + const Nullkiller * ai; std::mutex syncLock; std::map actors; @@ -37,7 +37,7 @@ private: std::vector> temporaryActorHeroes; public: - ObjectGraphCalculator(ObjectGraph * target, const Nullkiller2 * ai); + ObjectGraphCalculator(ObjectGraph * target, const Nullkiller * ai); void setGraphObjects(); void calculateConnections(); float getNeighborConnectionsCost(const int3 & pos, std::vector & pathCache); diff --git a/AI/Nullkiller2/Pathfinding/Rules/AILayerTransitionRule.cpp b/AI/Nullkiller2/Pathfinding/Rules/AILayerTransitionRule.cpp index 1b7aeb924..e4f37bb0d 100644 --- a/AI/Nullkiller2/Pathfinding/Rules/AILayerTransitionRule.cpp +++ b/AI/Nullkiller2/Pathfinding/Rules/AILayerTransitionRule.cpp @@ -9,7 +9,7 @@ */ #include "StdInc.h" #include "AILayerTransitionRule.h" -#include "../../Engine/Nullkiller2.h" +#include "../../Engine/Nullkiller.h" #include "../../../../lib/pathfinder/CPathfinder.h" #include "../../../../lib/pathfinder/TurnInfo.h" #include "../../../../lib/spells/ISpellMechanics.h" @@ -21,7 +21,7 @@ namespace AIPathfinding { AILayerTransitionRule::AILayerTransitionRule( CPlayerSpecificInfoCallback * cb, - Nullkiller2 * ai, + Nullkiller * ai, std::shared_ptr nodeStorage) :cb(cb), ai(ai), nodeStorage(nodeStorage) { diff --git a/AI/Nullkiller2/Pathfinding/Rules/AILayerTransitionRule.h b/AI/Nullkiller2/Pathfinding/Rules/AILayerTransitionRule.h index c8ce607ae..1de94d4d6 100644 --- a/AI/Nullkiller2/Pathfinding/Rules/AILayerTransitionRule.h +++ b/AI/Nullkiller2/Pathfinding/Rules/AILayerTransitionRule.h @@ -25,7 +25,7 @@ namespace AIPathfinding { private: CPlayerSpecificInfoCallback * cb; - Nullkiller2 * ai; + Nullkiller * ai; std::map> virtualBoats; std::shared_ptr nodeStorage; std::map> summonableVirtualBoats; @@ -35,7 +35,7 @@ namespace AIPathfinding public: AILayerTransitionRule( CPlayerSpecificInfoCallback * cb, - Nullkiller2 * ai, + Nullkiller * ai, std::shared_ptr nodeStorage); virtual void process( diff --git a/AI/Nullkiller2/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp b/AI/Nullkiller2/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp index 1e6e14f6c..ef0e53c89 100644 --- a/AI/Nullkiller2/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp +++ b/AI/Nullkiller2/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp @@ -23,7 +23,7 @@ namespace NKAI namespace AIPathfinding { AIMovementAfterDestinationRule::AIMovementAfterDestinationRule( - const Nullkiller2 * ai, + const Nullkiller * ai, CPlayerSpecificInfoCallback * cb, std::shared_ptr nodeStorage, bool allowBypassObjects) diff --git a/AI/Nullkiller2/Pathfinding/Rules/AIMovementAfterDestinationRule.h b/AI/Nullkiller2/Pathfinding/Rules/AIMovementAfterDestinationRule.h index 3d3d21844..e24170a29 100644 --- a/AI/Nullkiller2/Pathfinding/Rules/AIMovementAfterDestinationRule.h +++ b/AI/Nullkiller2/Pathfinding/Rules/AIMovementAfterDestinationRule.h @@ -23,13 +23,13 @@ namespace AIPathfinding { private: CPlayerSpecificInfoCallback * cb; - const Nullkiller2 * ai; + const Nullkiller * ai; std::shared_ptr nodeStorage; bool allowBypassObjects; public: AIMovementAfterDestinationRule( - const Nullkiller2 * ai, + const Nullkiller * ai, CPlayerSpecificInfoCallback * cb, std::shared_ptr nodeStorage, bool allowBypassObjects); diff --git a/AI/Nullkiller2/pforeach.h b/AI/Nullkiller2/pforeach.h index 1628e3fef..d8e911936 100644 --- a/AI/Nullkiller2/pforeach.h +++ b/AI/Nullkiller2/pforeach.h @@ -1,6 +1,6 @@ #pragma once -#include "Engine/Nullkiller2.h" +#include "Engine/Nullkiller.h" namespace NKAI { @@ -26,7 +26,7 @@ void pforeachTilePos(const int3 & mapSize, TFunc fn) } template -void pforeachTilePaths(const int3 & mapSize, const Nullkiller2 * ai, TFunc fn) +void pforeachTilePaths(const int3 & mapSize, const Nullkiller * ai, TFunc fn) { for(int z = 0; z < mapSize.z; ++z) {