1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

fixed serialization issues

This commit is contained in:
Henning Koehler 2017-09-10 15:20:47 +12:00
parent 3e0022be27
commit d594845c32
3 changed files with 17 additions and 1 deletions

View File

@ -1565,6 +1565,16 @@ void LimiterList::add( TLimiterPtr limiter )
limiters.push_back(limiter);
}
// Updaters
IUpdater::~IUpdater()
{
}
ScalingUpdater::ScalingUpdater() : valPer20(0), stepSize(1)
{
}
ScalingUpdater::ScalingUpdater(int valPer20, int stepSize) : valPer20(valPer20), stepSize(stepSize)
{
}

View File

@ -1020,6 +1020,8 @@ void BonusList::insert(const int position, InputIterator first, InputIterator la
class DLL_LINKAGE IUpdater
{
public:
virtual ~IUpdater();
virtual bool update(Bonus & b, const CBonusSystemNode & context) const = 0;
template <typename Handler> void serialize(Handler &h, const int version)
@ -1032,11 +1034,12 @@ struct DLL_LINKAGE ScalingUpdater : public IUpdater
int valPer20;
int stepSize;
ScalingUpdater();
ScalingUpdater(int valPer20, int stepSize = 1);
template <typename Handler> void serialize(Handler &h, const int version)
{
IUpdater::serialize(h, version);
h & static_cast<IUpdater &>(*this);
h & valPer20;
h & stepSize;
}

View File

@ -181,6 +181,9 @@ void registerTypesMapObjects2(Serializer &s)
s.template registerType<ILimiter, RankRangeLimiter>();
s.template registerType<ILimiter, StackOwnerLimiter>();
// Updaters
s.template registerType<IUpdater, ScalingUpdater>();
// s.template registerType<CBonusSystemNode>();
s.template registerType<CBonusSystemNode, CArtifact>();
s.template registerType<CArtifact, CGrowingArtifact>();