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

fix serialisation

This commit is contained in:
Laserlicht
2025-11-09 06:41:06 +01:00
parent 34af1433e6
commit 07621f795c
2 changed files with 22 additions and 5 deletions

View File

@@ -76,9 +76,20 @@ BattleOnlyModeTab::BattleOnlyModeTab()
{
OBJECT_CONSTRUCTION;
//JsonNode node = persistentStorage["lobby"]["battleModeSettings"];
//JsonDeserializer handler(nullptr, node);
//startInfo->serializeJson(handler);
try
{
JsonNode node = persistentStorage["battleModeSettings"];
if(!node.isNull())
{
node.setModScope(ModScope::scopeGame());
JsonDeserializer handler(nullptr, node);
startInfo->serializeJson(handler);
}
}
catch(std::exception & e)
{
logGlobal->error("Error loading saved battleModeSettings, received exception: %s", e.what());
}
init();
@@ -213,7 +224,7 @@ void BattleOnlyModeTab::update()
JsonNode node;
JsonSerializer handler(nullptr, node);
startInfo->serializeJson(handler);
Settings storage = persistentStorage.write["lobby"]["battleModeSettings"];
Settings storage = persistentStorage.write["battleModeSettings"];
storage->Struct() = node.Struct();
}