Procházet zdrojové kódy

fixed serialization issues

Henning Koehler před 8 roky
rodič
revize
d594845c32
3 změnil soubory, kde provedl 17 přidání a 1 odebrání
  1. 10 0
      lib/HeroBonus.cpp
  2. 4 1
      lib/HeroBonus.h
  3. 3 0
      lib/registerTypes/RegisterTypes.h

+ 10 - 0
lib/HeroBonus.cpp

@@ -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)
 {
 }

+ 4 - 1
lib/HeroBonus.h

@@ -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;
 	}

+ 3 - 0
lib/registerTypes/RegisterTypes.h

@@ -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>();