mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Merge remote-tracking branch 'upstream/develop' into rewardable-expand
# Conflicts: # lib/JsonRandom.cpp
This commit is contained in:
@@ -56,10 +56,7 @@ struct EvaluationResult
|
||||
class BattleExchangeVariant
|
||||
{
|
||||
public:
|
||||
BattleExchangeVariant()
|
||||
:dpsScore(0), attackerValue()
|
||||
{
|
||||
}
|
||||
BattleExchangeVariant(): dpsScore(0) {}
|
||||
|
||||
int64_t trackAttack(const AttackPossibility & ap, HypotheticBattle & state);
|
||||
|
||||
@@ -92,10 +89,7 @@ private:
|
||||
std::vector<battle::Units> turnOrder;
|
||||
|
||||
public:
|
||||
BattleExchangeEvaluator(std::shared_ptr<CBattleInfoCallback> cb, std::shared_ptr<Environment> env)
|
||||
:cb(cb), reachabilityMap(), env(env), turnOrder()
|
||||
{
|
||||
}
|
||||
BattleExchangeEvaluator(std::shared_ptr<CBattleInfoCallback> cb, std::shared_ptr<Environment> env): cb(cb), env(env) {}
|
||||
|
||||
EvaluationResult findBestTarget(const battle::Unit * activeStack, PotentialTargets & targets, HypotheticBattle & hb);
|
||||
int64_t calculateExchange(const AttackPossibility & ap, PotentialTargets & targets, HypotheticBattle & hb);
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
using namespace tbb;
|
||||
|
||||
typedef std::pair<ui32, std::vector<CreatureID>> dwellingContent;
|
||||
using dwellingContent = std::pair<ui32, std::vector<CreatureID>>;
|
||||
|
||||
namespace NKAI
|
||||
{
|
||||
@@ -305,10 +305,10 @@ public:
|
||||
public:
|
||||
using ptr_type = std::unique_ptr<T, External_Deleter>;
|
||||
|
||||
SharedPool(std::function<std::unique_ptr<T>()> elementFactory)
|
||||
: elementFactory(elementFactory), pool(), sync(), instance_tracker(new SharedPool<T>*(this))
|
||||
SharedPool(std::function<std::unique_ptr<T>()> elementFactory):
|
||||
elementFactory(elementFactory), pool(), instance_tracker(new SharedPool<T> *(this))
|
||||
{}
|
||||
|
||||
|
||||
void add(std::unique_ptr<T> t)
|
||||
{
|
||||
boost::lock_guard<boost::mutex> lock(sync);
|
||||
|
||||
@@ -32,13 +32,8 @@ struct SlotInfo
|
||||
struct ArmyUpgradeInfo
|
||||
{
|
||||
std::vector<SlotInfo> resultingArmy;
|
||||
uint64_t upgradeValue;
|
||||
uint64_t upgradeValue = 0;
|
||||
TResources upgradeCost;
|
||||
|
||||
ArmyUpgradeInfo()
|
||||
: resultingArmy(), upgradeValue(0), upgradeCost()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_EXPORT IArmyManager //: public: IAbstractManager
|
||||
|
||||
@@ -62,8 +62,11 @@ public:
|
||||
HeroRole townRole;
|
||||
bool hasSomethingToBuild;
|
||||
|
||||
TownDevelopmentInfo(const CGTownInstance* town)
|
||||
:town(town), armyStrength(0), toBuild(), townDevelopmentCost(), requiredResources(), townRole(HeroRole::SCOUT), hasSomethingToBuild(false)
|
||||
TownDevelopmentInfo(const CGTownInstance * town):
|
||||
town(town),
|
||||
armyStrength(0),
|
||||
townRole(HeroRole::SCOUT),
|
||||
hasSomethingToBuild(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ struct ClusterObjectInfo
|
||||
uint8_t turn;
|
||||
};
|
||||
|
||||
typedef tbb::concurrent_hash_map<const CGObjectInstance *, ClusterObjectInfo> ClusterObjects;
|
||||
using ClusterObjects = tbb::concurrent_hash_map<const CGObjectInstance *, ClusterObjectInfo>;
|
||||
|
||||
struct ObjectCluster
|
||||
{
|
||||
@@ -36,11 +36,8 @@ public:
|
||||
}
|
||||
|
||||
void addObject(const CGObjectInstance * object, const AIPath & path, float priority);
|
||||
|
||||
ObjectCluster(const CGObjectInstance * blocker)
|
||||
:objects(), blocker(blocker)
|
||||
{
|
||||
}
|
||||
|
||||
ObjectCluster(const CGObjectInstance * blocker): blocker(blocker) {}
|
||||
|
||||
ObjectCluster() : ObjectCluster(nullptr)
|
||||
{
|
||||
@@ -50,7 +47,7 @@ public:
|
||||
const CGObjectInstance * calculateCenter() const;
|
||||
};
|
||||
|
||||
typedef tbb::concurrent_hash_map<const CGObjectInstance *, std::shared_ptr<ObjectCluster>> ClusterMap;
|
||||
using ClusterMap = tbb::concurrent_hash_map<const CGObjectInstance *, std::shared_ptr<ObjectCluster>>;
|
||||
|
||||
class ObjectClusterizer
|
||||
{
|
||||
@@ -67,10 +64,7 @@ public:
|
||||
std::vector<std::shared_ptr<ObjectCluster>> getLockedClusters() const;
|
||||
const CGObjectInstance * getBlocker(const AIPath & path) const;
|
||||
|
||||
ObjectClusterizer(const Nullkiller * ai)
|
||||
:nearObjects(), farObjects(), blockedObjects(), ai(ai)
|
||||
{
|
||||
}
|
||||
ObjectClusterizer(const Nullkiller * ai): ai(ai) {}
|
||||
|
||||
private:
|
||||
bool shouldVisitObject(const CGObjectInstance * obj) const;
|
||||
|
||||
@@ -22,7 +22,7 @@ struct GoalHash
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::unordered_map<Goals::TSubgoal, Goals::TGoalVec, GoalHash> TGoalHashSet;
|
||||
using TGoalHashSet = std::unordered_map<Goals::TSubgoal, Goals::TGoalVec, GoalHash>;
|
||||
|
||||
class DeepDecomposer
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ private:
|
||||
TacticalAdvantageEngine tacticalAdvantageEngine;
|
||||
|
||||
public:
|
||||
FuzzyHelper(const Nullkiller * ai) : ai(ai), tacticalAdvantageEngine() {}
|
||||
FuzzyHelper(const Nullkiller * ai): ai(ai) {}
|
||||
|
||||
ui64 estimateBankDanger(const CBank * bank); //TODO: move to another class?
|
||||
|
||||
|
||||
@@ -81,9 +81,9 @@ namespace Goals
|
||||
bool operator<(const TSubgoal & rhs) const;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<ITask> TTask;
|
||||
typedef std::vector<TTask> TTaskVec;
|
||||
typedef std::vector<TSubgoal> TGoalVec;
|
||||
using TTask = std::shared_ptr<ITask>;
|
||||
using TTaskVec = std::vector<TTask>;
|
||||
using TGoalVec = std::vector<TSubgoal>;
|
||||
|
||||
//method chaining + clone pattern
|
||||
#define SETTER(type, field) AbstractGoal & set ## field(const type &rhs) {field = rhs; return *this;};
|
||||
@@ -107,8 +107,7 @@ namespace Goals
|
||||
const CGTownInstance *town; SETTER(CGTownInstance *, town)
|
||||
int bid; SETTER(int, bid)
|
||||
|
||||
AbstractGoal(EGoals goal = EGoals::INVALID)
|
||||
: goalType(goal), hero()
|
||||
AbstractGoal(EGoals goal = EGoals::INVALID): goalType(goal)
|
||||
{
|
||||
isAbstract = false;
|
||||
value = 0;
|
||||
|
||||
@@ -205,14 +205,14 @@ public:
|
||||
|
||||
inline void updateAINode(CGPathNode * node, std::function<void (AIPathNode *)> updater)
|
||||
{
|
||||
auto aiNode = static_cast<AIPathNode *>(node);
|
||||
auto * aiNode = static_cast<AIPathNode *>(node);
|
||||
|
||||
updater(aiNode);
|
||||
}
|
||||
|
||||
inline const CGHeroInstance * getHero(const CGPathNode * node) const
|
||||
{
|
||||
auto aiNode = getAINode(node);
|
||||
const auto * aiNode = getAINode(node);
|
||||
|
||||
return aiNode->actor->hero;
|
||||
}
|
||||
|
||||
@@ -32,9 +32,7 @@ public:
|
||||
virtual bool needsLastStack() const override;
|
||||
std::shared_ptr<SpecialAction> getActorAction() const;
|
||||
|
||||
HeroExchangeArmy() : CArmedInstance(true), armyCost(), requireBuyArmy(false)
|
||||
{
|
||||
}
|
||||
HeroExchangeArmy(): CArmedInstance(true), requireBuyArmy(false) {}
|
||||
};
|
||||
|
||||
struct ExchangeResult
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
class CCallback;
|
||||
struct creInfo;
|
||||
|
||||
typedef const int3 & crint3;
|
||||
typedef const std::string & crstring;
|
||||
typedef std::pair<ui32, std::vector<CreatureID>> dwellingContent;
|
||||
using crint3 = const int3 &;
|
||||
using crstring = const std::string &;
|
||||
using dwellingContent = std::pair<ui32, std::vector<CreatureID>>;
|
||||
|
||||
const int GOLD_MINE_PRODUCTION = 1000, WOOD_ORE_MINE_PRODUCTION = 2, RESOURCE_MINE_PRODUCTION = 1;
|
||||
const int ACTUAL_RESOURCE_COUNT = 7;
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Goals
|
||||
//TODO: serialize?
|
||||
};
|
||||
|
||||
typedef std::vector<TSubgoal> TGoalVec;
|
||||
using TGoalVec = std::vector<TSubgoal>;
|
||||
|
||||
//method chaining + clone pattern
|
||||
#define VSETTER(type, field) virtual AbstractGoal & set ## field(const type &rhs) {field = rhs; return *this;};
|
||||
@@ -121,8 +121,7 @@ namespace Goals
|
||||
TSubgoal parent; VSETTER(TSubgoal, parent)
|
||||
EvaluationContext evaluationContext; VSETTER(EvaluationContext, evaluationContext)
|
||||
|
||||
AbstractGoal(EGoals goal = EGoals::INVALID)
|
||||
: goalType(goal), evaluationContext()
|
||||
AbstractGoal(EGoals goal = EGoals::INVALID): goalType(goal)
|
||||
{
|
||||
priority = 0;
|
||||
isElementar = false;
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
class CCallback;
|
||||
|
||||
extern boost::thread_specific_ptr<CCallback> cb; //for templates
|
||||
|
||||
struct AIPathNode : public CGPathNode
|
||||
{
|
||||
uint32_t chainMask;
|
||||
|
||||
Reference in New Issue
Block a user