Explorar o código

vcmi: bump max serialization version

And also - now we can choose between 3 states for rewardables
actually.
Konstantin %!s(int64=2) %!d(string=hai) anos
pai
achega
fafe352f93

+ 5 - 2
lib/mapObjects/CRewardableConstructor.cpp

@@ -230,8 +230,11 @@ void CRandomRewardObjectInfo::configureObject(CRewardableObject * object, CRando
 	configureResetInfo(object, rng, object->resetParameters, parameters["resetParameters"]);
 	configureResetInfo(object, rng, object->resetParameters, parameters["resetParameters"]);
 
 
 	object->canRefuse = parameters["canRefuse"].Bool();
 	object->canRefuse = parameters["canRefuse"].Bool();
-	
-	object->showInInfobox = parameters["showInInfobox"].Bool();
+
+	if(parameters["showInInfobox"].isNull())
+		object->infoWindowType = EInfoWindowMode::AUTO;
+	else
+		object->infoWindowType = parameters["showInInfobox"].Bool() ? EInfoWindowMode::INFO : EInfoWindowMode::MODAL;
 	
 	
 	auto visitMode = parameters["visitMode"].String();
 	auto visitMode = parameters["visitMode"].String();
 	for(int i = 0; i < Rewardable::VisitModeString.size(); ++i)
 	for(int i = 0; i < Rewardable::VisitModeString.size(); ++i)

+ 3 - 4
lib/mapObjects/CRewardableObject.cpp

@@ -134,15 +134,14 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const
 	{
 	{
 		auto vi = info[index];
 		auto vi = info[index];
 		logGlobal->debug("Granting reward %d. Message says: %s", index, vi.message.toString());
 		logGlobal->debug("Granting reward %d. Message says: %s", index, vi.message.toString());
-		if (showInInfobox || !vi.message.toString().empty()) // show message only if it is not empty or in infobox
+ 		// show message only if it is not empty or in infobox
+		if (infoWindowType != EInfoWindowMode::MODAL || !vi.message.toString().empty())
 		{
 		{
 			InfoWindow iw;
 			InfoWindow iw;
 			iw.player = h->tempOwner;
 			iw.player = h->tempOwner;
 			iw.text = vi.message;
 			iw.text = vi.message;
 			vi.reward.loadComponents(iw.components, h);
 			vi.reward.loadComponents(iw.components, h);
-			iw.type = EInfoWindowMode::AUTO;
-			if(showInInfobox)
-				iw.type = EInfoWindowMode::INFO;
+			iw.type = infoWindowType;
 			cb->showInfoDialog(&iw);
 			cb->showInfoDialog(&iw);
 		}
 		}
 		// grant reward afterwards. Note that it may remove object
 		// grant reward afterwards. Note that it may remove object

+ 3 - 2
lib/mapObjects/CRewardableObject.h

@@ -307,7 +307,7 @@ protected:
 	bool canRefuse;
 	bool canRefuse;
 
 
 	/// if true - object info will shown in infobox (like resource pickup)
 	/// if true - object info will shown in infobox (like resource pickup)
-	bool showInInfobox;
+	EInfoWindowMode infoWindowType = EInfoWindowMode::AUTO;
 
 
 	/// return true if this object was "cleared" before and no longer has rewards applicable to selected hero
 	/// return true if this object was "cleared" before and no longer has rewards applicable to selected hero
 	/// unlike wasVisited, this method uses information not available to player owner, for example, if object was cleared by another player before
 	/// unlike wasVisited, this method uses information not available to player owner, for example, if object was cleared by another player before
@@ -348,13 +348,14 @@ public:
 		h & static_cast<CArmedInstance&>(*this);
 		h & static_cast<CArmedInstance&>(*this);
 		h & info;
 		h & info;
 		h & canRefuse;
 		h & canRefuse;
-		h & showInInfobox;
 		h & resetParameters;
 		h & resetParameters;
 		h & onSelect;
 		h & onSelect;
 		h & visitMode;
 		h & visitMode;
 		h & selectMode;
 		h & selectMode;
 		h & selectedReward;
 		h & selectedReward;
 		h & onceVisitableObjectCleared;
 		h & onceVisitableObjectCleared;
+		if (version >= 817)
+			h & infoWindowType;
 	}
 	}
 
 
 	// for configuration/object setup
 	// for configuration/object setup

+ 1 - 1
lib/serializer/CSerializer.h

@@ -14,7 +14,7 @@
 
 
 VCMI_LIB_NAMESPACE_BEGIN
 VCMI_LIB_NAMESPACE_BEGIN
 
 
-const ui32 SERIALIZATION_VERSION = 816;
+const ui32 SERIALIZATION_VERSION = 817;
 const ui32 MINIMAL_SERIALIZATION_VERSION = 813;
 const ui32 MINIMAL_SERIALIZATION_VERSION = 813;
 const std::string SAVEGAME_MAGIC = "VCMISVG";
 const std::string SAVEGAME_MAGIC = "VCMISVG";