From 72a63735206b36c50d08bd1e10fbba445253445e Mon Sep 17 00:00:00 2001 From: ZehMatt Date: Tue, 17 Aug 2021 10:36:18 +0300 Subject: [PATCH] Guard code with DISABLE_NETWORK --- src/openrct2/Context.cpp | 13 +++++++++++++ src/openrct2/title/TitleScreen.cpp | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index a0636e15d9..1a11ca47d5 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -171,7 +171,9 @@ namespace OpenRCT2 // If objects use GetContext() in their destructor things won't go well. GameActions::ClearQueue(); +#ifndef DISABLE_NETWORK _network.Close(); +#endif window_close_all(); // Unload objects after closing all windows, this is to overcome windows like @@ -651,22 +653,29 @@ namespace OpenRCT2 gScreenAge = 0; gLastAutoSaveUpdate = AUTOSAVE_PAUSE; +#ifndef DISABLE_NETWORK bool sendMap = false; +#endif if (info.Type == FILE_TYPE::SAVED_GAME) { +#ifndef DISABLE_NETWORK if (_network.GetMode() == NETWORK_MODE_CLIENT) { _network.Close(); } +#endif game_load_init(); +#ifndef DISABLE_NETWORK if (_network.GetMode() == NETWORK_MODE_SERVER) { sendMap = true; } +#endif } else { scenario_begin(); +#ifndef DISABLE_NETWORK if (_network.GetMode() == NETWORK_MODE_SERVER) { sendMap = true; @@ -675,14 +684,18 @@ namespace OpenRCT2 { _network.Close(); } +#endif } // This ensures that the newly loaded save reflects the user's // 'show real names of guests' option, now that it's a global setting peep_update_names(gConfigGeneral.show_real_names_of_guests); +#ifndef DISABLE_NETWORK if (sendMap) { _network.Server_Send_MAP(); } +#endif + #ifdef USE_BREAKPAD if (_network.GetMode() == NETWORK_MODE_NONE) { diff --git a/src/openrct2/title/TitleScreen.cpp b/src/openrct2/title/TitleScreen.cpp index 3fe9f9e2b1..02e134ef8f 100644 --- a/src/openrct2/title/TitleScreen.cpp +++ b/src/openrct2/title/TitleScreen.cpp @@ -125,7 +125,9 @@ void TitleScreen::Load() gScreenAge = 0; gCurrentLoadedPath = ""; +#ifndef DISABLE_NETWORK GetContext()->GetNetwork().Close(); +#endif OpenRCT2::Audio::StopAll(); GetContext()->GetGameState()->InitAll(150); viewport_init_all();