| 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 | { |
nothing calls this directly
no test coverage detected