1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 08:12:53 +01:00

Adjust the import/export code to have the game state passed

This commit is contained in:
ζeh Matt
2023-12-28 01:29:06 +02:00
parent a5dde0f8dc
commit 9b2a79faf1
17 changed files with 154 additions and 88 deletions

View File

@@ -83,7 +83,10 @@ static bool ImportS6(MemoryStream& stream, std::unique_ptr<IContext>& context, b
auto importer = ParkImporter::CreateS6(context->GetObjectRepository());
auto loadResult = importer->LoadFromStream(&stream, false);
objManager.LoadObjects(loadResult.RequiredObjects);
importer->Import();
// TODO: Have a separate GameState and exchange once loaded.
auto& gameState = GetGameState();
importer->Import(gameState);
GameInit(retainSpatialIndices);
@@ -99,7 +102,10 @@ static bool ImportPark(MemoryStream& stream, std::unique_ptr<IContext>& context,
auto importer = ParkImporter::CreateParkFile(context->GetObjectRepository());
auto loadResult = importer->LoadFromStream(&stream, false);
objManager.LoadObjects(loadResult.RequiredObjects);
importer->Import();
// TODO: Have a separate GameState and exchange once loaded.
auto& gameState = GetGameState();
importer->Import(gameState);
GameInit(retainSpatialIndices);
@@ -112,7 +118,9 @@ static bool ExportSave(MemoryStream& stream, std::unique_ptr<IContext>& context)
auto exporter = std::make_unique<ParkFileExporter>();
exporter->ExportObjectsList = objManager.GetPackableObjects();
exporter->Export(stream);
auto& gameState = GetGameState();
exporter->Export(gameState, stream);
return true;
}