1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fix campaigns progression

This commit is contained in:
Ivan Savenko
2025-04-18 19:10:47 +03:00
parent a43c3fcb31
commit a89cf280e3
3 changed files with 22 additions and 2 deletions

View File

@@ -394,6 +394,9 @@ void CGameStateCampaign::transferMissingArtifacts(const CampaignTravel & travelO
for(auto hero : gameState->map->getObjects<CGHeroInstance>()) for(auto hero : gameState->map->getObjects<CGHeroInstance>())
{ {
if (!hero->getOwner().isValidPlayer())
continue; // prisons
if (gameState->getPlayerState(hero->getOwner())->isHuman()) if (gameState->getPlayerState(hero->getOwner())->isHuman())
{ {
receiver = hero; receiver = hero;

View File

@@ -67,9 +67,22 @@ public:
std::unique_ptr<CMap> getCurrentMap(); std::unique_ptr<CMap> getCurrentMap();
template <typename Handler> void serialize(Handler &h) template <typename Handler> void serialize(Handler &h)
{
if (h.saving || h.hasFeature(Handler::Version::NO_RAW_POINTERS_IN_SERIALIZER))
{ {
// no-op, but needed to auto-create this class if gamestate had it during serialization // no-op, but needed to auto-create this class if gamestate had it during serialization
} }
else
{
bool dummyA = false;
uint32_t dummyB = 0;
uint16_t dummyC = 0;
h & dummyA;
h & dummyB;
h & dummyC;
}
}
}; };
VCMI_LIB_NAMESPACE_END VCMI_LIB_NAMESPACE_END

View File

@@ -2040,7 +2040,11 @@ std::shared_ptr<CGObjectInstance> CMapLoaderH3M::readHero(const int3 & mapPositi
//If hero of this type has been predefined, use that as a base. //If hero of this type has been predefined, use that as a base.
//Instance data will overwrite the predefined values where appropriate. //Instance data will overwrite the predefined values where appropriate.
auto object = map->tryTakeFromHeroPool(heroType); std::shared_ptr<CGHeroInstance> object;
if (heroType.hasValue())
object = map->tryTakeFromHeroPool(heroType);
if (!object) if (!object)
{ {
object = std::make_shared<CGHeroInstance>(map->cb); object = std::make_shared<CGHeroInstance>(map->cb);