1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

vcmi: bump max serialization version

And also - now we can choose between 3 states for rewardables
actually.
This commit is contained in:
Konstantin
2023-03-11 21:18:01 +03:00
parent 4c31db52be
commit fafe352f93
4 changed files with 12 additions and 9 deletions

View File

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

View File

@@ -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; iw.type = infoWindowType;
if(showInInfobox)
iw.type = EInfoWindowMode::INFO;
cb->showInfoDialog(&iw); cb->showInfoDialog(&iw);
} }
// grant reward afterwards. Note that it may remove object // grant reward afterwards. Note that it may remove object

View File

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

View File

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