mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
revert file name without 2 to make it easier to compare new vs old
This commit is contained in:
@@ -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> nullkiller2;
|
||||
std::unique_ptr<Nullkiller> nullkiller2;
|
||||
|
||||
AIGateway();
|
||||
~AIGateway();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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<std::chrono::high_resolution_clock> 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 <class T>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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<CreatureID, SlotInfo> 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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -75,11 +75,11 @@ private:
|
||||
tbb::concurrent_vector<EnemyHeroAccessibleObject> enemyHeroAccessibleObjects;
|
||||
bool hitMapUpToDate = false;
|
||||
bool tileOwnersUpToDate = false;
|
||||
const Nullkiller2 * ai;
|
||||
const Nullkiller * ai;
|
||||
std::map<ObjectInstanceID, std::vector<HitMapInfo>> townThreats;
|
||||
|
||||
public:
|
||||
DangerHitMapAnalyzer(const Nullkiller2 * ai) :ai(ai) {}
|
||||
DangerHitMapAnalyzer(const Nullkiller * ai) :ai(ai) {}
|
||||
|
||||
void updateHitMap();
|
||||
void calculateTileOwners();
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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<HeroPtr, HeroRole> heroRoles;
|
||||
std::map<ObjectInstanceID, float> 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<HeroPtr, HeroRole> & getHeroRoles() const;
|
||||
HeroRole getHeroRole(const HeroPtr & hero) const;
|
||||
int selectBestSkill(const HeroPtr & hero, const std::vector<SecondarySkill> & skills) const;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "ObjectClusterizer.h"
|
||||
#include "../Goals/ExecuteHeroChain.h"
|
||||
#include "../AIGateway.h"
|
||||
#include "../Engine/Nullkiller2.h"
|
||||
#include "../Engine/Nullkiller.h"
|
||||
|
||||
namespace NKAI
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ private:
|
||||
ObjectCluster nearObjects;
|
||||
ObjectCluster farObjects;
|
||||
ClusterMap blockedObjects;
|
||||
const Nullkiller2 * ai;
|
||||
const Nullkiller * ai;
|
||||
RewardEvaluator valueEvaluator;
|
||||
bool isUpToDate;
|
||||
std::vector<ObjectInstanceID> invalidated;
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
const CGObjectInstance * getBlocker(const AIPath & path) const;
|
||||
std::optional<const CGObjectInstance *> 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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Goals
|
||||
class BuyArmyBehavior : public CGoal<BuyArmyBehavior>
|
||||
{
|
||||
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
|
||||
{
|
||||
|
||||
@@ -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<AIPath> & 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<const CGObjectInstance *> & 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;
|
||||
|
||||
|
||||
@@ -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<AIPath> & 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<const CGObjectInstance *> & objs,
|
||||
const Nullkiller2 * nullkiller) const;
|
||||
const Nullkiller * nullkiller) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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<ObjectCluster> cluster) const
|
||||
Goals::TGoalVec ClusterBehavior::decomposeCluster(const Nullkiller * ai, std::shared_ptr<ObjectCluster> cluster) const
|
||||
{
|
||||
auto center = cluster->calculateCenter(ai->cb.get());
|
||||
auto paths = ai->pathfinder->getPathInfo(center->visitablePos(), ai->isObjectGraphAllowed());
|
||||
|
||||
@@ -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<ObjectCluster> cluster) const;
|
||||
Goals::TGoalVec decomposeCluster(const Nullkiller * ai, std::shared_ptr<ObjectCluster> cluster) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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<AIPath> & paths)
|
||||
bool isThreatUnderControl(const CGTownInstance * town, const HitMapInfo & threat, const Nullkiller * ai, const std::vector<AIPath> & 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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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::vector<AIPa
|
||||
return shortestPath;
|
||||
}
|
||||
|
||||
const CGHeroInstance * getNearestHero(const Nullkiller2 * ai, const CGTownInstance * town)
|
||||
const CGHeroInstance * getNearestHero(const Nullkiller * ai, const CGTownInstance * town)
|
||||
{
|
||||
auto paths = ai->pathfinder->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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace NKAI
|
||||
|
||||
using namespace Goals;
|
||||
|
||||
DeepDecomposer::DeepDecomposer(const Nullkiller2 * ai)
|
||||
DeepDecomposer::DeepDecomposer(const Nullkiller * ai)
|
||||
:ai(ai), depth(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ private:
|
||||
std::vector<Goals::TGoalVec> goals;
|
||||
std::vector<TGoalHashSet> 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);
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<ObjectGraph> Nullkiller2::baseGraph;
|
||||
std::unique_ptr<ObjectGraph> 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<CCallback> cb, PlayerColor playerID)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ bool canUseOpenMap(std::shared_ptr<CCallback> cb, PlayerColor playerID)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Nullkiller2::init(std::shared_ptr<CCallback> cb, AIGateway * gateway)
|
||||
void Nullkiller::init(std::shared_ptr<CCallback> 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<std::mutex> 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<const CPathsInfo> Nullkiller2::getPathsInfo(const CGHeroInstance * h) const
|
||||
std::shared_ptr<const CPathsInfo> Nullkiller::getPathsInfo(const CGHeroInstance * h) const
|
||||
{
|
||||
return pathfinderCache->getPathsInfo(h);
|
||||
}
|
||||
|
||||
void Nullkiller2::invalidatePaths()
|
||||
void Nullkiller::invalidatePaths()
|
||||
{
|
||||
pathfinderCache->invalidatePaths();
|
||||
}
|
||||
@@ -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<CCallback> cb, AIGateway * gateway);
|
||||
void makeTurn();
|
||||
bool isActive(const CGHeroInstance * hero) const { return activeHero == hero; }
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "StdInc.h"
|
||||
#include <limits>
|
||||
|
||||
#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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<AbstractGoal *>(this);
|
||||
}
|
||||
|
||||
virtual TGoalVec decompose(const Nullkiller2 * ai) const
|
||||
virtual TGoalVec decompose(const Nullkiller * ai) const
|
||||
{
|
||||
return TGoalVec();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "ExchangeSwapTownHeroes.h"
|
||||
#include "ExecuteHeroChain.h"
|
||||
#include "../AIGateway.h"
|
||||
#include "../Engine/Nullkiller2.h"
|
||||
#include "../Engine/Nullkiller.h"
|
||||
|
||||
namespace NKAI
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CGoal.h"
|
||||
#include "../Engine/Nullkiller2.h"
|
||||
#include "../Engine/Nullkiller.h"
|
||||
|
||||
namespace NKAI
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "StdInc.h"
|
||||
#include "ExecuteHeroChain.h"
|
||||
#include "../AIGateway.h"
|
||||
#include "../Engine/Nullkiller2.h"
|
||||
#include "../Engine/Nullkiller.h"
|
||||
|
||||
namespace NKAI
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Goals
|
||||
{
|
||||
priority = -1;
|
||||
}
|
||||
TGoalVec decompose(const Nullkiller2 * ai) const override
|
||||
TGoalVec decompose(const Nullkiller * ai) const override
|
||||
{
|
||||
return TGoalVec();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<CCallback> cb; //this is enough, but we downcast from CCallback
|
||||
|
||||
public:
|
||||
ArmyFormation(std::shared_ptr<CCallback> CB, const Nullkiller2 * ai): cb(CB) {}
|
||||
ArmyFormation(std::shared_ptr<CCallback> CB, const Nullkiller * ai): cb(CB) {}
|
||||
|
||||
void rearrangeArmyForSiege(const CGTownInstance * town, const CGHeroInstance * attacker);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<boost::multi_array<EPathAccessibility, 4>>(
|
||||
|
||||
@@ -166,7 +166,7 @@ private:
|
||||
std::unique_ptr<boost::multi_array<EPathAccessibility, 4>> accessibility;
|
||||
|
||||
const CPlayerSpecificInfoCallback * cb;
|
||||
const Nullkiller2 * ai;
|
||||
const Nullkiller * ai;
|
||||
AISharedStorage nodes;
|
||||
std::vector<std::shared_ptr<ChainActor>> actors;
|
||||
std::vector<CGPathNode *> 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;
|
||||
|
||||
@@ -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<ObjectInstanceID, std::unique_ptr<GraphPaths>> AIPathfinder::heroGraphs;
|
||||
|
||||
AIPathfinder::AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller2 * ai)
|
||||
AIPathfinder::AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller * ai)
|
||||
:cb(cb), ai(ai)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
namespace NKAI
|
||||
{
|
||||
|
||||
class Nullkiller2;
|
||||
class Nullkiller;
|
||||
|
||||
struct PathfinderSettings
|
||||
{
|
||||
@@ -40,11 +40,11 @@ class AIPathfinder
|
||||
private:
|
||||
std::shared_ptr<AINodeStorage> storage;
|
||||
CPlayerSpecificInfoCallback * cb;
|
||||
Nullkiller2 * ai;
|
||||
Nullkiller * ai;
|
||||
static std::map<ObjectInstanceID, std::unique_ptr<GraphPaths>> heroGraphs;
|
||||
|
||||
public:
|
||||
AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller2 * ai);
|
||||
AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller * ai);
|
||||
void calculatePathInfo(std::vector<AIPath> & paths, const int3 & tile, bool includeGraph = false) const;
|
||||
bool isTileAccessible(const HeroPtr & hero, const int3 & tile) const;
|
||||
void updatePaths(const std::map<const CGHeroInstance *, HeroRole> & heroes, PathfinderSettings pathfinderSettings);
|
||||
|
||||
@@ -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<std::shared_ptr<IPathfindingRule>> makeRuleset(
|
||||
CPlayerSpecificInfoCallback * cb,
|
||||
Nullkiller2 * ai,
|
||||
Nullkiller * ai,
|
||||
std::shared_ptr<AINodeStorage> nodeStorage,
|
||||
bool allowBypassObjects)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace AIPathfinding
|
||||
|
||||
AIPathfinderConfig::AIPathfinderConfig(
|
||||
CPlayerSpecificInfoCallback * cb,
|
||||
Nullkiller2 * ai,
|
||||
Nullkiller * ai,
|
||||
std::shared_ptr<AINodeStorage> nodeStorage,
|
||||
bool allowBypassObjects)
|
||||
:PathfinderConfig(nodeStorage, *cb, makeRuleset(cb, ai, nodeStorage, allowBypassObjects)), aiNodeStorage(nodeStorage)
|
||||
|
||||
@@ -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<AINodeStorage> nodeStorage,
|
||||
bool allowBypassObjects);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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<SpecialAction> BuildBoatActionFactory::create(const Nullkiller2 * ai)
|
||||
std::shared_ptr<SpecialAction> BuildBoatActionFactory::create(const Nullkiller * ai)
|
||||
{
|
||||
return std::make_shared<BuildBoatAction>(ai->cb.get(), dynamic_cast<const IShipyard * >(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;
|
||||
|
||||
|
||||
@@ -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<SpecialAction> create(const Nullkiller2 * ai) override;
|
||||
std::shared_ptr<SpecialAction> create(const Nullkiller * ai) override;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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<std::shared_ptr<const SpecialAction>> 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<std::shared_ptr<const SpecialAction>> getParts() const override
|
||||
{
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
class ISpecialActionFactory
|
||||
{
|
||||
public:
|
||||
virtual std::shared_ptr<SpecialAction> create(const Nullkiller2 * ai) = 0;
|
||||
virtual std::shared_ptr<SpecialAction> create(const Nullkiller * ai) = 0;
|
||||
virtual ~ISpecialActionFactory() = default;
|
||||
};
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -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<const ChainActor *, HeroActor *> 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<SpecialAction> 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;
|
||||
|
||||
@@ -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<SpecialAction> getCompositeAction(
|
||||
const Nullkiller2 * ai,
|
||||
const Nullkiller * ai,
|
||||
std::shared_ptr<ISpecialActionFactory> linkActionFactory,
|
||||
std::shared_ptr<SpecialAction> transitionAction)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ std::shared_ptr<SpecialAction> getCompositeAction(
|
||||
return std::make_shared<CompositeAction>(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<AIPath> & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller2 * ai) const
|
||||
void GraphPaths::addChainInfo(std::vector<AIPath> & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const
|
||||
{
|
||||
auto nodes = pathNodes.find(tile);
|
||||
|
||||
@@ -299,7 +299,7 @@ void GraphPaths::addChainInfo(std::vector<AIPath> & paths, int3 tile, const CGHe
|
||||
}
|
||||
}
|
||||
|
||||
void GraphPaths::quickAddChainInfoWithBlocker(std::vector<AIPath> & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller2 * ai) const
|
||||
void GraphPaths::quickAddChainInfoWithBlocker(std::vector<AIPath> & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const
|
||||
{
|
||||
auto nodes = pathNodes.find(tile);
|
||||
|
||||
|
||||
@@ -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<AIPath> & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller2 * ai) const;
|
||||
void quickAddChainInfoWithBlocker(std::vector<AIPath> & 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<AIPath> & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const;
|
||||
void quickAddChainInfoWithBlocker(std::vector<AIPath> & paths, int3 tile, const CGHeroInstance * hero, const Nullkiller * ai) const;
|
||||
void dumpToLog() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class ObjectGraphCalculator
|
||||
{
|
||||
private:
|
||||
ObjectGraph * target;
|
||||
const Nullkiller2 * ai;
|
||||
const Nullkiller * ai;
|
||||
std::mutex syncLock;
|
||||
|
||||
std::map<const CGHeroInstance *, HeroRole> actors;
|
||||
@@ -37,7 +37,7 @@ private:
|
||||
std::vector<std::unique_ptr<CGHeroInstance>> 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<AIPath> & pathCache);
|
||||
|
||||
@@ -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<AINodeStorage> nodeStorage)
|
||||
:cb(cb), ai(ai), nodeStorage(nodeStorage)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace AIPathfinding
|
||||
{
|
||||
private:
|
||||
CPlayerSpecificInfoCallback * cb;
|
||||
Nullkiller2 * ai;
|
||||
Nullkiller * ai;
|
||||
std::map<int3, std::shared_ptr<const BuildBoatAction>> virtualBoats;
|
||||
std::shared_ptr<AINodeStorage> nodeStorage;
|
||||
std::map<const CGHeroInstance *, std::shared_ptr<const SummonBoatAction>> summonableVirtualBoats;
|
||||
@@ -35,7 +35,7 @@ namespace AIPathfinding
|
||||
public:
|
||||
AILayerTransitionRule(
|
||||
CPlayerSpecificInfoCallback * cb,
|
||||
Nullkiller2 * ai,
|
||||
Nullkiller * ai,
|
||||
std::shared_ptr<AINodeStorage> nodeStorage);
|
||||
|
||||
virtual void process(
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace NKAI
|
||||
namespace AIPathfinding
|
||||
{
|
||||
AIMovementAfterDestinationRule::AIMovementAfterDestinationRule(
|
||||
const Nullkiller2 * ai,
|
||||
const Nullkiller * ai,
|
||||
CPlayerSpecificInfoCallback * cb,
|
||||
std::shared_ptr<AINodeStorage> nodeStorage,
|
||||
bool allowBypassObjects)
|
||||
|
||||
@@ -23,13 +23,13 @@ namespace AIPathfinding
|
||||
{
|
||||
private:
|
||||
CPlayerSpecificInfoCallback * cb;
|
||||
const Nullkiller2 * ai;
|
||||
const Nullkiller * ai;
|
||||
std::shared_ptr<AINodeStorage> nodeStorage;
|
||||
bool allowBypassObjects;
|
||||
|
||||
public:
|
||||
AIMovementAfterDestinationRule(
|
||||
const Nullkiller2 * ai,
|
||||
const Nullkiller * ai,
|
||||
CPlayerSpecificInfoCallback * cb,
|
||||
std::shared_ptr<AINodeStorage> nodeStorage,
|
||||
bool allowBypassObjects);
|
||||
|
||||
@@ -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<typename TFunc>
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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> nullkiller2;
|
||||
std::unique_ptr<Nullkiller> nullkiller2;
|
||||
|
||||
AIGateway();
|
||||
~AIGateway();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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<std::chrono::high_resolution_clock> 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 <class T>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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<CreatureID, SlotInfo> 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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user