1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Add workaround for visiting Altar of Sacrifice on 1.4 saves

This commit is contained in:
Ivan Savenko 2024-05-11 13:09:12 +00:00
parent 16f43254b5
commit 1bc7c29111
2 changed files with 12 additions and 0 deletions

View File

@ -87,6 +87,7 @@
#include "../lib/gameState/CGameState.h"
#include "../lib/mapObjects/CGMarket.h"
#include "../lib/mapObjects/CGTownInstance.h"
#include "../lib/mapObjects/MiscObjects.h"
#include "../lib/mapObjects/ObjectTemplate.h"
@ -1659,6 +1660,15 @@ void CPlayerInterface::showMarketWindow(const IMarket *market, const CGHeroInsta
cb->selectionMade(0, queryID);
};
if (market->allowsTrade(EMarketMode::ARTIFACT_EXP) && dynamic_cast<const CGArtifactsAltar*>(market) == nullptr)
{
// compatibility check, safe to remove for 1.6
// 1.4 saves loaded in 1.5 will not be able to visit Altar of Sacrifice due to Altar now requiring different map object class
static_assert(ESerializationVersion::RELEASE_143 < ESerializationVersion::CURRENT, "Please remove this compatibility check once it no longer needed");
onWindowClosed();
return;
}
if(market->allowsTrade(EMarketMode::ARTIFACT_EXP) && visitor->getAlignment() != EAlignment::EVIL)
GH.windows().createAndPushWindow<CMarketWindow>(market, visitor, onWindowClosed, EMarketMode::ARTIFACT_EXP);
else if(market->allowsTrade(EMarketMode::CREATURE_EXP) && visitor->getAlignment() != EAlignment::GOOD)

View File

@ -42,5 +42,7 @@ enum class ESerializationVersion : int32_t
TURN_TIMERS_STATE, // 839 current state of turn timers is serialized
ARTIFACT_COSTUMES, // 840 swappable artifacts set added
RELEASE_150 = ARTIFACT_COSTUMES, // for convenience
CURRENT = ARTIFACT_COSTUMES
};