1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 15:24:30 +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

@@ -2797,7 +2797,10 @@ bool NetworkBase::LoadMap(IStream* stream)
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);
EntityTweener::Get().Reset();
MapAnimationAutoCreate();
@@ -2820,7 +2823,9 @@ bool NetworkBase::SaveMap(IStream* stream, const std::vector<const ObjectReposit
{
auto exporter = std::make_unique<ParkFileExporter>();
exporter->ExportObjectsList = objects;
exporter->Export(*stream);
auto& gameState = GetGameState();
exporter->Export(gameState, *stream);
result = true;
}
catch (const std::exception& e)