mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
fix serialisation
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user