MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / LoadMap

Method LoadMap

src/openrct2/network/NetworkBase.cpp:2860–2887  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2858 }
2859
2860 bool NetworkBase::LoadMap(IStream* stream)
2861 {
2862 bool result = false;
2863 try
2864 {
2865 auto& context = GetContext();
2866 auto& objManager = context.GetObjectManager();
2867 auto importer = ParkImporter::CreateParkFile(context.GetObjectRepository());
2868 auto loadResult = importer->LoadFromStream(stream, false);
2869 objManager.LoadObjects(loadResult.RequiredObjects);
2870
2871 MapAnimations::ClearAll();
2872 // TODO: Have a separate GameState and exchange once loaded.
2873 auto& gameState = getGameState();
2874 importer->Import(gameState);
2875
2876 EntityTweener::Get().Reset();
2877 MapAnimations::MarkAllTiles();
2878
2879 gLastAutoSaveUpdate = kAutosavePause;
2880 result = true;
2881 }
2882 catch (const std::exception& e)
2883 {
2884 Console::Error::WriteLine("Unable to read map from server: %s", e.what());
2885 }
2886 return result;
2887 }
2888
2889 bool NetworkBase::SaveMap(IStream* stream, const std::vector<const ObjectRepositoryItem*>& objects) const
2890 {

Callers

nothing calls this directly

Calls 7

GetContextFunction · 0.85
WriteLineFunction · 0.85
LoadObjectsMethod · 0.80
LoadFromStreamMethod · 0.45
ImportMethod · 0.45
ResetMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected