mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-13 01:20:34 +02:00
vcmi: modernize headers
This commit is contained in:
@ -56,10 +56,7 @@ struct EvaluationResult
|
|||||||
class BattleExchangeVariant
|
class BattleExchangeVariant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BattleExchangeVariant()
|
BattleExchangeVariant(): dpsScore(0) {}
|
||||||
:dpsScore(0), attackerValue()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t trackAttack(const AttackPossibility & ap, HypotheticBattle & state);
|
int64_t trackAttack(const AttackPossibility & ap, HypotheticBattle & state);
|
||||||
|
|
||||||
@ -92,10 +89,7 @@ private:
|
|||||||
std::vector<battle::Units> turnOrder;
|
std::vector<battle::Units> turnOrder;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleExchangeEvaluator(std::shared_ptr<CBattleInfoCallback> cb, std::shared_ptr<Environment> env)
|
BattleExchangeEvaluator(std::shared_ptr<CBattleInfoCallback> cb, std::shared_ptr<Environment> env): cb(cb), env(env) {}
|
||||||
:cb(cb), reachabilityMap(), env(env), turnOrder()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
EvaluationResult findBestTarget(const battle::Unit * activeStack, PotentialTargets & targets, HypotheticBattle & hb);
|
EvaluationResult findBestTarget(const battle::Unit * activeStack, PotentialTargets & targets, HypotheticBattle & hb);
|
||||||
int64_t calculateExchange(const AttackPossibility & ap, PotentialTargets & targets, HypotheticBattle & hb);
|
int64_t calculateExchange(const AttackPossibility & ap, PotentialTargets & targets, HypotheticBattle & hb);
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
using namespace tbb;
|
using namespace tbb;
|
||||||
|
|
||||||
typedef std::pair<ui32, std::vector<CreatureID>> dwellingContent;
|
using dwellingContent = std::pair<ui32, std::vector<CreatureID>>;
|
||||||
|
|
||||||
namespace NKAI
|
namespace NKAI
|
||||||
{
|
{
|
||||||
@ -305,8 +305,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
using ptr_type = std::unique_ptr<T, External_Deleter>;
|
using ptr_type = std::unique_ptr<T, External_Deleter>;
|
||||||
|
|
||||||
SharedPool(std::function<std::unique_ptr<T>()> elementFactory)
|
SharedPool(std::function<std::unique_ptr<T>()> elementFactory):
|
||||||
: elementFactory(elementFactory), pool(), sync(), instance_tracker(new SharedPool<T>*(this))
|
elementFactory(elementFactory), pool(), instance_tracker(new SharedPool<T> *(this))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void add(std::unique_ptr<T> t)
|
void add(std::unique_ptr<T> t)
|
||||||
|
@ -32,13 +32,8 @@ struct SlotInfo
|
|||||||
struct ArmyUpgradeInfo
|
struct ArmyUpgradeInfo
|
||||||
{
|
{
|
||||||
std::vector<SlotInfo> resultingArmy;
|
std::vector<SlotInfo> resultingArmy;
|
||||||
uint64_t upgradeValue;
|
uint64_t upgradeValue = 0;
|
||||||
TResources upgradeCost;
|
TResources upgradeCost;
|
||||||
|
|
||||||
ArmyUpgradeInfo()
|
|
||||||
: resultingArmy(), upgradeValue(0), upgradeCost()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DLL_EXPORT IArmyManager //: public: IAbstractManager
|
class DLL_EXPORT IArmyManager //: public: IAbstractManager
|
||||||
|
@ -62,8 +62,11 @@ public:
|
|||||||
HeroRole townRole;
|
HeroRole townRole;
|
||||||
bool hasSomethingToBuild;
|
bool hasSomethingToBuild;
|
||||||
|
|
||||||
TownDevelopmentInfo(const CGTownInstance* town)
|
TownDevelopmentInfo(const CGTownInstance * town):
|
||||||
:town(town), armyStrength(0), toBuild(), townDevelopmentCost(), requiredResources(), townRole(HeroRole::SCOUT), hasSomethingToBuild(false)
|
town(town),
|
||||||
|
armyStrength(0),
|
||||||
|
townRole(HeroRole::SCOUT),
|
||||||
|
hasSomethingToBuild(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ struct ClusterObjectInfo
|
|||||||
uint8_t turn;
|
uint8_t turn;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef tbb::concurrent_hash_map<const CGObjectInstance *, ClusterObjectInfo> ClusterObjects;
|
using ClusterObjects = tbb::concurrent_hash_map<const CGObjectInstance *, ClusterObjectInfo>;
|
||||||
|
|
||||||
struct ObjectCluster
|
struct ObjectCluster
|
||||||
{
|
{
|
||||||
@ -37,10 +37,7 @@ public:
|
|||||||
|
|
||||||
void addObject(const CGObjectInstance * object, const AIPath & path, float priority);
|
void addObject(const CGObjectInstance * object, const AIPath & path, float priority);
|
||||||
|
|
||||||
ObjectCluster(const CGObjectInstance * blocker)
|
ObjectCluster(const CGObjectInstance * blocker): blocker(blocker) {}
|
||||||
:objects(), blocker(blocker)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectCluster() : ObjectCluster(nullptr)
|
ObjectCluster() : ObjectCluster(nullptr)
|
||||||
{
|
{
|
||||||
@ -50,7 +47,7 @@ public:
|
|||||||
const CGObjectInstance * calculateCenter() const;
|
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
|
class ObjectClusterizer
|
||||||
{
|
{
|
||||||
@ -67,10 +64,7 @@ public:
|
|||||||
std::vector<std::shared_ptr<ObjectCluster>> getLockedClusters() const;
|
std::vector<std::shared_ptr<ObjectCluster>> getLockedClusters() const;
|
||||||
const CGObjectInstance * getBlocker(const AIPath & path) const;
|
const CGObjectInstance * getBlocker(const AIPath & path) const;
|
||||||
|
|
||||||
ObjectClusterizer(const Nullkiller * ai)
|
ObjectClusterizer(const Nullkiller * ai): ai(ai) {}
|
||||||
:nearObjects(), farObjects(), blockedObjects(), ai(ai)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool shouldVisitObject(const CGObjectInstance * obj) const;
|
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
|
class DeepDecomposer
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@ private:
|
|||||||
TacticalAdvantageEngine tacticalAdvantageEngine;
|
TacticalAdvantageEngine tacticalAdvantageEngine;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FuzzyHelper(const Nullkiller * ai) : ai(ai), tacticalAdvantageEngine() {}
|
FuzzyHelper(const Nullkiller * ai): ai(ai) {}
|
||||||
|
|
||||||
ui64 estimateBankDanger(const CBank * bank); //TODO: move to another class?
|
ui64 estimateBankDanger(const CBank * bank); //TODO: move to another class?
|
||||||
|
|
||||||
|
@ -81,9 +81,9 @@ namespace Goals
|
|||||||
bool operator<(const TSubgoal & rhs) const;
|
bool operator<(const TSubgoal & rhs) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<ITask> TTask;
|
using TTask = std::shared_ptr<ITask>;
|
||||||
typedef std::vector<TTask> TTaskVec;
|
using TTaskVec = std::vector<TTask>;
|
||||||
typedef std::vector<TSubgoal> TGoalVec;
|
using TGoalVec = std::vector<TSubgoal>;
|
||||||
|
|
||||||
//method chaining + clone pattern
|
//method chaining + clone pattern
|
||||||
#define SETTER(type, field) AbstractGoal & set ## field(const type &rhs) {field = rhs; return *this;};
|
#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)
|
const CGTownInstance *town; SETTER(CGTownInstance *, town)
|
||||||
int bid; SETTER(int, bid)
|
int bid; SETTER(int, bid)
|
||||||
|
|
||||||
AbstractGoal(EGoals goal = EGoals::INVALID)
|
AbstractGoal(EGoals goal = EGoals::INVALID): goalType(goal)
|
||||||
: goalType(goal), hero()
|
|
||||||
{
|
{
|
||||||
isAbstract = false;
|
isAbstract = false;
|
||||||
value = 0;
|
value = 0;
|
||||||
|
@ -205,14 +205,14 @@ public:
|
|||||||
|
|
||||||
inline void updateAINode(CGPathNode * node, std::function<void (AIPathNode *)> updater)
|
inline void updateAINode(CGPathNode * node, std::function<void (AIPathNode *)> updater)
|
||||||
{
|
{
|
||||||
auto aiNode = static_cast<AIPathNode *>(node);
|
auto * aiNode = static_cast<AIPathNode *>(node);
|
||||||
|
|
||||||
updater(aiNode);
|
updater(aiNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const CGHeroInstance * getHero(const CGPathNode * node) const
|
inline const CGHeroInstance * getHero(const CGPathNode * node) const
|
||||||
{
|
{
|
||||||
auto aiNode = getAINode(node);
|
const auto * aiNode = getAINode(node);
|
||||||
|
|
||||||
return aiNode->actor->hero;
|
return aiNode->actor->hero;
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,7 @@ public:
|
|||||||
virtual bool needsLastStack() const override;
|
virtual bool needsLastStack() const override;
|
||||||
std::shared_ptr<SpecialAction> getActorAction() const;
|
std::shared_ptr<SpecialAction> getActorAction() const;
|
||||||
|
|
||||||
HeroExchangeArmy() : CArmedInstance(true), armyCost(), requireBuyArmy(false)
|
HeroExchangeArmy(): CArmedInstance(true), requireBuyArmy(false) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ExchangeResult
|
struct ExchangeResult
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
class CCallback;
|
class CCallback;
|
||||||
struct creInfo;
|
struct creInfo;
|
||||||
|
|
||||||
typedef const int3 & crint3;
|
using crint3 = const int3 &;
|
||||||
typedef const std::string & crstring;
|
using crstring = const std::string &;
|
||||||
typedef std::pair<ui32, std::vector<CreatureID>> dwellingContent;
|
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 GOLD_MINE_PRODUCTION = 1000, WOOD_ORE_MINE_PRODUCTION = 2, RESOURCE_MINE_PRODUCTION = 1;
|
||||||
const int ACTUAL_RESOURCE_COUNT = 7;
|
const int ACTUAL_RESOURCE_COUNT = 7;
|
||||||
|
@ -76,7 +76,7 @@ namespace Goals
|
|||||||
//TODO: serialize?
|
//TODO: serialize?
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<TSubgoal> TGoalVec;
|
using TGoalVec = std::vector<TSubgoal>;
|
||||||
|
|
||||||
//method chaining + clone pattern
|
//method chaining + clone pattern
|
||||||
#define VSETTER(type, field) virtual AbstractGoal & set ## field(const type &rhs) {field = rhs; return *this;};
|
#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)
|
TSubgoal parent; VSETTER(TSubgoal, parent)
|
||||||
EvaluationContext evaluationContext; VSETTER(EvaluationContext, evaluationContext)
|
EvaluationContext evaluationContext; VSETTER(EvaluationContext, evaluationContext)
|
||||||
|
|
||||||
AbstractGoal(EGoals goal = EGoals::INVALID)
|
AbstractGoal(EGoals goal = EGoals::INVALID): goalType(goal)
|
||||||
: goalType(goal), evaluationContext()
|
|
||||||
{
|
{
|
||||||
priority = 0;
|
priority = 0;
|
||||||
isElementar = false;
|
isElementar = false;
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
class CCallback;
|
class CCallback;
|
||||||
|
|
||||||
extern boost::thread_specific_ptr<CCallback> cb; //for templates
|
|
||||||
|
|
||||||
struct AIPathNode : public CGPathNode
|
struct AIPathNode : public CGPathNode
|
||||||
{
|
{
|
||||||
uint32_t chainMask;
|
uint32_t chainMask;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
struct _Mix_Music;
|
struct _Mix_Music;
|
||||||
struct SDL_RWops;
|
struct SDL_RWops;
|
||||||
typedef struct _Mix_Music Mix_Music;
|
using Mix_Music = struct _Mix_Music;
|
||||||
struct Mix_Chunk;
|
struct Mix_Chunk;
|
||||||
|
|
||||||
class CAudioBase {
|
class CAudioBase {
|
||||||
|
@ -61,8 +61,8 @@ namespace boost { class thread; }
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
class ThreadSafeVector
|
class ThreadSafeVector
|
||||||
{
|
{
|
||||||
typedef std::vector<T> TVector;
|
using TVector = std::vector<T>;
|
||||||
typedef boost::unique_lock<boost::mutex> TLock;
|
using TLock = boost::unique_lock<boost::mutex>;
|
||||||
TVector items;
|
TVector items;
|
||||||
boost::mutex mx;
|
boost::mutex mx;
|
||||||
boost::condition_variable cond;
|
boost::condition_variable cond;
|
||||||
|
@ -68,7 +68,7 @@ namespace AnimationControls
|
|||||||
class CreatureAnimation : public CIntObject
|
class CreatureAnimation : public CIntObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::function<float(CreatureAnimation *, ECreatureAnimType)> TSpeedController;
|
using TSpeedController = std::function<float(CreatureAnimation *, ECreatureAnimType)>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -80,7 +80,7 @@ private:
|
|||||||
std::vector<std::shared_ptr<IShowActivatable>> disposed;
|
std::vector<std::shared_ptr<IShowActivatable>> disposed;
|
||||||
|
|
||||||
std::atomic<bool> continueEventHandling;
|
std::atomic<bool> continueEventHandling;
|
||||||
typedef std::list<CIntObject*> CIntObjectList;
|
using CIntObjectList = std::list<CIntObject *>;
|
||||||
|
|
||||||
//active GUI elements (listening for events
|
//active GUI elements (listening for events
|
||||||
CIntObjectList lclickable;
|
CIntObjectList lclickable;
|
||||||
@ -107,11 +107,9 @@ private:
|
|||||||
public:
|
public:
|
||||||
void handleElementActivate(CIntObject * elem, ui16 activityFlag);
|
void handleElementActivate(CIntObject * elem, ui16 activityFlag);
|
||||||
void handleElementDeActivate(CIntObject * elem, ui16 activityFlag);
|
void handleElementDeActivate(CIntObject * elem, ui16 activityFlag);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//objs to blit
|
//objs to blit
|
||||||
std::vector<std::shared_ptr<IShowActivatable>> objsToBlit;
|
std::vector<std::shared_ptr<IShowActivatable>> objsToBlit;
|
||||||
|
|
||||||
/// returns current position of mouse cursor, relative to vcmi window
|
/// returns current position of mouse cursor, relative to vcmi window
|
||||||
const Point & getCursorPosition() const;
|
const Point & getCursorPosition() const;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ struct SDL_Surface;
|
|||||||
class CGuiHandler;
|
class CGuiHandler;
|
||||||
class CPicture;
|
class CPicture;
|
||||||
|
|
||||||
typedef int32_t SDL_Keycode;
|
using SDL_Keycode = int32_t;
|
||||||
|
|
||||||
using boost::logic::tribool;
|
using boost::logic::tribool;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ VCMI_LIB_NAMESPACE_END
|
|||||||
|
|
||||||
class CBitmapFont;
|
class CBitmapFont;
|
||||||
|
|
||||||
typedef struct _TTF_Font TTF_Font;
|
using TTF_Font = struct _TTF_Font;
|
||||||
|
|
||||||
class CTrueTypeFont : public IFont
|
class CTrueTypeFont : public IFont
|
||||||
{
|
{
|
||||||
|
@ -45,8 +45,8 @@ SDL_Color toSDL(const ColorRGBA & color);
|
|||||||
void setColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);
|
void setColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);
|
||||||
void setAlpha(SDL_Surface * bg, int value);
|
void setAlpha(SDL_Surface * bg, int value);
|
||||||
|
|
||||||
typedef void (*TColorPutter)(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B);
|
using TColorPutter = void (*)(uint8_t *&, const uint8_t &, const uint8_t &, const uint8_t &);
|
||||||
typedef void (*TColorPutterAlpha)(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A);
|
using TColorPutterAlpha = void (*)(uint8_t *&, const uint8_t &, const uint8_t &, const uint8_t &, const uint8_t &);
|
||||||
|
|
||||||
void blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst);
|
void blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst);
|
||||||
void blitAt(SDL_Surface * src, const Rect & pos, SDL_Surface * dst);
|
void blitAt(SDL_Surface * src, const Rect & pos, SDL_Surface * dst);
|
||||||
@ -57,23 +57,23 @@ typedef void (*TColorPutterAlpha)(uint8_t *&ptr, const uint8_t & R, const uint8_
|
|||||||
void blitSurface(SDL_Surface * src, const Rect & srcRect, SDL_Surface * dst, const Point & dest);
|
void blitSurface(SDL_Surface * src, const Rect & srcRect, SDL_Surface * dst, const Point & dest);
|
||||||
void blitSurface(SDL_Surface * src, SDL_Surface * dst, const Point & dest);
|
void blitSurface(SDL_Surface * src, SDL_Surface * dst, const Point & dest);
|
||||||
|
|
||||||
void fillSurface(SDL_Surface *dst, const SDL_Color & color);
|
void fillSurface(SDL_Surface * dst, const SDL_Color & color);
|
||||||
void fillRect(SDL_Surface *dst, const Rect & dstrect, const SDL_Color & color);
|
void fillRect(SDL_Surface * dst, const Rect & dstrect, const SDL_Color & color);
|
||||||
|
|
||||||
void updateRect(SDL_Surface *surface, const Rect & rect);
|
void updateRect(SDL_Surface * surface, const Rect & rect);
|
||||||
|
|
||||||
void putPixelWithoutRefresh(SDL_Surface *ekran, const int & x, const int & y, const uint8_t & R, const uint8_t & G, const uint8_t & B, uint8_t A = 255);
|
void putPixelWithoutRefresh(SDL_Surface * ekran, const int & x, const int & y, const uint8_t & R, const uint8_t & G, const uint8_t & B, uint8_t A = 255);
|
||||||
void putPixelWithoutRefreshIfInSurf(SDL_Surface *ekran, const int & x, const int & y, const uint8_t & R, const uint8_t & G, const uint8_t & B, uint8_t A = 255);
|
void putPixelWithoutRefreshIfInSurf(SDL_Surface *ekran, const int & x, const int & y, const uint8_t & R, const uint8_t & G, const uint8_t & B, uint8_t A = 255);
|
||||||
|
|
||||||
SDL_Surface * verticalFlip(SDL_Surface * toRot); //vertical flip
|
SDL_Surface * verticalFlip(SDL_Surface * toRot); //vertical flip
|
||||||
SDL_Surface * horizontalFlip(SDL_Surface * toRot); //horizontal flip
|
SDL_Surface * horizontalFlip(SDL_Surface * toRot); //horizontal flip
|
||||||
uint32_t getPixel(SDL_Surface *surface, const int & x, const int & y, bool colorByte = false);
|
uint32_t getPixel(SDL_Surface * surface, const int & x, const int & y, bool colorByte = false);
|
||||||
bool isTransparent(SDL_Surface * srf, int x, int y); //checks if surface is transparent at given position
|
bool isTransparent(SDL_Surface * srf, int x, int y); //checks if surface is transparent at given position
|
||||||
bool isTransparent(SDL_Surface * srf, const Point & position); //checks if surface is transparent at given position
|
bool isTransparent(SDL_Surface * srf, const Point & position); //checks if surface is transparent at given position
|
||||||
|
|
||||||
uint8_t *getPxPtr(const SDL_Surface * const &srf, const int x, const int y);
|
uint8_t * getPxPtr(const SDL_Surface * const & srf, const int x, const int y);
|
||||||
TColorPutter getPutterFor(SDL_Surface * const &dest, int incrementing); //incrementing: -1, 0, 1
|
TColorPutter getPutterFor(SDL_Surface * const & dest, int incrementing); //incrementing: -1, 0, 1
|
||||||
TColorPutterAlpha getPutterAlphaFor(SDL_Surface * const &dest, int incrementing); //incrementing: -1, 0, 1
|
TColorPutterAlpha getPutterAlphaFor(SDL_Surface * const & dest, int incrementing); //incrementing: -1, 0, 1
|
||||||
|
|
||||||
template<int bpp>
|
template<int bpp>
|
||||||
int blit8bppAlphaTo24bppT(const SDL_Surface * src, const Rect & srcRect, SDL_Surface * dst, const Point & dstPoint); //blits 8 bpp surface with alpha channel to 24 bpp surface
|
int blit8bppAlphaTo24bppT(const SDL_Surface * src, const Rect & srcRect, SDL_Surface * dst, const Point & dstPoint); //blits 8 bpp surface with alpha channel to 24 bpp surface
|
||||||
@ -84,8 +84,8 @@ typedef void (*TColorPutterAlpha)(uint8_t *&ptr, const uint8_t & R, const uint8_
|
|||||||
void drawLine(SDL_Surface * sur, const Point & from, const Point & dest, const SDL_Color & color1, const SDL_Color & color2);
|
void drawLine(SDL_Surface * sur, const Point & from, const Point & dest, const SDL_Color & color1, const SDL_Color & color2);
|
||||||
void drawLineDashed(SDL_Surface * sur, const Point & from, const Point & dest, const SDL_Color & color);
|
void drawLineDashed(SDL_Surface * sur, const Point & from, const Point & dest, const SDL_Color & color);
|
||||||
|
|
||||||
void drawBorder(SDL_Surface * sur, int x, int y, int w, int h, const SDL_Color &color, int depth = 1);
|
void drawBorder(SDL_Surface * sur, int x, int y, int w, int h, const SDL_Color & color, int depth = 1);
|
||||||
void drawBorder(SDL_Surface * sur, const Rect &r, const SDL_Color &color, int depth = 1);
|
void drawBorder(SDL_Surface * sur, const Rect & r, const SDL_Color & color, int depth = 1);
|
||||||
void setPlayerColor(SDL_Surface * sur, PlayerColor player); //sets correct color of flags; -1 for neutral
|
void setPlayerColor(SDL_Surface * sur, PlayerColor player); //sets correct color of flags; -1 for neutral
|
||||||
|
|
||||||
SDL_Surface * newSurface(int w, int h, SDL_Surface * mod); //creates new surface, with flags/format same as in surface given
|
SDL_Surface * newSurface(int w, int h, SDL_Surface * mod); //creates new surface, with flags/format same as in surface given
|
||||||
@ -97,18 +97,18 @@ typedef void (*TColorPutterAlpha)(uint8_t *&ptr, const uint8_t & R, const uint8_
|
|||||||
|
|
||||||
//scale surface to required size.
|
//scale surface to required size.
|
||||||
//nearest neighbour algorithm
|
//nearest neighbour algorithm
|
||||||
SDL_Surface * scaleSurfaceFast(SDL_Surface *surf, int width, int height);
|
SDL_Surface * scaleSurfaceFast(SDL_Surface * surf, int width, int height);
|
||||||
// bilinear filtering. Uses fallback to scaleSurfaceFast in case of indexed surfaces
|
// bilinear filtering. Uses fallback to scaleSurfaceFast in case of indexed surfaces
|
||||||
SDL_Surface * scaleSurface(SDL_Surface *surf, int width, int height);
|
SDL_Surface * scaleSurface(SDL_Surface * surf, int width, int height);
|
||||||
|
|
||||||
template<int bpp>
|
template<int bpp>
|
||||||
void convertToGrayscaleBpp( SDL_Surface * surf, const Rect & rect );
|
void convertToGrayscaleBpp(SDL_Surface * surf, const Rect & rect);
|
||||||
void convertToGrayscale(SDL_Surface * surf, const Rect & rect);
|
void convertToGrayscale(SDL_Surface * surf, const Rect & rect);
|
||||||
|
|
||||||
bool isResolutionSupported(const std::vector<Point> & resolutions, const Point toTest );
|
bool isResolutionSupported(const std::vector<Point> & resolutions, const Point toTest);
|
||||||
|
|
||||||
std::vector<Point> getSupportedResolutions();
|
std::vector<Point> getSupportedResolutions();
|
||||||
std::vector<Point> getSupportedResolutions( int displayIndex);
|
std::vector<Point> getSupportedResolutions(int displayIndex);
|
||||||
|
|
||||||
void setColorKey(SDL_Surface * surface, SDL_Color color);
|
void setColorKey(SDL_Surface * surface, SDL_Color color);
|
||||||
|
|
||||||
@ -118,13 +118,13 @@ typedef void (*TColorPutterAlpha)(uint8_t *&ptr, const uint8_t & R, const uint8_
|
|||||||
void setDefaultColorKeyPresize(SDL_Surface * surface);
|
void setDefaultColorKeyPresize(SDL_Surface * surface);
|
||||||
|
|
||||||
/// helper that will safely set and un-set ClipRect for SDL_Surface
|
/// helper that will safely set and un-set ClipRect for SDL_Surface
|
||||||
class CClipRectGuard : boost::noncopyable
|
class CClipRectGuard: boost::noncopyable
|
||||||
{
|
{
|
||||||
SDL_Surface * surf;
|
SDL_Surface * surf;
|
||||||
Rect oldRect;
|
Rect oldRect;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CClipRectGuard(SDL_Surface * surface, const Rect & rect):
|
CClipRectGuard(SDL_Surface * surface, const Rect & rect): surf(surface)
|
||||||
surf(surface)
|
|
||||||
{
|
{
|
||||||
CSDL_Ext::getClipRect(surf, oldRect);
|
CSDL_Ext::getClipRect(surf, oldRect);
|
||||||
CSDL_Ext::setClipRect(surf, rect);
|
CSDL_Ext::setClipRect(surf, rect);
|
||||||
|
@ -47,7 +47,7 @@ namespace Channels
|
|||||||
|
|
||||||
static void STRONG_INLINE set(uint8_t *ptr, uint8_t value)
|
static void STRONG_INLINE set(uint8_t *ptr, uint8_t value)
|
||||||
{
|
{
|
||||||
uint16_t * const pixel = (uint16_t*)ptr;
|
auto * const pixel = (uint16_t *)ptr;
|
||||||
uint8_t subpx = value >> (8 - bits);
|
uint8_t subpx = value >> (8 - bits);
|
||||||
*pixel = (*pixel & ~mask) | ((subpx << shift) & mask );
|
*pixel = (*pixel & ~mask) | ((subpx << shift) & mask );
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColor(uint8_t *&ptr, const u
|
|||||||
if(incrementPtr == -1)
|
if(incrementPtr == -1)
|
||||||
ptr -= 2;
|
ptr -= 2;
|
||||||
|
|
||||||
uint16_t * const px = (uint16_t*)ptr;
|
auto * const px = (uint16_t *)ptr;
|
||||||
*px = (B>>3) + ((G>>2) << 5) + ((R>>3) << 11); //drop least significant bits of 24 bpp encoded color
|
*px = (B>>3) + ((G>>2) << 5) + ((R>>3) << 11); //drop least significant bits of 24 bpp encoded color
|
||||||
|
|
||||||
if(incrementPtr == 1)
|
if(incrementPtr == 1)
|
||||||
|
@ -25,7 +25,7 @@ class CAnimation;
|
|||||||
class CObjectList : public CIntObject
|
class CObjectList : public CIntObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::function<std::shared_ptr<CIntObject>(size_t)> CreateFunc;
|
using CreateFunc = std::function<std::shared_ptr<CIntObject>(size_t)>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CreateFunc createObject;
|
CreateFunc createObject;
|
||||||
|
@ -45,8 +45,8 @@ public:
|
|||||||
class CInfoWindow : public CSimpleWindow
|
class CInfoWindow : public CSimpleWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::vector<std::pair<std::string, CFunctionList<void()> > > TButtonsInfo;
|
using TButtonsInfo = std::vector<std::pair<std::string, CFunctionList<void()>>>;
|
||||||
typedef std::vector<std::shared_ptr<CComponent>> TCompsInfo;
|
using TCompsInfo = std::vector<std::shared_ptr<CComponent>>;
|
||||||
QueryID ID; //for identification
|
QueryID ID; //for identification
|
||||||
std::shared_ptr<CTextBox> text;
|
std::shared_ptr<CTextBox> text;
|
||||||
std::vector<std::shared_ptr<CButton>> buttons;
|
std::vector<std::shared_ptr<CButton>> buttons;
|
||||||
|
@ -52,7 +52,7 @@ enum class AimType
|
|||||||
class DLL_LINKAGE Problem
|
class DLL_LINKAGE Problem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef int Severity;
|
using Severity = int;
|
||||||
|
|
||||||
enum ESeverity
|
enum ESeverity
|
||||||
{
|
{
|
||||||
|
@ -15,8 +15,8 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
namespace vstd
|
namespace vstd
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef std::function<int64_t()> TRandI64;
|
using TRandI64 = std::function<int64_t()>;
|
||||||
typedef std::function<double()> TRand;
|
using TRand = std::function<double()>;
|
||||||
|
|
||||||
class DLL_LINKAGE RNG
|
class DLL_LINKAGE RNG
|
||||||
{
|
{
|
||||||
|
@ -36,8 +36,12 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleFieldInfo(BattleField battlefield, std::string identifier)
|
BattleFieldInfo(BattleField battlefield, std::string identifier):
|
||||||
:bonuses(), isSpecial(false), battlefield(battlefield), identifier(identifier), graphics(), icon(), iconIndex(battlefield.getNum()), impassableHexes(), name(identifier)
|
isSpecial(false),
|
||||||
|
battlefield(battlefield),
|
||||||
|
identifier(identifier),
|
||||||
|
iconIndex(battlefield.getNum()),
|
||||||
|
name(identifier)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
class JsonNode;
|
class JsonNode;
|
||||||
|
|
||||||
typedef Bonus::BonusType BonusTypeID;
|
using BonusTypeID = Bonus::BonusType;
|
||||||
|
|
||||||
class DLL_LINKAGE CBonusType
|
class DLL_LINKAGE CBonusType
|
||||||
{
|
{
|
||||||
|
@ -171,7 +171,7 @@ namespace config
|
|||||||
GUIOptions *current; // pointer to current gui options
|
GUIOptions *current; // pointer to current gui options
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::map<std::pair<int,int>, GUIOptions > GuiOptionsMap;
|
using GuiOptionsMap = std::map<std::pair<int, int>, GUIOptions>;
|
||||||
GuiOptionsMap guiOptions;
|
GuiOptionsMap guiOptions;
|
||||||
void init();
|
void init();
|
||||||
CConfigHandler();
|
CConfigHandler();
|
||||||
|
@ -163,22 +163,18 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::map<SlotID, CStackInstance*> TSlots;
|
using TSlots = std::map<SlotID, CStackInstance *>;
|
||||||
typedef std::map<SlotID, std::pair<CreatureID, TQuantity>> TSimpleSlots;
|
using TSimpleSlots = std::map<SlotID, std::pair<CreatureID, TQuantity>>;
|
||||||
|
|
||||||
typedef std::pair<const CCreature*, SlotID> TPairCreatureSlot;
|
using TPairCreatureSlot = std::pair<const CCreature *, SlotID>;
|
||||||
typedef std::map<const CCreature*, SlotID> TMapCreatureSlot;
|
using TMapCreatureSlot = std::map<const CCreature *, SlotID>;
|
||||||
|
|
||||||
struct DLL_LINKAGE CreatureSlotComparer
|
struct DLL_LINKAGE CreatureSlotComparer
|
||||||
{
|
{
|
||||||
bool operator()(const TPairCreatureSlot & lhs, const TPairCreatureSlot & rhs);
|
bool operator()(const TPairCreatureSlot & lhs, const TPairCreatureSlot & rhs);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::priority_queue<
|
using TCreatureQueue = std::priority_queue<TPairCreatureSlot, std::vector<TPairCreatureSlot>, CreatureSlotComparer>;
|
||||||
TPairCreatureSlot,
|
|
||||||
std::vector<TPairCreatureSlot>,
|
|
||||||
CreatureSlotComparer
|
|
||||||
> TCreatureQueue;
|
|
||||||
|
|
||||||
class IArmyDescriptor
|
class IArmyDescriptor
|
||||||
{
|
{
|
||||||
|
@ -198,9 +198,8 @@ public:
|
|||||||
|
|
||||||
if(!h.saving)
|
if(!h.saving)
|
||||||
{
|
{
|
||||||
for(auto i = 0; i < secSkillProbability.size(); i++)
|
for(int & i : secSkillProbability)
|
||||||
if(secSkillProbability[i] < 0)
|
vstd::amax(i, 0);
|
||||||
secSkillProbability[i] = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EAlignment getAlignment() const;
|
EAlignment getAlignment() const;
|
||||||
|
@ -310,7 +310,7 @@ public:
|
|||||||
missingMods(std::move(_missingMods))
|
missingMods(std::move(_missingMods))
|
||||||
{
|
{
|
||||||
std::ostringstream _ss;
|
std::ostringstream _ss;
|
||||||
for(auto & m : missingMods)
|
for(const auto & m : missingMods)
|
||||||
_ss << m.first << ' ' << m.second << std::endl;
|
_ss << m.first << ' ' << m.second << std::endl;
|
||||||
message = _ss.str();
|
message = _ss.str();
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ struct DLL_LINKAGE NodeComparer
|
|||||||
|
|
||||||
struct DLL_LINKAGE CGPathNode
|
struct DLL_LINKAGE CGPathNode
|
||||||
{
|
{
|
||||||
typedef EPathfindingLayer ELayer;
|
using ELayer = EPathfindingLayer;
|
||||||
|
|
||||||
enum ENodeAction : ui8
|
enum ENodeAction : ui8
|
||||||
{
|
{
|
||||||
@ -151,10 +151,7 @@ struct DLL_LINKAGE CGPathNode
|
|||||||
return turns < 255;
|
return turns < 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef boost::heap::fibonacci_heap<
|
using TFibHeap = boost::heap::fibonacci_heap<CGPathNode *, boost::heap::compare<NodeComparer<CGPathNode>>>;
|
||||||
CGPathNode *,
|
|
||||||
boost::heap::compare<NodeComparer<CGPathNode>>
|
|
||||||
> TFibHeap;
|
|
||||||
|
|
||||||
TFibHeap::handle_type pqHandle;
|
TFibHeap::handle_type pqHandle;
|
||||||
TFibHeap* pq;
|
TFibHeap* pq;
|
||||||
@ -173,7 +170,7 @@ struct DLL_LINKAGE CGPath
|
|||||||
|
|
||||||
struct DLL_LINKAGE CPathsInfo
|
struct DLL_LINKAGE CPathsInfo
|
||||||
{
|
{
|
||||||
typedef EPathfindingLayer ELayer;
|
using ELayer = EPathfindingLayer;
|
||||||
|
|
||||||
const CGHeroInstance * hero;
|
const CGHeroInstance * hero;
|
||||||
int3 hpos;
|
int3 hpos;
|
||||||
@ -484,7 +481,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
CGameState * gamestate;
|
CGameState * gamestate;
|
||||||
|
|
||||||
typedef EPathfindingLayer ELayer;
|
using ELayer = EPathfindingLayer;
|
||||||
|
|
||||||
std::shared_ptr<PathfinderConfig> config;
|
std::shared_ptr<PathfinderConfig> config;
|
||||||
|
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
typedef std::mt19937 TGenerator;
|
using TGenerator = std::mt19937;
|
||||||
typedef std::uniform_int_distribution<int> TIntDist;
|
using TIntDist = std::uniform_int_distribution<int>;
|
||||||
typedef std::uniform_int_distribution<int64_t> TInt64Dist;
|
using TInt64Dist = std::uniform_int_distribution<int64_t>;
|
||||||
typedef std::uniform_real_distribution<double> TRealDist;
|
using TRealDist = std::uniform_real_distribution<double>;
|
||||||
typedef std::function<int()> TRandI;
|
using TRandI = std::function<int()>;
|
||||||
|
|
||||||
/// The random generator randomly generates integers and real numbers("doubles") between
|
/// The random generator randomly generates integers and real numbers("doubles") between
|
||||||
/// a given range. This is a header only class and mainly a wrapper for
|
/// a given range. This is a header only class and mainly a wrapper for
|
||||||
|
@ -121,7 +121,7 @@ public:
|
|||||||
|
|
||||||
if(extSlot == SlotID::COMMANDER_SLOT_PLACEHOLDER)
|
if(extSlot == SlotID::COMMANDER_SLOT_PLACEHOLDER)
|
||||||
{
|
{
|
||||||
auto hero = dynamic_cast<const CGHeroInstance *>(army);
|
const auto * hero = dynamic_cast<const CGHeroInstance *>(army);
|
||||||
assert(hero);
|
assert(hero);
|
||||||
base = hero->commander;
|
base = hero->commander;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
class DLL_LINKAGE CThreadHelper
|
class DLL_LINKAGE CThreadHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::function<void()> Task;
|
using Task = std::function<void()>;
|
||||||
CThreadHelper(std::vector<std::function<void()> > *Tasks, int Threads);
|
CThreadHelper(std::vector<std::function<void()> > *Tasks, int Threads);
|
||||||
void run();
|
void run();
|
||||||
private:
|
private:
|
||||||
|
@ -43,7 +43,7 @@ class DLL_LINKAGE CBuilding
|
|||||||
std::string identifier;
|
std::string identifier;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef LogicalExpression<BuildingID> TRequired;
|
using TRequired = LogicalExpression<BuildingID>;
|
||||||
|
|
||||||
CTown * town; // town this building belongs to
|
CTown * town; // town this building belongs to
|
||||||
TResources resources;
|
TResources resources;
|
||||||
|
@ -1325,11 +1325,11 @@ enum class EHealPower : ui8
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Typedef declarations
|
// Typedef declarations
|
||||||
typedef si64 TExpType;
|
using TExpType = si64;
|
||||||
typedef si32 TBonusSubtype;
|
using TBonusSubtype = si32;
|
||||||
typedef si32 TQuantity;
|
using TQuantity = si32;
|
||||||
|
|
||||||
typedef int TRmgTemplateZoneId;
|
using TRmgTemplateZoneId = int;
|
||||||
|
|
||||||
#undef ID_LIKE_CLASS_COMMON
|
#undef ID_LIKE_CLASS_COMMON
|
||||||
#undef ID_LIKE_OPERATORS
|
#undef ID_LIKE_OPERATORS
|
||||||
|
@ -25,14 +25,14 @@ class IPropagator;
|
|||||||
class IUpdater;
|
class IUpdater;
|
||||||
class BonusList;
|
class BonusList;
|
||||||
|
|
||||||
typedef std::shared_ptr<BonusList> TBonusListPtr;
|
using TBonusListPtr = std::shared_ptr<BonusList>;
|
||||||
typedef std::shared_ptr<const BonusList> TConstBonusListPtr;
|
using TConstBonusListPtr = std::shared_ptr<const BonusList>;
|
||||||
typedef std::shared_ptr<ILimiter> TLimiterPtr;
|
using TLimiterPtr = std::shared_ptr<ILimiter>;
|
||||||
typedef std::shared_ptr<IPropagator> TPropagatorPtr;
|
using TPropagatorPtr = std::shared_ptr<IPropagator>;
|
||||||
typedef std::shared_ptr<IUpdater> TUpdaterPtr;
|
using TUpdaterPtr = std::shared_ptr<IUpdater>;
|
||||||
typedef std::set<CBonusSystemNode*> TNodes;
|
using TNodes = std::set<CBonusSystemNode *>;
|
||||||
typedef std::set<const CBonusSystemNode*> TCNodes;
|
using TCNodes = std::set<const CBonusSystemNode *>;
|
||||||
typedef std::vector<CBonusSystemNode *> TNodesVector;
|
using TNodesVector = std::vector<CBonusSystemNode *>;
|
||||||
|
|
||||||
class CSelector : std::function<bool(const Bonus*)>
|
class CSelector : std::function<bool(const Bonus*)>
|
||||||
{
|
{
|
||||||
@ -548,7 +548,7 @@ struct DLL_LINKAGE BonusParams {
|
|||||||
bool isConverted;
|
bool isConverted;
|
||||||
Bonus::BonusType type = Bonus::NONE;
|
Bonus::BonusType type = Bonus::NONE;
|
||||||
TBonusSubtype subtype = -1;
|
TBonusSubtype subtype = -1;
|
||||||
std::string subtypeStr = "";
|
std::string subtypeStr;
|
||||||
bool subtypeRelevant = false;
|
bool subtypeRelevant = false;
|
||||||
Bonus::ValueType valueType = Bonus::BASE_NUMBER;
|
Bonus::ValueType valueType = Bonus::BASE_NUMBER;
|
||||||
bool valueTypeRelevant = false;
|
bool valueTypeRelevant = false;
|
||||||
@ -569,7 +569,7 @@ private:
|
|||||||
class DLL_LINKAGE BonusList
|
class DLL_LINKAGE BonusList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::vector<std::shared_ptr<Bonus>> TInternalContainer;
|
using TInternalContainer = std::vector<std::shared_ptr<Bonus>>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TInternalContainer bonuses;
|
TInternalContainer bonuses;
|
||||||
@ -577,11 +577,11 @@ private:
|
|||||||
void changed() const;
|
void changed() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef TInternalContainer::const_reference const_reference;
|
using const_reference = TInternalContainer::const_reference;
|
||||||
typedef TInternalContainer::value_type value_type;
|
using value_type = TInternalContainer::value_type;
|
||||||
|
|
||||||
typedef TInternalContainer::const_iterator const_iterator;
|
using const_iterator = TInternalContainer::const_iterator;
|
||||||
typedef TInternalContainer::iterator iterator;
|
using iterator = TInternalContainer::iterator;
|
||||||
|
|
||||||
BonusList(bool BelongsToTree = false);
|
BonusList(bool BelongsToTree = false);
|
||||||
BonusList(const BonusList &bonusList);
|
BonusList(const BonusList &bonusList);
|
||||||
@ -628,9 +628,8 @@ public:
|
|||||||
void remove_if(Predicate pred)
|
void remove_if(Predicate pred)
|
||||||
{
|
{
|
||||||
BonusList newList;
|
BonusList newList;
|
||||||
for (ui32 i = 0; i < bonuses.size(); i++)
|
for(const auto & b : bonuses)
|
||||||
{
|
{
|
||||||
auto b = bonuses[i];
|
|
||||||
if (!pred(b.get()))
|
if (!pred(b.get()))
|
||||||
newList.push_back(b);
|
newList.push_back(b);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public:
|
|||||||
|
|
||||||
objects.push_back(object);
|
objects.push_back(object);
|
||||||
|
|
||||||
for(auto type_name : getTypeNames())
|
for(const auto & type_name : getTypeNames())
|
||||||
registerObject(scope, type_name, name, object->getIndex());
|
registerObject(scope, type_name, name, object->getIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ public:
|
|||||||
assert(objects[index] == nullptr); // ensure that this id was not loaded before
|
assert(objects[index] == nullptr); // ensure that this id was not loaded before
|
||||||
objects[index] = object;
|
objects[index] = object;
|
||||||
|
|
||||||
for(auto type_name : getTypeNames())
|
for(const auto & type_name : getTypeNames())
|
||||||
registerObject(scope, type_name, name, object->getIndex());
|
registerObject(scope, type_name, name, object->getIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,10 +116,10 @@ namespace Validation
|
|||||||
std::string makeErrorMessage(const std::string &message);
|
std::string makeErrorMessage(const std::string &message);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::function<std::string(const JsonNode &)> TFormatValidator;
|
using TFormatValidator = std::function<std::string(const JsonNode &)>;
|
||||||
typedef std::unordered_map<std::string, TFormatValidator> TFormatMap;
|
using TFormatMap = std::unordered_map<std::string, TFormatValidator>;
|
||||||
typedef std::function<std::string(ValidationData &, const JsonNode &, const JsonNode &, const JsonNode &)> TFieldValidator;
|
using TFieldValidator = std::function<std::string(ValidationData &, const JsonNode &, const JsonNode &, const JsonNode &)>;
|
||||||
typedef std::unordered_map<std::string, TFieldValidator> TValidatorMap;
|
using TValidatorMap = std::unordered_map<std::string, TFieldValidator>;
|
||||||
|
|
||||||
/// map of known fields in schema
|
/// map of known fields in schema
|
||||||
const TValidatorMap & getKnownFieldsFor(JsonNode::JsonType type);
|
const TValidatorMap & getKnownFieldsFor(JsonNode::JsonType type);
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
class JsonNode;
|
class JsonNode;
|
||||||
typedef std::map <std::string, JsonNode> JsonMap;
|
using JsonMap = std::map<std::string, JsonNode>;
|
||||||
typedef std::vector <JsonNode> JsonVector;
|
using JsonVector = std::vector<JsonNode>;
|
||||||
|
|
||||||
struct Bonus;
|
struct Bonus;
|
||||||
class CSelector;
|
class CSelector;
|
||||||
|
@ -30,19 +30,14 @@ namespace LogicalExpressionDetail
|
|||||||
};
|
};
|
||||||
template<EOperations tag> class Element;
|
template<EOperations tag> class Element;
|
||||||
|
|
||||||
typedef Element<ANY_OF> OperatorAny;
|
using OperatorAny = Element<ANY_OF>;
|
||||||
typedef Element<ALL_OF> OperatorAll;
|
using OperatorAll = Element<ALL_OF>;
|
||||||
typedef Element<NONE_OF> OperatorNone;
|
using OperatorNone = Element<NONE_OF>;
|
||||||
|
|
||||||
typedef ContainedClass Value;
|
using Value = ContainedClass;
|
||||||
|
|
||||||
/// Variant that contains all possible elements from logical expression
|
/// Variant that contains all possible elements from logical expression
|
||||||
typedef std::variant<
|
using Variant = std::variant<OperatorAll, OperatorAny, OperatorNone, Value>;
|
||||||
OperatorAll,
|
|
||||||
OperatorAny,
|
|
||||||
OperatorNone,
|
|
||||||
Value
|
|
||||||
> Variant;
|
|
||||||
|
|
||||||
/// Variant element, contains list of expressions to which operation "tag" should be applied
|
/// Variant element, contains list of expressions to which operation "tag" should be applied
|
||||||
template<EOperations tag>
|
template<EOperations tag>
|
||||||
@ -73,7 +68,7 @@ namespace LogicalExpressionDetail
|
|||||||
template<typename ContainedClass>
|
template<typename ContainedClass>
|
||||||
class TestVisitor
|
class TestVisitor
|
||||||
{
|
{
|
||||||
typedef ExpressionBase<ContainedClass> Base;
|
using Base = ExpressionBase<ContainedClass>;
|
||||||
|
|
||||||
std::function<bool(const typename Base::Value &)> classTest;
|
std::function<bool(const typename Base::Value &)> classTest;
|
||||||
|
|
||||||
@ -119,7 +114,7 @@ namespace LogicalExpressionDetail
|
|||||||
template<typename ContainedClass>
|
template<typename ContainedClass>
|
||||||
class PossibilityVisitor
|
class PossibilityVisitor
|
||||||
{
|
{
|
||||||
typedef ExpressionBase<ContainedClass> Base;
|
using Base = ExpressionBase<ContainedClass>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::function<bool(const typename Base::Value &)> satisfiabilityTest;
|
std::function<bool(const typename Base::Value &)> satisfiabilityTest;
|
||||||
@ -167,7 +162,7 @@ namespace LogicalExpressionDetail
|
|||||||
template <typename ContainedClass>
|
template <typename ContainedClass>
|
||||||
class SatisfiabilityVisitor : public PossibilityVisitor<ContainedClass>
|
class SatisfiabilityVisitor : public PossibilityVisitor<ContainedClass>
|
||||||
{
|
{
|
||||||
typedef ExpressionBase<ContainedClass> Base;
|
using Base = ExpressionBase<ContainedClass>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SatisfiabilityVisitor(std::function<bool (const typename Base::Value &)> satisfiabilityTest,
|
SatisfiabilityVisitor(std::function<bool (const typename Base::Value &)> satisfiabilityTest,
|
||||||
@ -202,7 +197,7 @@ namespace LogicalExpressionDetail
|
|||||||
template <typename ContainedClass>
|
template <typename ContainedClass>
|
||||||
class FalsifiabilityVisitor : public PossibilityVisitor<ContainedClass>
|
class FalsifiabilityVisitor : public PossibilityVisitor<ContainedClass>
|
||||||
{
|
{
|
||||||
typedef ExpressionBase<ContainedClass> Base;
|
using Base = ExpressionBase<ContainedClass>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FalsifiabilityVisitor(std::function<bool (const typename Base::Value &)> satisfiabilityTest,
|
FalsifiabilityVisitor(std::function<bool (const typename Base::Value &)> satisfiabilityTest,
|
||||||
@ -238,8 +233,8 @@ namespace LogicalExpressionDetail
|
|||||||
template<typename ContainedClass>
|
template<typename ContainedClass>
|
||||||
class CandidatesVisitor
|
class CandidatesVisitor
|
||||||
{
|
{
|
||||||
typedef ExpressionBase<ContainedClass> Base;
|
using Base = ExpressionBase<ContainedClass>;
|
||||||
typedef std::vector<typename Base::Value> TValueList;
|
using TValueList = std::vector<typename Base::Value>;
|
||||||
|
|
||||||
TestVisitor<ContainedClass> classTest;
|
TestVisitor<ContainedClass> classTest;
|
||||||
|
|
||||||
@ -288,7 +283,7 @@ namespace LogicalExpressionDetail
|
|||||||
template<typename ContainedClass>
|
template<typename ContainedClass>
|
||||||
class ForEachVisitor
|
class ForEachVisitor
|
||||||
{
|
{
|
||||||
typedef ExpressionBase<ContainedClass> Base;
|
using Base = ExpressionBase<ContainedClass>;
|
||||||
|
|
||||||
std::function<typename Base::Variant(const typename Base::Value &)> visitor;
|
std::function<typename Base::Variant(const typename Base::Value &)> visitor;
|
||||||
|
|
||||||
@ -315,7 +310,7 @@ namespace LogicalExpressionDetail
|
|||||||
template<typename ContainedClass>
|
template<typename ContainedClass>
|
||||||
class MinimizingVisitor
|
class MinimizingVisitor
|
||||||
{
|
{
|
||||||
typedef ExpressionBase<ContainedClass> Base;
|
using Base = ExpressionBase<ContainedClass>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typename Base::Variant operator()(const typename Base::Value & element) const
|
typename Base::Variant operator()(const typename Base::Value & element) const
|
||||||
@ -360,7 +355,7 @@ namespace LogicalExpressionDetail
|
|||||||
template <typename ContainedClass>
|
template <typename ContainedClass>
|
||||||
class Reader
|
class Reader
|
||||||
{
|
{
|
||||||
typedef ExpressionBase<ContainedClass> Base;
|
using Base = ExpressionBase<ContainedClass>;
|
||||||
|
|
||||||
std::function<typename Base::Value(const JsonNode &)> classParser;
|
std::function<typename Base::Value(const JsonNode &)> classParser;
|
||||||
|
|
||||||
@ -400,7 +395,7 @@ namespace LogicalExpressionDetail
|
|||||||
template<typename ContainedClass>
|
template<typename ContainedClass>
|
||||||
class Writer
|
class Writer
|
||||||
{
|
{
|
||||||
typedef ExpressionBase<ContainedClass> Base;
|
using Base = ExpressionBase<ContainedClass>;
|
||||||
|
|
||||||
std::function<JsonNode(const typename Base::Value &)> classPrinter;
|
std::function<JsonNode(const typename Base::Value &)> classPrinter;
|
||||||
|
|
||||||
@ -445,7 +440,7 @@ namespace LogicalExpressionDetail
|
|||||||
template<typename ContainedClass>
|
template<typename ContainedClass>
|
||||||
class Printer
|
class Printer
|
||||||
{
|
{
|
||||||
typedef ExpressionBase<ContainedClass> Base;
|
using Base = ExpressionBase<ContainedClass>;
|
||||||
|
|
||||||
std::function<std::string(const typename Base::Value &)> classPrinter;
|
std::function<std::string(const typename Base::Value &)> classPrinter;
|
||||||
std::unique_ptr<TestVisitor<ContainedClass>> statusTest;
|
std::unique_ptr<TestVisitor<ContainedClass>> statusTest;
|
||||||
@ -510,30 +505,27 @@ namespace LogicalExpressionDetail
|
|||||||
template<typename ContainedClass>
|
template<typename ContainedClass>
|
||||||
class LogicalExpression
|
class LogicalExpression
|
||||||
{
|
{
|
||||||
typedef LogicalExpressionDetail::ExpressionBase<ContainedClass> Base;
|
using Base = LogicalExpressionDetail::ExpressionBase<ContainedClass>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Type of values used in expressions, same as ContainedClass
|
/// Type of values used in expressions, same as ContainedClass
|
||||||
typedef typename Base::Value Value;
|
using Value = typename Base::Value;
|
||||||
/// Operators for use in expressions, all include vectors with operands
|
/// Operators for use in expressions, all include vectors with operands
|
||||||
typedef typename Base::OperatorAny OperatorAny;
|
using OperatorAny = typename Base::OperatorAny;
|
||||||
typedef typename Base::OperatorAll OperatorAll;
|
using OperatorAll = typename Base::OperatorAll;
|
||||||
typedef typename Base::OperatorNone OperatorNone;
|
using OperatorNone = typename Base::OperatorNone;
|
||||||
/// one expression entry
|
/// one expression entry
|
||||||
typedef typename Base::Variant Variant;
|
using Variant = typename Base::Variant;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Variant data;
|
Variant data;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Base constructor
|
/// Base constructor
|
||||||
LogicalExpression()
|
LogicalExpression() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
/// Constructor from variant or (implicitly) from Operator* types
|
/// Constructor from variant or (implicitly) from Operator* types
|
||||||
LogicalExpression(const Variant & data):
|
LogicalExpression(const Variant & data): data(data) {}
|
||||||
data(data)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Constructor that receives JsonNode as input and function that can parse Value instances
|
/// Constructor that receives JsonNode as input and function that can parse Value instances
|
||||||
LogicalExpression(const JsonNode & input, std::function<Value(const JsonNode &)> parser)
|
LogicalExpression(const JsonNode & input, std::function<Value(const JsonNode &)> parser)
|
||||||
|
@ -161,8 +161,8 @@ public:
|
|||||||
|
|
||||||
ResourceSet & operator=(const TResource &rhs)
|
ResourceSet & operator=(const TResource &rhs)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < container.size(); i++)
|
for(int & i : container)
|
||||||
container.at(i) = rhs;
|
i = rhs;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ struct DLL_LINKAGE StartInfo
|
|||||||
EMode mode;
|
EMode mode;
|
||||||
ui8 difficulty; //0=easy; 4=impossible
|
ui8 difficulty; //0=easy; 4=impossible
|
||||||
|
|
||||||
typedef std::map<PlayerColor, PlayerSettings> TPlayerInfos;
|
using TPlayerInfos = std::map<PlayerColor, PlayerSettings>;
|
||||||
TPlayerInfos playerInfos; //color indexed
|
TPlayerInfos playerInfos; //color indexed
|
||||||
|
|
||||||
ui32 seedToBeUsed; //0 if not sure (client requests server to decide, will be send in reply pack)
|
ui32 seedToBeUsed; //0 if not sure (client requests server to decide, will be send in reply pack)
|
||||||
@ -84,7 +84,7 @@ struct DLL_LINKAGE StartInfo
|
|||||||
ui32 mapfileChecksum; //0 if not relevant
|
ui32 mapfileChecksum; //0 if not relevant
|
||||||
ui8 turnTime; //in minutes, 0=unlimited
|
ui8 turnTime; //in minutes, 0=unlimited
|
||||||
std::string mapname; // empty for random map, otherwise name of the map or savegame
|
std::string mapname; // empty for random map, otherwise name of the map or savegame
|
||||||
bool createRandomMap() const { return mapGenOptions.get() != nullptr; }
|
bool createRandomMap() const { return mapGenOptions != nullptr; }
|
||||||
std::shared_ptr<CMapGenOptions> mapGenOptions;
|
std::shared_ptr<CMapGenOptions> mapGenOptions;
|
||||||
|
|
||||||
std::shared_ptr<CCampaignState> campState;
|
std::shared_ptr<CCampaignState> campState;
|
||||||
|
@ -114,7 +114,7 @@ namespace vstd
|
|||||||
: unlock_guard<Mutex, detail::unlock_shared_policy<Mutex> >();
|
: unlock_guard<Mutex, detail::unlock_shared_policy<Mutex> >();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef unlock_guard<boost::shared_mutex, detail::unlock_shared_policy<boost::shared_mutex> > unlock_shared_guard;
|
using unlock_shared_guard = unlock_guard<boost::shared_mutex, detail::unlock_shared_policy<boost::shared_mutex>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
@ -21,8 +21,8 @@ class JsonNode;
|
|||||||
/// Helper class that allows generation of a ISimpleResourceLoader entry out of Json config(s)
|
/// Helper class that allows generation of a ISimpleResourceLoader entry out of Json config(s)
|
||||||
class DLL_LINKAGE CFilesystemGenerator
|
class DLL_LINKAGE CFilesystemGenerator
|
||||||
{
|
{
|
||||||
typedef std::function<void(const std::string &, const JsonNode &)> TLoadFunctor;
|
using TLoadFunctor = std::function<void(const std::string &, const JsonNode &)>;
|
||||||
typedef std::map<std::string, TLoadFunctor> TLoadFunctorMap;
|
using TLoadFunctorMap = std::map<std::string, TLoadFunctor>;
|
||||||
|
|
||||||
CFilesystemList * filesystem;
|
CFilesystemList * filesystem;
|
||||||
std::string prefix;
|
std::string prefix;
|
||||||
|
@ -241,7 +241,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<AObjectTypeHandler> TObjectTypeHandler;
|
using TObjectTypeHandler = std::shared_ptr<AObjectTypeHandler>;
|
||||||
|
|
||||||
/// Class responsible for creation of adventure map objects of specific type
|
/// Class responsible for creation of adventure map objects of specific type
|
||||||
class DLL_LINKAGE ObjectClass
|
class DLL_LINKAGE ObjectClass
|
||||||
@ -283,7 +283,7 @@ class DLL_LINKAGE CObjectClassesHandler : public IHandlerBase
|
|||||||
std::map<std::string, std::function<TObjectTypeHandler()> > handlerConstructors;
|
std::map<std::string, std::function<TObjectTypeHandler()> > handlerConstructors;
|
||||||
|
|
||||||
/// container with H3 templates, used only during loading, no need to serialize it
|
/// container with H3 templates, used only during loading, no need to serialize it
|
||||||
typedef std::multimap<std::pair<si32, si32>, std::shared_ptr<const ObjectTemplate>> TTemplatesContainer;
|
using TTemplatesContainer = std::multimap<std::pair<si32, si32>, std::shared_ptr<const ObjectTemplate>>;
|
||||||
TTemplatesContainer legacyTemplates;
|
TTemplatesContainer legacyTemplates;
|
||||||
|
|
||||||
TObjectTypeHandler loadSubObjectFromJson(const std::string & scope, const std::string & identifier, const JsonNode & entry, ObjectClass * obj, size_t index);
|
TObjectTypeHandler loadSubObjectFromJson(const std::string & scope, const std::string & identifier, const JsonNode & entry, ObjectClass * obj, size_t index);
|
||||||
|
@ -197,7 +197,7 @@ struct BankConfig
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<std::pair<ui8, IObjectInfo::CArmyStructure>> TPossibleGuards;
|
using TPossibleGuards = std::vector<std::pair<ui8, IObjectInfo::CArmyStructure>>;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct DLL_LINKAGE PossibleReward
|
struct DLL_LINKAGE PossibleReward
|
||||||
|
@ -189,11 +189,9 @@ protected:
|
|||||||
class DLL_LINKAGE CGArtifact : public CArmedInstance
|
class DLL_LINKAGE CGArtifact : public CArmedInstance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CArtifactInstance *storedArtifact;
|
CArtifactInstance * storedArtifact = nullptr;
|
||||||
std::string message;
|
std::string message;
|
||||||
|
|
||||||
CGArtifact() : CArmedInstance() {storedArtifact = nullptr;};
|
|
||||||
|
|
||||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||||
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
|
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
|
||||||
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override;
|
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override;
|
||||||
|
@ -160,7 +160,7 @@ struct DLL_LINKAGE EventCondition
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef LogicalExpression<EventCondition> EventExpression;
|
using EventExpression = LogicalExpression<EventCondition>;
|
||||||
|
|
||||||
struct DLL_LINKAGE EventEffect
|
struct DLL_LINKAGE EventEffect
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
void setUndoCallback(std::function<void(bool, bool)> functor);
|
void setUndoCallback(std::function<void(bool, bool)> functor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::list<std::unique_ptr<CMapOperation> > TStack;
|
using TStack = std::list<std::unique_ptr<CMapOperation>>;
|
||||||
|
|
||||||
void doOperation(TStack & fromStack, TStack & toStack, bool doUndo);
|
void doOperation(TStack & fromStack, TStack & toStack, bool doUndo);
|
||||||
const CMapOperation * peek(const TStack & stack) const;
|
const CMapOperation * peek(const TStack & stack) const;
|
||||||
|
@ -212,7 +212,7 @@ struct DLL_LINKAGE TerrainViewPattern
|
|||||||
class DLL_LINKAGE CTerrainViewPatternConfig : public boost::noncopyable
|
class DLL_LINKAGE CTerrainViewPatternConfig : public boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::vector<TerrainViewPattern> TVPVector;
|
using TVPVector = std::vector<TerrainViewPattern>;
|
||||||
|
|
||||||
CTerrainViewPatternConfig();
|
CTerrainViewPatternConfig();
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class RmgMap;
|
|||||||
class CMap;
|
class CMap;
|
||||||
class Zone;
|
class Zone;
|
||||||
|
|
||||||
typedef std::vector<JsonNode> JsonVector;
|
using JsonVector = std::vector<JsonNode>;
|
||||||
|
|
||||||
/// The map generator creates a map randomly.
|
/// The map generator creates a map randomly.
|
||||||
class DLL_LINKAGE CMapGenerator: public Load::Progress
|
class DLL_LINKAGE CMapGenerator: public Load::Progress
|
||||||
|
@ -22,10 +22,10 @@ class CRandomGenerator;
|
|||||||
class RmgMap;
|
class RmgMap;
|
||||||
class Zone;
|
class Zone;
|
||||||
|
|
||||||
typedef std::vector<std::pair<TRmgTemplateZoneId, std::shared_ptr<Zone>>> TZoneVector;
|
using TZoneVector = std::vector<std::pair<TRmgTemplateZoneId, std::shared_ptr<Zone>>>;
|
||||||
typedef std::map<TRmgTemplateZoneId, std::shared_ptr<Zone>> TZoneMap;
|
using TZoneMap = std::map<TRmgTemplateZoneId, std::shared_ptr<Zone>>;
|
||||||
typedef std::map<std::shared_ptr<Zone>, float3> TForceVector;
|
using TForceVector = std::map<std::shared_ptr<Zone>, float3>;
|
||||||
typedef std::map<std::shared_ptr<Zone>, float> TDistanceVector;
|
using TDistanceVector = std::map<std::shared_ptr<Zone>, float>;
|
||||||
|
|
||||||
class CZonePlacer
|
class CZonePlacer
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ class CGObjectInstance;
|
|||||||
class ObjectTemplate;
|
class ObjectTemplate;
|
||||||
class CGCreature;
|
class CGCreature;
|
||||||
|
|
||||||
typedef std::pair<int3, float> TDistance;
|
using TDistance = std::pair<int3, float>;
|
||||||
struct DistanceMaximizeFunctor
|
struct DistanceMaximizeFunctor
|
||||||
{
|
{
|
||||||
bool operator()(const TDistance & lhs, const TDistance & rhs) const
|
bool operator()(const TDistance & lhs, const TDistance & rhs) const
|
||||||
@ -42,7 +42,6 @@ public:
|
|||||||
public:
|
public:
|
||||||
MODIFICATOR(ObjectManager);
|
MODIFICATOR(ObjectManager);
|
||||||
|
|
||||||
|
|
||||||
void process() override;
|
void process() override;
|
||||||
void init() override;
|
void init() override;
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
int getWeightedObjects(const int3 & tile, const CMap * map, CRandomGenerator & rand, std::list<rmg::Object> & allObjects, std::vector<std::pair<rmg::Object*, int3>> & weightedObjects);
|
int getWeightedObjects(const int3 & tile, const CMap * map, CRandomGenerator & rand, std::list<rmg::Object> & allObjects, std::vector<std::pair<rmg::Object*, int3>> & weightedObjects);
|
||||||
|
|
||||||
typedef std::vector<std::shared_ptr<const ObjectTemplate>> ObstacleVector;
|
using ObstacleVector = std::vector<std::shared_ptr<const ObjectTemplate>>;
|
||||||
std::map<int, ObstacleVector> obstaclesBySize;
|
std::map<int, ObstacleVector> obstaclesBySize;
|
||||||
typedef std::pair<int, ObstacleVector> ObstaclePair;
|
using ObstaclePair = std::pair<int, ObstacleVector>;
|
||||||
std::vector<ObstaclePair> possibleObstacles;
|
std::vector<ObstaclePair> possibleObstacles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ protected:
|
|||||||
int3 placeMainTown(ObjectManager & manager, CGTownInstance & town);
|
int3 placeMainTown(ObjectManager & manager, CGTownInstance & town);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
int totalTowns = 0;
|
int totalTowns = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ protected:
|
|||||||
std::vector<ObjectInfo*> prepareTreasurePile(const CTreasureInfo & treasureInfo);
|
std::vector<ObjectInfo*> prepareTreasurePile(const CTreasureInfo & treasureInfo);
|
||||||
rmg::Object constructTreasurePile(const std::vector<ObjectInfo*> & treasureInfos, bool densePlacement = false);
|
rmg::Object constructTreasurePile(const std::vector<ObjectInfo*> & treasureInfos, bool densePlacement = false);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<ObjectInfo> possibleObjects;
|
std::vector<ObjectInfo> possibleObjects;
|
||||||
int minGuardedValue = 0;
|
int minGuardedValue = 0;
|
||||||
|
@ -98,7 +98,7 @@ class DLL_LINKAGE BinaryDeserializer : public CLoaderBase
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto hero = dynamic_cast<CGHeroInstance *>(armedObj);
|
auto * hero = dynamic_cast<CGHeroInstance *>(armedObj);
|
||||||
assert(hero);
|
assert(hero);
|
||||||
assert(hero->commander);
|
assert(hero->commander);
|
||||||
data = hero->commander;
|
data = hero->commander;
|
||||||
@ -158,7 +158,7 @@ class DLL_LINKAGE BinaryDeserializer : public CLoaderBase
|
|||||||
public:
|
public:
|
||||||
const std::type_info * loadPtr(CLoaderBase &ar, void *data, ui32 pid) const override //data is pointer to the ACTUAL POINTER
|
const std::type_info * loadPtr(CLoaderBase &ar, void *data, ui32 pid) const override //data is pointer to the ACTUAL POINTER
|
||||||
{
|
{
|
||||||
BinaryDeserializer &s = static_cast<BinaryDeserializer&>(ar);
|
auto & s = static_cast<BinaryDeserializer &>(ar);
|
||||||
T *&ptr = *static_cast<T**>(data);
|
T *&ptr = *static_cast<T**>(data);
|
||||||
|
|
||||||
//create new object under pointer
|
//create new object under pointer
|
||||||
@ -217,7 +217,7 @@ public:
|
|||||||
assert( fileVersion != 0 );
|
assert( fileVersion != 0 );
|
||||||
////that const cast is evil because it allows to implicitly overwrite const objects when deserializing
|
////that const cast is evil because it allows to implicitly overwrite const objects when deserializing
|
||||||
typedef typename std::remove_const<T>::type nonConstT;
|
typedef typename std::remove_const<T>::type nonConstT;
|
||||||
nonConstT &hlp = const_cast<nonConstT&>(data);
|
auto & hlp = const_cast<nonConstT &>(data);
|
||||||
hlp.serialize(*this,fileVersion);
|
hlp.serialize(*this,fileVersion);
|
||||||
}
|
}
|
||||||
template < typename T, typename std::enable_if < std::is_array<T>::value, int >::type = 0 >
|
template < typename T, typename std::enable_if < std::is_array<T>::value, int >::type = 0 >
|
||||||
@ -301,7 +301,7 @@ public:
|
|||||||
if(smartPointerSerialization)
|
if(smartPointerSerialization)
|
||||||
{
|
{
|
||||||
load( pid ); //get the id
|
load( pid ); //get the id
|
||||||
std::map<ui32, void*>::iterator i = loadedPointers.find(pid); //lookup
|
auto i = loadedPointers.find(pid); //lookup
|
||||||
|
|
||||||
if(i != loadedPointers.end())
|
if(i != loadedPointers.end())
|
||||||
{
|
{
|
||||||
@ -327,7 +327,7 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto app = applier.getApplier(tid);
|
auto * app = applier.getApplier(tid);
|
||||||
if(app == nullptr)
|
if(app == nullptr)
|
||||||
{
|
{
|
||||||
logGlobal->error("load %d %d - no loader exists", tid, pid);
|
logGlobal->error("load %d %d - no loader exists", tid, pid);
|
||||||
|
@ -100,7 +100,7 @@ class DLL_LINKAGE BinarySerializer : public CSaverBase
|
|||||||
public:
|
public:
|
||||||
void savePtr(CSaverBase &ar, const void *data) const override
|
void savePtr(CSaverBase &ar, const void *data) const override
|
||||||
{
|
{
|
||||||
BinarySerializer &s = static_cast<BinarySerializer&>(ar);
|
auto & s = static_cast<BinarySerializer &>(ar);
|
||||||
const T *ptr = static_cast<const T*>(data);
|
const T *ptr = static_cast<const T*>(data);
|
||||||
|
|
||||||
//T is most derived known type, it's time to call actual serialize
|
//T is most derived known type, it's time to call actual serialize
|
||||||
@ -210,7 +210,7 @@ public:
|
|||||||
// We might have an object that has multiple inheritance and store it via the non-first base pointer.
|
// We might have an object that has multiple inheritance and store it via the non-first base pointer.
|
||||||
// Therefore, all pointers need to be normalized to the actual object address.
|
// Therefore, all pointers need to be normalized to the actual object address.
|
||||||
auto actualPointer = typeList.castToMostDerived(data);
|
auto actualPointer = typeList.castToMostDerived(data);
|
||||||
std::map<const void*,ui32>::iterator i = savedPointers.find(actualPointer);
|
auto i = savedPointers.find(actualPointer);
|
||||||
if(i != savedPointers.end())
|
if(i != savedPointers.end())
|
||||||
{
|
{
|
||||||
//this pointer has been already serialized - write only it's id
|
//this pointer has been already serialized - write only it's id
|
||||||
@ -275,28 +275,28 @@ public:
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void save(const std::set<T> &data)
|
void save(const std::set<T> &data)
|
||||||
{
|
{
|
||||||
std::set<T> &d = const_cast<std::set<T> &>(data);
|
auto & d = const_cast<std::set<T> &>(data);
|
||||||
ui32 length = (ui32)d.size();
|
ui32 length = (ui32)d.size();
|
||||||
save(length);
|
save(length);
|
||||||
for(typename std::set<T>::iterator i=d.begin();i!=d.end();i++)
|
for(auto i = d.begin(); i != d.end(); i++)
|
||||||
save(*i);
|
save(*i);
|
||||||
}
|
}
|
||||||
template <typename T, typename U>
|
template <typename T, typename U>
|
||||||
void save(const std::unordered_set<T, U> &data)
|
void save(const std::unordered_set<T, U> &data)
|
||||||
{
|
{
|
||||||
std::unordered_set<T, U> &d = const_cast<std::unordered_set<T, U> &>(data);
|
auto & d = const_cast<std::unordered_set<T, U> &>(data);
|
||||||
ui32 length = (ui32)d.size();
|
ui32 length = (ui32)d.size();
|
||||||
*this & length;
|
*this & length;
|
||||||
for(typename std::unordered_set<T, U>::iterator i=d.begin();i!=d.end();i++)
|
for(auto i = d.begin(); i != d.end(); i++)
|
||||||
save(*i);
|
save(*i);
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void save(const std::list<T> &data)
|
void save(const std::list<T> &data)
|
||||||
{
|
{
|
||||||
std::list<T> &d = const_cast<std::list<T> &>(data);
|
auto & d = const_cast<std::list<T> &>(data);
|
||||||
ui32 length = (ui32)d.size();
|
ui32 length = (ui32)d.size();
|
||||||
*this & length;
|
*this & length;
|
||||||
for(typename std::list<T>::iterator i=d.begin();i!=d.end();i++)
|
for(auto i = d.begin(); i != d.end(); i++)
|
||||||
save(*i);
|
save(*i);
|
||||||
}
|
}
|
||||||
void save(const std::string &data)
|
void save(const std::string &data)
|
||||||
@ -314,7 +314,7 @@ public:
|
|||||||
void save(const std::map<T1,T2> &data)
|
void save(const std::map<T1,T2> &data)
|
||||||
{
|
{
|
||||||
*this & ui32(data.size());
|
*this & ui32(data.size());
|
||||||
for(typename std::map<T1,T2>::const_iterator i=data.begin();i!=data.end();i++)
|
for(auto i = data.begin(); i != data.end(); i++)
|
||||||
{
|
{
|
||||||
save(i->first);
|
save(i->first);
|
||||||
save(i->second);
|
save(i->second);
|
||||||
@ -324,7 +324,7 @@ public:
|
|||||||
void save(const std::multimap<T1, T2> &data)
|
void save(const std::multimap<T1, T2> &data)
|
||||||
{
|
{
|
||||||
*this & ui32(data.size());
|
*this & ui32(data.size());
|
||||||
for(typename std::map<T1, T2>::const_iterator i = data.begin(); i != data.end(); i++)
|
for(auto i = data.begin(); i != data.end(); i++)
|
||||||
{
|
{
|
||||||
save(i->first);
|
save(i->first);
|
||||||
save(i->second);
|
save(i->second);
|
||||||
|
@ -76,7 +76,7 @@ class DLL_LINKAGE CSerializer
|
|||||||
vectors[&typeid(T)] = VectorizedObjectInfo<T, U>(Vector, idRetriever);
|
vectors[&typeid(T)] = VectorizedObjectInfo<T, U>(Vector, idRetriever);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::map<const std::type_info *, std::any, TypeComparer> TTypeVecMap;
|
using TTypeVecMap = std::map<const std::type_info *, std::any, TypeComparer>;
|
||||||
TTypeVecMap vectors; //entry must be a pointer to vector containing pointers to the objects of key type
|
TTypeVecMap vectors; //entry must be a pointer to vector containing pointers to the objects of key type
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
|
|
||||||
myType = &typeid(T);
|
myType = &typeid(T);
|
||||||
|
|
||||||
TTypeVecMap::iterator i = vectors.find(myType);
|
auto i = vectors.find(myType);
|
||||||
if(i == vectors.end())
|
if(i == vectors.end())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
else
|
else
|
||||||
@ -134,8 +134,8 @@ public:
|
|||||||
template<class S, class T>
|
template<class S, class T>
|
||||||
struct is_serializeable
|
struct is_serializeable
|
||||||
{
|
{
|
||||||
typedef char (&Yes)[1];
|
using Yes = char (&)[1];
|
||||||
typedef char (&No)[2];
|
using No = char (&)[2];
|
||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
static Yes test(U * data, S* arg1 = 0,
|
static Yes test(U * data, S* arg1 = 0,
|
||||||
@ -149,42 +149,42 @@ struct is_serializeable
|
|||||||
template <typename T> //metafunction returning CGObjectInstance if T is its derivate or T elsewise
|
template <typename T> //metafunction returning CGObjectInstance if T is its derivate or T elsewise
|
||||||
struct VectorizedTypeFor
|
struct VectorizedTypeFor
|
||||||
{
|
{
|
||||||
typedef typename
|
using type = typename
|
||||||
//if
|
//if
|
||||||
boost::mpl::eval_if<std::is_same<CGHeroInstance,T>,
|
boost::mpl::eval_if<std::is_same<CGHeroInstance, T>,
|
||||||
boost::mpl::identity<CGHeroInstance>,
|
boost::mpl::identity<CGHeroInstance>,
|
||||||
//else if
|
//else if
|
||||||
boost::mpl::eval_if<std::is_base_of<CGObjectInstance,T>,
|
boost::mpl::eval_if<std::is_base_of<CGObjectInstance, T>,
|
||||||
boost::mpl::identity<CGObjectInstance>,
|
boost::mpl::identity<CGObjectInstance>,
|
||||||
//else
|
//else
|
||||||
boost::mpl::identity<T>
|
boost::mpl::identity<T>
|
||||||
> >::type type;
|
>>::type;
|
||||||
};
|
};
|
||||||
template <typename U>
|
template <typename U>
|
||||||
struct VectorizedIDType
|
struct VectorizedIDType
|
||||||
{
|
{
|
||||||
typedef typename
|
using type = typename
|
||||||
//if
|
//if
|
||||||
boost::mpl::eval_if<std::is_same<CArtifact,U>,
|
boost::mpl::eval_if<std::is_same<CArtifact, U>,
|
||||||
boost::mpl::identity<ArtifactID>,
|
boost::mpl::identity<ArtifactID>,
|
||||||
//else if
|
//else if
|
||||||
boost::mpl::eval_if<std::is_same<CCreature,U>,
|
boost::mpl::eval_if<std::is_same<CCreature, U>,
|
||||||
boost::mpl::identity<CreatureID>,
|
boost::mpl::identity<CreatureID>,
|
||||||
//else if
|
//else if
|
||||||
boost::mpl::eval_if<std::is_same<CHero,U>,
|
boost::mpl::eval_if<std::is_same<CHero, U>,
|
||||||
boost::mpl::identity<HeroTypeID>,
|
boost::mpl::identity<HeroTypeID>,
|
||||||
//else if
|
//else if
|
||||||
boost::mpl::eval_if<std::is_same<CArtifactInstance,U>,
|
boost::mpl::eval_if<std::is_same<CArtifactInstance, U>,
|
||||||
boost::mpl::identity<ArtifactInstanceID>,
|
boost::mpl::identity<ArtifactInstanceID>,
|
||||||
//else if
|
//else if
|
||||||
boost::mpl::eval_if<std::is_same<CGHeroInstance,U>,
|
boost::mpl::eval_if<std::is_same<CGHeroInstance, U>,
|
||||||
boost::mpl::identity<HeroTypeID>,
|
boost::mpl::identity<HeroTypeID>,
|
||||||
//else if
|
//else if
|
||||||
boost::mpl::eval_if<std::is_base_of<CGObjectInstance,U>,
|
boost::mpl::eval_if<std::is_base_of<CGObjectInstance, U>,
|
||||||
boost::mpl::identity<ObjectInstanceID>,
|
boost::mpl::identity<ObjectInstanceID>,
|
||||||
//else
|
//else
|
||||||
boost::mpl::identity<si32>
|
boost::mpl::identity<si32>
|
||||||
> > > > > >::type type;
|
>>>>>>::type;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Base class for deserializers
|
/// Base class for deserializers
|
||||||
|
@ -66,17 +66,18 @@ class DLL_LINKAGE CTypeList: public boost::noncopyable
|
|||||||
{
|
{
|
||||||
//public:
|
//public:
|
||||||
struct TypeDescriptor;
|
struct TypeDescriptor;
|
||||||
typedef std::shared_ptr<TypeDescriptor> TypeInfoPtr;
|
using TypeInfoPtr = std::shared_ptr<TypeDescriptor>;
|
||||||
typedef std::weak_ptr<TypeDescriptor> WeakTypeInfoPtr;
|
using WeakTypeInfoPtr = std::weak_ptr<TypeDescriptor>;
|
||||||
struct TypeDescriptor
|
struct TypeDescriptor
|
||||||
{
|
{
|
||||||
ui16 typeID;
|
ui16 typeID;
|
||||||
const char *name;
|
const char *name;
|
||||||
std::vector<WeakTypeInfoPtr> children, parents;
|
std::vector<WeakTypeInfoPtr> children, parents;
|
||||||
};
|
};
|
||||||
typedef boost::shared_mutex TMutex;
|
using TMutex = boost::shared_mutex;
|
||||||
typedef boost::unique_lock<TMutex> TUniqueLock;
|
using TUniqueLock = boost::unique_lock<TMutex>;
|
||||||
typedef boost::shared_lock<TMutex> TSharedLock;
|
using TSharedLock = boost::shared_lock<TMutex>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable TMutex mx;
|
mutable TMutex mx;
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ private:
|
|||||||
if(!casters.count(castingPair))
|
if(!casters.count(castingPair))
|
||||||
THROW_FORMAT("Cannot find caster for conversion %s -> %s which is needed to cast %s -> %s", from->name % to->name % fromArg->name() % toArg->name());
|
THROW_FORMAT("Cannot find caster for conversion %s -> %s which is needed to cast %s -> %s", from->name % to->name % fromArg->name() % toArg->name());
|
||||||
|
|
||||||
auto &caster = casters.at(castingPair);
|
const auto & caster = casters.at(castingPair);
|
||||||
ptr = (*caster.*CastingFunction)(ptr); //Why does unique_ptr not have operator->* ..?
|
ptr = (*caster.*CastingFunction)(ptr); //Why does unique_ptr not have operator->* ..?
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +151,7 @@ public:
|
|||||||
template<typename TInput>
|
template<typename TInput>
|
||||||
void * castToMostDerived(const TInput * inputPtr) const
|
void * castToMostDerived(const TInput * inputPtr) const
|
||||||
{
|
{
|
||||||
auto &baseType = typeid(typename std::remove_cv<TInput>::type);
|
const auto & baseType = typeid(typename std::remove_cv<TInput>::type);
|
||||||
auto derivedType = getTypeInfo(inputPtr);
|
auto derivedType = getTypeInfo(inputPtr);
|
||||||
|
|
||||||
if (strcmp(baseType.name(), derivedType->name()) == 0)
|
if (strcmp(baseType.name(), derivedType->name()) == 0)
|
||||||
@ -166,7 +167,7 @@ public:
|
|||||||
template<typename TInput>
|
template<typename TInput>
|
||||||
std::any castSharedToMostDerived(const std::shared_ptr<TInput> inputPtr) const
|
std::any castSharedToMostDerived(const std::shared_ptr<TInput> inputPtr) const
|
||||||
{
|
{
|
||||||
auto &baseType = typeid(typename std::remove_cv<TInput>::type);
|
const auto & baseType = typeid(typename std::remove_cv<TInput>::type);
|
||||||
auto derivedType = getTypeInfo(inputPtr.get());
|
auto derivedType = getTypeInfo(inputPtr.get());
|
||||||
|
|
||||||
if (!strcmp(baseType.name(), derivedType->name()))
|
if (!strcmp(baseType.name(), derivedType->name()))
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
#if BOOST_VERSION >= 107000 // Boost version >= 1.70
|
#if BOOST_VERSION >= 107000 // Boost version >= 1.70
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp > TSocket;
|
using TSocket = boost::asio::basic_stream_socket<boost::asio::ip::tcp>;
|
||||||
typedef boost::asio::basic_socket_acceptor < boost::asio::ip::tcp > TAcceptor;
|
using TAcceptor = boost::asio::basic_socket_acceptor<boost::asio::ip::tcp>;
|
||||||
#else
|
#else
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
@ -461,7 +461,7 @@ private:
|
|||||||
void doSerializeInternal(const std::string & fieldName, VType & value, const std::optional<DVType> & defaultValue, Args... args)
|
void doSerializeInternal(const std::string & fieldName, VType & value, const std::optional<DVType> & defaultValue, Args... args)
|
||||||
{
|
{
|
||||||
const std::optional<IType> tempDefault = defaultValue ? std::optional<IType>(static_cast<IType>(defaultValue.value())) : std::nullopt;
|
const std::optional<IType> tempDefault = defaultValue ? std::optional<IType>(static_cast<IType>(defaultValue.value())) : std::nullopt;
|
||||||
IType temp = static_cast<IType>(value);
|
auto temp = static_cast<IType>(value);
|
||||||
|
|
||||||
serializeInternal(fieldName, temp, tempDefault, args...);
|
serializeInternal(fieldName, temp, tempDefault, args...);
|
||||||
|
|
||||||
@ -476,7 +476,7 @@ private:
|
|||||||
{
|
{
|
||||||
if(value)
|
if(value)
|
||||||
{
|
{
|
||||||
IType temp = static_cast<IType>(value.value());
|
auto temp = static_cast<IType>(value.value());
|
||||||
pushField(fieldName);
|
pushField(fieldName);
|
||||||
serializeInternal(temp, args...);
|
serializeInternal(temp, args...);
|
||||||
pop();
|
pop();
|
||||||
@ -518,7 +518,7 @@ void JsonArraySerializer::syncSize(Container & c, JsonNode::JsonType type)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void JsonArraySerializer::serializeInt(const size_t index, T & value)
|
void JsonArraySerializer::serializeInt(const size_t index, T & value)
|
||||||
{
|
{
|
||||||
int64_t temp = static_cast<int64_t>(value);
|
auto temp = static_cast<int64_t>(value);
|
||||||
|
|
||||||
serializeInt64(index, temp);
|
serializeInt64(index, temp);
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef AnimationItem TAnimation;
|
using TAnimation = AnimationItem;
|
||||||
typedef std::vector<TAnimation> TAnimationQueue;
|
using TAnimationQueue = std::vector<TAnimation>;
|
||||||
|
|
||||||
struct DLL_LINKAGE AnimationInfo
|
struct DLL_LINKAGE AnimationInfo
|
||||||
{
|
{
|
||||||
|
@ -34,13 +34,13 @@ PACKED_STRUCT_BEGIN struct unaligned_Uint32 { ui32 val; } PACKED_STRUCT_END;
|
|||||||
|
|
||||||
static inline ui16 read_unaligned_u16(const void *p)
|
static inline ui16 read_unaligned_u16(const void *p)
|
||||||
{
|
{
|
||||||
const struct unaligned_Uint16 *v = reinterpret_cast<const struct unaligned_Uint16 *>(p);
|
const auto * v = reinterpret_cast<const struct unaligned_Uint16 *>(p);
|
||||||
return v->val;
|
return v->val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline ui32 read_unaligned_u32(const void *p)
|
static inline ui32 read_unaligned_u32(const void *p)
|
||||||
{
|
{
|
||||||
const struct unaligned_Uint32 *v = reinterpret_cast<const struct unaligned_Uint32 *>(p);
|
const auto * v = reinterpret_cast<const struct unaligned_Uint32 *>(p);
|
||||||
return v->val;
|
return v->val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ struct Gens : Gens<N-1, N-1, S...> {};
|
|||||||
template<int ...S>
|
template<int ...S>
|
||||||
struct Gens<0, S...>
|
struct Gens<0, S...>
|
||||||
{
|
{
|
||||||
typedef Seq<S...> type;
|
using type = Seq<S...>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename ... Args>
|
template <typename R, typename ... Args>
|
||||||
|
@ -100,7 +100,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UData * ptr = static_cast<UData *>(raw);
|
auto * ptr = static_cast<UData *>(raw);
|
||||||
*ptr = value;
|
*ptr = value;
|
||||||
|
|
||||||
luaL_getmetatable(L, KEY);
|
luaL_getmetatable(L, KEY);
|
||||||
|
@ -79,8 +79,8 @@ public:
|
|||||||
|
|
||||||
struct CasualtiesAfterBattle
|
struct CasualtiesAfterBattle
|
||||||
{
|
{
|
||||||
typedef std::pair<StackLocation, int> TStackAndItsNewCount;
|
using TStackAndItsNewCount = std::pair<StackLocation, int>;
|
||||||
typedef std::map<CreatureID, TQuantity> TSummoned;
|
using TSummoned = std::map<CreatureID, TQuantity>;
|
||||||
enum {ERASE = -1};
|
enum {ERASE = -1};
|
||||||
const CArmedInstance * army;
|
const CArmedInstance * army;
|
||||||
std::vector<TStackAndItsNewCount> newStackCounts;
|
std::vector<TStackAndItsNewCount> newStackCounts;
|
||||||
|
@ -26,7 +26,7 @@ class CObjectVisitQuery;
|
|||||||
class CQuery;
|
class CQuery;
|
||||||
class Queries;
|
class Queries;
|
||||||
|
|
||||||
typedef std::shared_ptr<CQuery> QueryPtr;
|
using QueryPtr = std::shared_ptr<CQuery>;
|
||||||
|
|
||||||
// This class represents any kind of prolonged interaction that may need to do something special after it is over.
|
// This class represents any kind of prolonged interaction that may need to do something special after it is over.
|
||||||
// It does not necessarily has to be "query" requiring player action, it can be also used internally within server.
|
// It does not necessarily has to be "query" requiring player action, it can be also used internally within server.
|
||||||
|
Reference in New Issue
Block a user