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

Fix map saving

This commit is contained in:
Michał Zaremba
2025-06-15 00:09:22 +02:00
parent bf11b9b82a
commit 9e474422fd
2 changed files with 8 additions and 3 deletions

View File

@@ -18,6 +18,7 @@
#include "../callback/IGameInfoCallback.h"
#include "../callback/IGameEventCallback.h"
#include "../callback/IGameRandomizer.h"
#include "../callback/EditorCallback.h"
#include "../texts/CGeneralTextHandler.h"
#include "../TerrainHandler.h"
#include "../RoadHandler.h"
@@ -1715,7 +1716,12 @@ void CGHeroInstance::serializeCommonOptions(JsonSerializeFormat & handler)
handler.serializeIdArray("spellBook", spells);
if(handler.saving)
CArtifactSet::serializeJsonArtifacts(handler, "artifacts", &cb->gameState().getMap());
{
if(auto * ecb = dynamic_cast<EditorCallback *>(cb))
CArtifactSet::serializeJsonArtifacts(handler, "artifacts", const_cast<CMap *>(ecb->getMapConstPtr()));
else
CArtifactSet::serializeJsonArtifacts(handler, "artifacts", &cb->gameState().getMap());
}
}
void CGHeroInstance::serializeJsonOptions(JsonSerializeFormat & handler)