From e89fcc8704b2b5abe710efb6a957bd72de4724c5 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Thu, 24 Oct 2024 05:18:51 +0300 Subject: [PATCH] xrGame: remove unnecessary #ifdef XR_PLATFORM_WINDOWS --- src/xrGame/MainMenu.cpp | 16 +--------------- src/xrGame/MainMenu.h | 5 ++--- src/xrGame/account_manager.cpp | 5 +---- src/xrGame/account_manager_console.cpp | 18 ------------------ src/xrGame/console_commands.cpp | 2 -- src/xrGame/login_manager.cpp | 2 -- src/xrGame/ui/ServerList.cpp | 12 ++---------- 7 files changed, 6 insertions(+), 54 deletions(-) diff --git a/src/xrGame/MainMenu.cpp b/src/xrGame/MainMenu.cpp index 463ae5c98d6..4a4c6bce001 100644 --- a/src/xrGame/MainMenu.cpp +++ b/src/xrGame/MainMenu.cpp @@ -42,7 +42,6 @@ extern ENGINE_API bool bShowPauseString; //#define DEMO_BUILD -#ifdef XR_PLATFORM_WINDOWS constexpr cpcstr ErrMsgBoxTemplate[] = { "message_box_invalid_pass", @@ -64,7 +63,6 @@ constexpr cpcstr ErrMsgBoxTemplate[] = "msg_box_error_loading", "message_box_download_level" }; -#endif extern bool b_shniaganeed_pp; @@ -121,7 +119,6 @@ CMainMenu::CMainMenu() g_statHint = xr_new(); m_pGameSpyFull = xr_new(); -#ifdef XR_PLATFORM_WINDOWS for (cpcstr name : ErrMsgBoxTemplate) { CUIMessageBoxEx* msgBox = m_pMB_ErrDlgs.emplace_back(xr_new()); @@ -145,7 +142,7 @@ CMainMenu::CMainMenu() downloadMsg->AddCallbackStr( "button_yes", MESSAGE_BOX_YES_CLICKED, CUIWndCallback::void_function(this, &CMainMenu::OnDownloadMPMap)); } -#endif + m_account_mngr = xr_new(m_pGameSpyFull->GetGameSpyGP()); m_login_mngr = xr_new(m_pGameSpyFull); m_profile_store = xr_new(); @@ -165,13 +162,10 @@ CMainMenu::~CMainMenu() g_pGamePersistent->m_pMainMenu = nullptr; -#ifdef XR_PLATFORM_WINDOWS xr_delete(m_account_mngr); xr_delete(m_login_mngr); xr_delete(m_profile_store); - xr_delete(m_pGameSpyFull); -#endif xr_delete(m_demo_info_loader); delete_data(m_pMB_ErrDlgs); @@ -563,7 +557,6 @@ void CMainMenu::OnFrame() Console->Show(); } -#ifdef XR_PLATFORM_WINDOWS if (IsActive() || m_sPDProgress.IsInProgress) { GSUpdateStatus status = m_pGameSpyFull->Update(); @@ -576,7 +569,6 @@ void CMainMenu::OnFrame() case GSUpdateStatus::OutOfService: SetErrorDialog(ErrGSServiceFailed); break; } } -#endif if (IsActive()) { @@ -704,7 +696,6 @@ void CMainMenu::OnPatchCheck(bool success, LPCSTR VersionName, LPCSTR URL) void CMainMenu::OnDownloadPatch(CUIWindow*, void*) { -#ifdef XR_PLATFORM_WINDOWS CGameSpy_Available GSA; shared_str result_string; if (!GSA.CheckAvailableServices(result_string)) @@ -739,7 +730,6 @@ void CMainMenu::OnDownloadPatch(CUIWindow*, void*) progressCallback.bind(this, &CMainMenu::OnDownloadPatchProgress); m_pGameSpyFull->GetGameSpyHTTP()->DownloadFile( *m_sPatchURL, *m_sPatchFileName, completionCallback, progressCallback); -#endif } void CMainMenu::OnDownloadPatchResult(bool success) @@ -799,10 +789,8 @@ void CMainMenu::OnRunDownloadedPatch(CUIWindow*, void*) void CMainMenu::CancelDownload() { -#ifdef XR_PLATFORM_WINDOWS m_pGameSpyFull->GetGameSpyHTTP()->StopDownload(); m_sPDProgress.IsInProgress = false; -#endif } void CMainMenu::SetNeedVidRestart() { m_Flags.set(flNeedVidRestart, TRUE); } @@ -925,7 +913,6 @@ LPCSTR CMainMenu::GetGSVer() LPCSTR CMainMenu::GetPlayerName() { -#ifdef XR_PLATFORM_WINDOWS gamespy_gp::login_manager* l_mngr = GetLoginMngr(); gamespy_gp::profile const* tmp_prof = l_mngr ? l_mngr->get_current_profile() : NULL; @@ -934,7 +921,6 @@ LPCSTR CMainMenu::GetPlayerName() m_player_name = tmp_prof->unique_nick(); } else -#endif { string512 name; GetPlayerName_FromRegistry(name, sizeof(name)); diff --git a/src/xrGame/MainMenu.h b/src/xrGame/MainMenu.h index 569f3d1579e..5f45c49ba45 100644 --- a/src/xrGame/MainMenu.h +++ b/src/xrGame/MainMenu.h @@ -108,9 +108,8 @@ class CMainMenu : public IMainMenu, gamespy_gp::login_manager* GetLoginMngr() { return m_login_mngr; } gamespy_profile::profile_store* GetProfileStore() { return m_profile_store; } -#ifdef XR_PLATFORM_WINDOWS - CGameSpy_Full* GetGS() { return m_pGameSpyFull; }; -#endif + CGameSpy_Full* GetGS() const { return m_pGameSpyFull; } + protected: EErrorDlg m_NeedErrDialog; u32 m_start_time; diff --git a/src/xrGame/account_manager.cpp b/src/xrGame/account_manager.cpp index af48d8bd285..bf2796c2300 100644 --- a/src/xrGame/account_manager.cpp +++ b/src/xrGame/account_manager.cpp @@ -234,7 +234,7 @@ void account_manager::delete_profile(account_operation_cb dpcb) { m_profile_deleting_cb = dpcb; } -#ifdef XR_PLATFORM_WINDOWS + login_manager* tmp_lmngr = MainMenu()->GetLoginMngr(); VERIFY(tmp_lmngr); if (!tmp_lmngr->get_current_profile()) @@ -248,7 +248,6 @@ void account_manager::delete_profile(account_operation_cb dpcb) { m_profile_deleting_cb(false, CGameSpy_GP::TryToTranslate(tmp_res).c_str()); } -#endif } void account_manager::get_account_profiles(char const* email, char const* password, account_profiles_cb profiles_cb) @@ -447,12 +446,10 @@ void __cdecl account_manager::delete_profile_cb(GPConnection* connection, void* return; } VERIFY(tmp_inst->m_gamespy_gp); -#ifdef XR_PLATFORM_WINDOWS login_manager* tmp_lmngr = MainMenu()->GetLoginMngr(); VERIFY(tmp_lmngr); tmp_lmngr->delete_profile_obj(); tmp_inst->m_profile_deleting_cb(true, ""); -#endif } void __cdecl account_manager::search_profile_cb(GPConnection* connection, void* arg, void* param) diff --git a/src/xrGame/account_manager_console.cpp b/src/xrGame/account_manager_console.cpp index 2e0f6bf5d0c..7be40ee2c37 100644 --- a/src/xrGame/account_manager_console.cpp +++ b/src/xrGame/account_manager_console.cpp @@ -10,7 +10,6 @@ void CCC_CreateGameSpyAccount::Execute(LPCSTR args) { -#ifdef XR_PLATFORM_WINDOWS if (!args || (xr_strlen(args) == 0)) { TInfo tmp_info; @@ -38,12 +37,10 @@ void CCC_CreateGameSpyAccount::Execute(LPCSTR args) prof_data.password = tmp_password; tmp_acc_mngr->create_profile(tmp_nick, tmp_unick, tmp_email, tmp_password, gamespy_gp::account_operation_cb()); -#endif } void CCC_GapySpyListProfiles::Execute(LPCSTR args) { -#ifdef XR_PLATFORM_WINDOWS if (!args || (xr_strlen(args) == 0)) { TInfo tmp_info; @@ -61,12 +58,10 @@ void CCC_GapySpyListProfiles::Execute(LPCSTR args) VERIFY(tmp_gp); gamespy_gp::account_manager* tmp_acc_mngr = MainMenu()->GetAccountMngr(); tmp_acc_mngr->get_account_profiles(tmp_email, tmp_password, gamespy_gp::account_profiles_cb()); -#endif } void CCC_GameSpyLogin::Execute(LPCSTR args) { -#ifdef XR_PLATFORM_WINDOWS if (!args || (xr_strlen(args) == 0)) { TInfo tmp_info; @@ -86,24 +81,20 @@ void CCC_GameSpyLogin::Execute(LPCSTR args) gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr(); VERIFY(tmp_lmngr); tmp_lmngr->login(tmp_email, tmp_nick, tmp_password, gamespy_gp::login_operation_cb()); -#endif } void CCC_GameSpyLogout::Execute(LPCSTR args) { -#ifdef XR_PLATFORM_WINDOWS VERIFY(MainMenu() && MainMenu()->GetGS()); gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr(); VERIFY(tmp_lmngr); tmp_lmngr->logout(); -#endif } pcstr print_time(time_t const& src_time, string64& dest_time); void CCC_GameSpyPrintProfile::Execute(LPCSTR args) { -#ifdef XR_PLATFORM_WINDOWS VERIFY(MainMenu() && MainMenu()->GetGS()); gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr(); gamespy_gp::profile const* tmp_profile = tmp_lmngr->get_current_profile(); @@ -117,46 +108,38 @@ void CCC_GameSpyPrintProfile::Execute(LPCSTR args) { Msg("- No profile. You are not loged in."); } -#endif } void CCC_GameSpySuggestUNicks::Execute(LPCSTR args) { -#ifdef XR_PLATFORM_WINDOWS VERIFY(MainMenu() && MainMenu()->GetGS()); string256 tmp_unick; sscanf(args, "%s", tmp_unick); gamespy_gp::account_manager* tmp_amngr = MainMenu()->GetAccountMngr(); VERIFY(tmp_amngr); tmp_amngr->suggest_unique_nicks(tmp_unick, gamespy_gp::suggest_nicks_cb()); -#endif } void CCC_GameSpyRegisterUniqueNick::Execute(LPCSTR args) { -#ifdef XR_PLATFORM_WINDOWS VERIFY(MainMenu() && MainMenu()->GetGS()); gamespy_gp::login_manager::unique_nick_t tmp_unick; sscanf(args, "%s", tmp_unick); gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr(); VERIFY(tmp_lmngr); tmp_lmngr->set_unique_nick(tmp_unick, gamespy_gp::login_operation_cb()); -#endif } void CCC_GameSpyDeleteProfile::Execute(LPCSTR args) { -#ifdef XR_PLATFORM_WINDOWS VERIFY(MainMenu() && MainMenu()->GetGS()); gamespy_gp::account_manager* tmp_amngr = MainMenu()->GetAccountMngr(); VERIFY(tmp_amngr); tmp_amngr->delete_profile(gamespy_gp::account_operation_cb()); -#endif } void CCC_GameSpyProfile::Execute(LPCSTR args) { -#ifdef XR_PLATFORM_WINDOWS VERIFY(MainMenu()); gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr(); VERIFY(tmp_lmngr); @@ -187,5 +170,4 @@ void CCC_GameSpyProfile::Execute(LPCSTR args) { Log("~ This command is unsupported since old gamespy profile code has been removed from the engine."); } -#endif } diff --git a/src/xrGame/console_commands.cpp b/src/xrGame/console_commands.cpp index 680dd543bbe..e973684346a 100644 --- a/src/xrGame/console_commands.cpp +++ b/src/xrGame/console_commands.cpp @@ -1865,13 +1865,11 @@ class CCC_GSCheckForUpdates : public IConsole_Command if (mm == nullptr) return; -#ifdef XR_PLATFORM_WINDOWS if (!m_checkInProgress.exchange(true)) { SetupCallParams(arguments); mm->GetGS()->GetGameSpyPatching()->CheckForPatch(true, m_resultCallbackBinded); } -#endif } }; diff --git a/src/xrGame/login_manager.cpp b/src/xrGame/login_manager.cpp index 59e28df1748..664bd282e02 100644 --- a/src/xrGame/login_manager.cpp +++ b/src/xrGame/login_manager.cpp @@ -205,7 +205,6 @@ void login_manager::logout() void login_manager::reinit_connection_tasks() { -#ifdef XR_PLATFORM_WINDOWS account_manager* tmp_acc_mngr = MainMenu()->GetAccountMngr(); if (tmp_acc_mngr->is_get_account_profiles_active()) { @@ -222,7 +221,6 @@ void login_manager::reinit_connection_tasks() Msg("! WARNING: reiniting suggesting unique nicks"); tmp_acc_mngr->reinit_suggest_unique_nicks(); } -#endif } void login_manager::delete_profile_obj() { xr_delete(m_current_profile); } diff --git a/src/xrGame/ui/ServerList.cpp b/src/xrGame/ui/ServerList.cpp index 68585dfb4ce..772d978d15f 100644 --- a/src/xrGame/ui/ServerList.cpp +++ b/src/xrGame/ui/ServerList.cpp @@ -20,7 +20,6 @@ CServerList::CServerList() m_header2{ "Server properties", "Players list", "Frags", "Deaths" }, m_header_frames{ "Icon frame", "Server name frame", "Map frame", "Game type frame", "Players frame", "Ping frame", "Version frame" } { -#ifdef XR_PLATFORM_WINDOWS CGameSpy_BrowsersWrapper::UpdateCallback updateCb; updateCb.bind(this, &CServerList::OnUpdate); m_subscriber_id = browser().SubscribeUpdates(updateCb); @@ -55,7 +54,6 @@ CServerList::CServerList() m_last_retreived_index = u32(-1); m_need_refresh_fr = u32(-1); -#endif } CServerList::~CServerList() @@ -71,15 +69,11 @@ CServerList::~CServerList() CGameSpy_BrowsersWrapper* CServerList::browser_LL() { -#ifdef XR_PLATFORM_WINDOWS - auto mm = MainMenu(); - if (mm) + if (const auto mm = MainMenu()) { - auto gs = mm->GetGS(); - if (gs) + if (const auto gs = mm->GetGS()) return gs->GetGameSpyBrowser(); } -#endif return nullptr; } @@ -570,7 +564,6 @@ void CServerList::InitFromXml(CUIXml& xml_doc, LPCSTR path) void CServerList::ConnectToSelected() { -#ifdef XR_PLATFORM_WINDOWS gamespy_gp::login_manager const* lmngr = MainMenu()->GetLoginMngr(); R_ASSERT(lmngr); gamespy_gp::profile const* tmp_profile = lmngr->get_current_profile(); @@ -621,7 +614,6 @@ void CServerList::ConnectToSelected() item->CreateConsoleCommand(command, m_playerName.c_str(), "", ""); Console->Execute(command.c_str()); } -#endif } void CServerList::InitHeader()