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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user