diff --git a/lib/mapObjects/CRewardableConstructor.cpp b/lib/mapObjects/CRewardableConstructor.cpp index 1ed10ed31..7e860c074 100644 --- a/lib/mapObjects/CRewardableConstructor.cpp +++ b/lib/mapObjects/CRewardableConstructor.cpp @@ -230,8 +230,11 @@ void CRandomRewardObjectInfo::configureObject(CRewardableObject * object, CRando configureResetInfo(object, rng, object->resetParameters, parameters["resetParameters"]); 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(); for(int i = 0; i < Rewardable::VisitModeString.size(); ++i) diff --git a/lib/mapObjects/CRewardableObject.cpp b/lib/mapObjects/CRewardableObject.cpp index c3eb189f5..1d3138582 100644 --- a/lib/mapObjects/CRewardableObject.cpp +++ b/lib/mapObjects/CRewardableObject.cpp @@ -134,15 +134,14 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const { auto vi = info[index]; 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; iw.player = h->tempOwner; iw.text = vi.message; vi.reward.loadComponents(iw.components, h); - iw.type = EInfoWindowMode::AUTO; - if(showInInfobox) - iw.type = EInfoWindowMode::INFO; + iw.type = infoWindowType; cb->showInfoDialog(&iw); } // grant reward afterwards. Note that it may remove object diff --git a/lib/mapObjects/CRewardableObject.h b/lib/mapObjects/CRewardableObject.h index 03004da74..c120abfa9 100644 --- a/lib/mapObjects/CRewardableObject.h +++ b/lib/mapObjects/CRewardableObject.h @@ -307,7 +307,7 @@ protected: bool canRefuse; /// 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 /// 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(*this); h & info; h & canRefuse; - h & showInInfobox; h & resetParameters; h & onSelect; h & visitMode; h & selectMode; h & selectedReward; h & onceVisitableObjectCleared; + if (version >= 817) + h & infoWindowType; } // for configuration/object setup diff --git a/lib/serializer/CSerializer.h b/lib/serializer/CSerializer.h index 9b12c3c97..e595fadd5 100644 --- a/lib/serializer/CSerializer.h +++ b/lib/serializer/CSerializer.h @@ -14,7 +14,7 @@ VCMI_LIB_NAMESPACE_BEGIN -const ui32 SERIALIZATION_VERSION = 816; +const ui32 SERIALIZATION_VERSION = 817; const ui32 MINIMAL_SERIALIZATION_VERSION = 813; const std::string SAVEGAME_MAGIC = "VCMISVG";