Skip to content

Commit

Permalink
xrGame: remove unnecessary #ifdef XR_PLATFORM_WINDOWS
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Oct 24, 2024
1 parent cd0dff6 commit e89fcc8
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 54 deletions.
16 changes: 1 addition & 15 deletions src/xrGame/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ extern ENGINE_API bool bShowPauseString;

//#define DEMO_BUILD

#ifdef XR_PLATFORM_WINDOWS
constexpr cpcstr ErrMsgBoxTemplate[] =
{
"message_box_invalid_pass",
Expand All @@ -64,7 +63,6 @@ constexpr cpcstr ErrMsgBoxTemplate[] =
"msg_box_error_loading",
"message_box_download_level"
};
#endif

extern bool b_shniaganeed_pp;

Expand Down Expand Up @@ -121,7 +119,6 @@ CMainMenu::CMainMenu()
g_statHint = xr_new<CUIButtonHint>();
m_pGameSpyFull = xr_new<CGameSpy_Full>();

#ifdef XR_PLATFORM_WINDOWS
for (cpcstr name : ErrMsgBoxTemplate)
{
CUIMessageBoxEx* msgBox = m_pMB_ErrDlgs.emplace_back(xr_new<CUIMessageBoxEx>());
Expand All @@ -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<gamespy_gp::account_manager>(m_pGameSpyFull->GetGameSpyGP());
m_login_mngr = xr_new<gamespy_gp::login_manager>(m_pGameSpyFull);
m_profile_store = xr_new<gamespy_profile::profile_store>();
Expand All @@ -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);
Expand Down Expand Up @@ -563,7 +557,6 @@ void CMainMenu::OnFrame()
Console->Show();
}

#ifdef XR_PLATFORM_WINDOWS
if (IsActive() || m_sPDProgress.IsInProgress)
{
GSUpdateStatus status = m_pGameSpyFull->Update();
Expand All @@ -576,7 +569,6 @@ void CMainMenu::OnFrame()
case GSUpdateStatus::OutOfService: SetErrorDialog(ErrGSServiceFailed); break;
}
}
#endif

if (IsActive())
{
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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); }
Expand Down Expand Up @@ -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;

Expand All @@ -934,7 +921,6 @@ LPCSTR CMainMenu::GetPlayerName()
m_player_name = tmp_prof->unique_nick();
}
else
#endif
{
string512 name;
GetPlayerName_FromRegistry(name, sizeof(name));
Expand Down
5 changes: 2 additions & 3 deletions src/xrGame/MainMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/xrGame/account_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
18 changes: 0 additions & 18 deletions src/xrGame/account_manager_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

void CCC_CreateGameSpyAccount::Execute(LPCSTR args)
{
#ifdef XR_PLATFORM_WINDOWS
if (!args || (xr_strlen(args) == 0))
{
TInfo tmp_info;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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
}
2 changes: 0 additions & 2 deletions src/xrGame/console_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
};

Expand Down
2 changes: 0 additions & 2 deletions src/xrGame/login_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand All @@ -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); }
Expand Down
12 changes: 2 additions & 10 deletions src/xrGame/ui/ServerList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -55,7 +54,6 @@ CServerList::CServerList()

m_last_retreived_index = u32(-1);
m_need_refresh_fr = u32(-1);
#endif
}

CServerList::~CServerList()
Expand All @@ -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;
}

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -621,7 +614,6 @@ void CServerList::ConnectToSelected()
item->CreateConsoleCommand(command, m_playerName.c_str(), "", "");
Console->Execute(command.c_str());
}
#endif
}

void CServerList::InitHeader()
Expand Down

0 comments on commit e89fcc8

Please sign in to comment.