1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 04:53:12 +01:00

Use sourceGame parameter in JSON files instead of originalId

This commit is contained in:
Michael Steenbeek
2018-07-03 13:46:45 +02:00
committed by Gymnasiast
parent 71bd110526
commit 2a64ec7aff
13 changed files with 50 additions and 27 deletions

View File

@@ -221,6 +221,7 @@ namespace ObjectFactory
{
throw std::runtime_error("Object has errors");
}
result->SetSourceGame(object_entry_get_source_game_legacy(&entry));
}
catch (const std::exception&)
{
@@ -251,6 +252,10 @@ namespace ObjectFactory
delete result;
result = nullptr;
}
else
{
result->SetSourceGame(object_entry_get_source_game_legacy(entry));
}
}
return result;
}
@@ -415,9 +420,20 @@ namespace ObjectFactory
auto sourceGames = json_object_get(jRoot, "sourceGame");
if (json_is_array(sourceGames))
{
auto sourceGame = json_string_value(json_array_get(sourceGames, 0));
auto secondSourceGame = json_string_value(json_array_get(sourceGames, 1));
result->SetSourceGame(ParseSourceGame(sourceGame));
result->SetSecondSourceGame(ParseSourceGame(secondSourceGame));
}
else if (json_is_string(sourceGames))
{
auto sourceGame = json_string_value(sourceGames);
result->SetSourceGame(ParseSourceGame(sourceGame));
}
else
{
log_error("Object %s has an incorrect sourceGame parameter.", id);
}
}
}
return result;