Skip to content

Commit 8e1bc69

Browse files
committed
xrGame: remove unnecessary #ifdef XR_PLATFORM_WINDOWS
1 parent 75735d8 commit 8e1bc69

7 files changed

+6
-54
lines changed

src/xrGame/MainMenu.cpp

+1-15
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ extern ENGINE_API bool bShowPauseString;
4242

4343
//#define DEMO_BUILD
4444

45-
#ifdef XR_PLATFORM_WINDOWS
4645
constexpr cpcstr ErrMsgBoxTemplate[] =
4746
{
4847
"message_box_invalid_pass",
@@ -64,7 +63,6 @@ constexpr cpcstr ErrMsgBoxTemplate[] =
6463
"msg_box_error_loading",
6564
"message_box_download_level"
6665
};
67-
#endif
6866

6967
extern bool b_shniaganeed_pp;
7068

@@ -121,7 +119,6 @@ CMainMenu::CMainMenu()
121119
g_statHint = xr_new<CUIButtonHint>();
122120
m_pGameSpyFull = xr_new<CGameSpy_Full>();
123121

124-
#ifdef XR_PLATFORM_WINDOWS
125122
for (cpcstr name : ErrMsgBoxTemplate)
126123
{
127124
CUIMessageBoxEx* msgBox = m_pMB_ErrDlgs.emplace_back(xr_new<CUIMessageBoxEx>());
@@ -145,7 +142,7 @@ CMainMenu::CMainMenu()
145142
downloadMsg->AddCallbackStr(
146143
"button_yes", MESSAGE_BOX_YES_CLICKED, CUIWndCallback::void_function(this, &CMainMenu::OnDownloadMPMap));
147144
}
148-
#endif
145+
149146
m_account_mngr = xr_new<gamespy_gp::account_manager>(m_pGameSpyFull->GetGameSpyGP());
150147
m_login_mngr = xr_new<gamespy_gp::login_manager>(m_pGameSpyFull);
151148
m_profile_store = xr_new<gamespy_profile::profile_store>();
@@ -165,13 +162,10 @@ CMainMenu::~CMainMenu()
165162

166163
g_pGamePersistent->m_pMainMenu = nullptr;
167164

168-
#ifdef XR_PLATFORM_WINDOWS
169165
xr_delete(m_account_mngr);
170166
xr_delete(m_login_mngr);
171167
xr_delete(m_profile_store);
172-
173168
xr_delete(m_pGameSpyFull);
174-
#endif
175169

176170
xr_delete(m_demo_info_loader);
177171
delete_data(m_pMB_ErrDlgs);
@@ -563,7 +557,6 @@ void CMainMenu::OnFrame()
563557
Console->Show();
564558
}
565559

566-
#ifdef XR_PLATFORM_WINDOWS
567560
if (IsActive() || m_sPDProgress.IsInProgress)
568561
{
569562
GSUpdateStatus status = m_pGameSpyFull->Update();
@@ -576,7 +569,6 @@ void CMainMenu::OnFrame()
576569
case GSUpdateStatus::OutOfService: SetErrorDialog(ErrGSServiceFailed); break;
577570
}
578571
}
579-
#endif
580572

581573
if (IsActive())
582574
{
@@ -704,7 +696,6 @@ void CMainMenu::OnPatchCheck(bool success, LPCSTR VersionName, LPCSTR URL)
704696

705697
void CMainMenu::OnDownloadPatch(CUIWindow*, void*)
706698
{
707-
#ifdef XR_PLATFORM_WINDOWS
708699
CGameSpy_Available GSA;
709700
shared_str result_string;
710701
if (!GSA.CheckAvailableServices(result_string))
@@ -739,7 +730,6 @@ void CMainMenu::OnDownloadPatch(CUIWindow*, void*)
739730
progressCallback.bind(this, &CMainMenu::OnDownloadPatchProgress);
740731
m_pGameSpyFull->GetGameSpyHTTP()->DownloadFile(
741732
*m_sPatchURL, *m_sPatchFileName, completionCallback, progressCallback);
742-
#endif
743733
}
744734

745735
void CMainMenu::OnDownloadPatchResult(bool success)
@@ -799,10 +789,8 @@ void CMainMenu::OnRunDownloadedPatch(CUIWindow*, void*)
799789

800790
void CMainMenu::CancelDownload()
801791
{
802-
#ifdef XR_PLATFORM_WINDOWS
803792
m_pGameSpyFull->GetGameSpyHTTP()->StopDownload();
804793
m_sPDProgress.IsInProgress = false;
805-
#endif
806794
}
807795

808796
void CMainMenu::SetNeedVidRestart() { m_Flags.set(flNeedVidRestart, TRUE); }
@@ -925,7 +913,6 @@ LPCSTR CMainMenu::GetGSVer()
925913

926914
LPCSTR CMainMenu::GetPlayerName()
927915
{
928-
#ifdef XR_PLATFORM_WINDOWS
929916
gamespy_gp::login_manager* l_mngr = GetLoginMngr();
930917
gamespy_gp::profile const* tmp_prof = l_mngr ? l_mngr->get_current_profile() : NULL;
931918

@@ -934,7 +921,6 @@ LPCSTR CMainMenu::GetPlayerName()
934921
m_player_name = tmp_prof->unique_nick();
935922
}
936923
else
937-
#endif
938924
{
939925
string512 name;
940926
GetPlayerName_FromRegistry(name, sizeof(name));

src/xrGame/MainMenu.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,8 @@ class CMainMenu : public IMainMenu,
108108
gamespy_gp::login_manager* GetLoginMngr() { return m_login_mngr; }
109109
gamespy_profile::profile_store* GetProfileStore() { return m_profile_store; }
110110

111-
#ifdef XR_PLATFORM_WINDOWS
112-
CGameSpy_Full* GetGS() { return m_pGameSpyFull; };
113-
#endif
111+
CGameSpy_Full* GetGS() const { return m_pGameSpyFull; }
112+
114113
protected:
115114
EErrorDlg m_NeedErrDialog;
116115
u32 m_start_time;

src/xrGame/account_manager.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void account_manager::delete_profile(account_operation_cb dpcb)
234234
{
235235
m_profile_deleting_cb = dpcb;
236236
}
237-
#ifdef XR_PLATFORM_WINDOWS
237+
238238
login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
239239
VERIFY(tmp_lmngr);
240240
if (!tmp_lmngr->get_current_profile())
@@ -248,7 +248,6 @@ void account_manager::delete_profile(account_operation_cb dpcb)
248248
{
249249
m_profile_deleting_cb(false, CGameSpy_GP::TryToTranslate(tmp_res).c_str());
250250
}
251-
#endif
252251
}
253252

254253
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*
447446
return;
448447
}
449448
VERIFY(tmp_inst->m_gamespy_gp);
450-
#ifdef XR_PLATFORM_WINDOWS
451449
login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
452450
VERIFY(tmp_lmngr);
453451
tmp_lmngr->delete_profile_obj();
454452
tmp_inst->m_profile_deleting_cb(true, "");
455-
#endif
456453
}
457454

458455
void __cdecl account_manager::search_profile_cb(GPConnection* connection, void* arg, void* param)

src/xrGame/account_manager_console.cpp

-18
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
void CCC_CreateGameSpyAccount::Execute(LPCSTR args)
1212
{
13-
#ifdef XR_PLATFORM_WINDOWS
1413
if (!args || (xr_strlen(args) == 0))
1514
{
1615
TInfo tmp_info;
@@ -38,12 +37,10 @@ void CCC_CreateGameSpyAccount::Execute(LPCSTR args)
3837
prof_data.password = tmp_password;
3938

4039
tmp_acc_mngr->create_profile(tmp_nick, tmp_unick, tmp_email, tmp_password, gamespy_gp::account_operation_cb());
41-
#endif
4240
}
4341

4442
void CCC_GapySpyListProfiles::Execute(LPCSTR args)
4543
{
46-
#ifdef XR_PLATFORM_WINDOWS
4744
if (!args || (xr_strlen(args) == 0))
4845
{
4946
TInfo tmp_info;
@@ -61,12 +58,10 @@ void CCC_GapySpyListProfiles::Execute(LPCSTR args)
6158
VERIFY(tmp_gp);
6259
gamespy_gp::account_manager* tmp_acc_mngr = MainMenu()->GetAccountMngr();
6360
tmp_acc_mngr->get_account_profiles(tmp_email, tmp_password, gamespy_gp::account_profiles_cb());
64-
#endif
6561
}
6662

6763
void CCC_GameSpyLogin::Execute(LPCSTR args)
6864
{
69-
#ifdef XR_PLATFORM_WINDOWS
7065
if (!args || (xr_strlen(args) == 0))
7166
{
7267
TInfo tmp_info;
@@ -86,24 +81,20 @@ void CCC_GameSpyLogin::Execute(LPCSTR args)
8681
gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
8782
VERIFY(tmp_lmngr);
8883
tmp_lmngr->login(tmp_email, tmp_nick, tmp_password, gamespy_gp::login_operation_cb());
89-
#endif
9084
}
9185

9286
void CCC_GameSpyLogout::Execute(LPCSTR args)
9387
{
94-
#ifdef XR_PLATFORM_WINDOWS
9588
VERIFY(MainMenu() && MainMenu()->GetGS());
9689
gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
9790
VERIFY(tmp_lmngr);
9891
tmp_lmngr->logout();
99-
#endif
10092
}
10193

10294
pcstr print_time(time_t const& src_time, string64& dest_time);
10395

10496
void CCC_GameSpyPrintProfile::Execute(LPCSTR args)
10597
{
106-
#ifdef XR_PLATFORM_WINDOWS
10798
VERIFY(MainMenu() && MainMenu()->GetGS());
10899
gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
109100
gamespy_gp::profile const* tmp_profile = tmp_lmngr->get_current_profile();
@@ -117,46 +108,38 @@ void CCC_GameSpyPrintProfile::Execute(LPCSTR args)
117108
{
118109
Msg("- No profile. You are not loged in.");
119110
}
120-
#endif
121111
}
122112

123113
void CCC_GameSpySuggestUNicks::Execute(LPCSTR args)
124114
{
125-
#ifdef XR_PLATFORM_WINDOWS
126115
VERIFY(MainMenu() && MainMenu()->GetGS());
127116
string256 tmp_unick;
128117
sscanf(args, "%s", tmp_unick);
129118
gamespy_gp::account_manager* tmp_amngr = MainMenu()->GetAccountMngr();
130119
VERIFY(tmp_amngr);
131120
tmp_amngr->suggest_unique_nicks(tmp_unick, gamespy_gp::suggest_nicks_cb());
132-
#endif
133121
}
134122

135123
void CCC_GameSpyRegisterUniqueNick::Execute(LPCSTR args)
136124
{
137-
#ifdef XR_PLATFORM_WINDOWS
138125
VERIFY(MainMenu() && MainMenu()->GetGS());
139126
gamespy_gp::login_manager::unique_nick_t tmp_unick;
140127
sscanf(args, "%s", tmp_unick);
141128
gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
142129
VERIFY(tmp_lmngr);
143130
tmp_lmngr->set_unique_nick(tmp_unick, gamespy_gp::login_operation_cb());
144-
#endif
145131
}
146132

147133
void CCC_GameSpyDeleteProfile::Execute(LPCSTR args)
148134
{
149-
#ifdef XR_PLATFORM_WINDOWS
150135
VERIFY(MainMenu() && MainMenu()->GetGS());
151136
gamespy_gp::account_manager* tmp_amngr = MainMenu()->GetAccountMngr();
152137
VERIFY(tmp_amngr);
153138
tmp_amngr->delete_profile(gamespy_gp::account_operation_cb());
154-
#endif
155139
}
156140

157141
void CCC_GameSpyProfile::Execute(LPCSTR args)
158142
{
159-
#ifdef XR_PLATFORM_WINDOWS
160143
VERIFY(MainMenu());
161144
gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
162145
VERIFY(tmp_lmngr);
@@ -187,5 +170,4 @@ void CCC_GameSpyProfile::Execute(LPCSTR args)
187170
{
188171
Log("~ This command is unsupported since old gamespy profile code has been removed from the engine.");
189172
}
190-
#endif
191173
}

src/xrGame/console_commands.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1865,13 +1865,11 @@ class CCC_GSCheckForUpdates : public IConsole_Command
18651865
if (mm == nullptr)
18661866
return;
18671867

1868-
#ifdef XR_PLATFORM_WINDOWS
18691868
if (!m_checkInProgress.exchange(true))
18701869
{
18711870
SetupCallParams(arguments);
18721871
mm->GetGS()->GetGameSpyPatching()->CheckForPatch(true, m_resultCallbackBinded);
18731872
}
1874-
#endif
18751873
}
18761874
};
18771875

src/xrGame/login_manager.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ void login_manager::logout()
205205

206206
void login_manager::reinit_connection_tasks()
207207
{
208-
#ifdef XR_PLATFORM_WINDOWS
209208
account_manager* tmp_acc_mngr = MainMenu()->GetAccountMngr();
210209
if (tmp_acc_mngr->is_get_account_profiles_active())
211210
{
@@ -222,7 +221,6 @@ void login_manager::reinit_connection_tasks()
222221
Msg("! WARNING: reiniting suggesting unique nicks");
223222
tmp_acc_mngr->reinit_suggest_unique_nicks();
224223
}
225-
#endif
226224
}
227225

228226
void login_manager::delete_profile_obj() { xr_delete(m_current_profile); }

src/xrGame/ui/ServerList.cpp

+2-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ CServerList::CServerList()
2020
m_header2{ "Server properties", "Players list", "Frags", "Deaths" },
2121
m_header_frames{ "Icon frame", "Server name frame", "Map frame", "Game type frame", "Players frame", "Ping frame", "Version frame" }
2222
{
23-
#ifdef XR_PLATFORM_WINDOWS
2423
CGameSpy_BrowsersWrapper::UpdateCallback updateCb;
2524
updateCb.bind(this, &CServerList::OnUpdate);
2625
m_subscriber_id = browser().SubscribeUpdates(updateCb);
@@ -55,7 +54,6 @@ CServerList::CServerList()
5554

5655
m_last_retreived_index = u32(-1);
5756
m_need_refresh_fr = u32(-1);
58-
#endif
5957
}
6058

6159
CServerList::~CServerList()
@@ -71,15 +69,11 @@ CServerList::~CServerList()
7169

7270
CGameSpy_BrowsersWrapper* CServerList::browser_LL()
7371
{
74-
#ifdef XR_PLATFORM_WINDOWS
75-
auto mm = MainMenu();
76-
if (mm)
72+
if (const auto mm = MainMenu())
7773
{
78-
auto gs = mm->GetGS();
79-
if (gs)
74+
if (const auto gs = mm->GetGS())
8075
return gs->GetGameSpyBrowser();
8176
}
82-
#endif
8377
return nullptr;
8478
}
8579

@@ -570,7 +564,6 @@ void CServerList::InitFromXml(CUIXml& xml_doc, LPCSTR path)
570564

571565
void CServerList::ConnectToSelected()
572566
{
573-
#ifdef XR_PLATFORM_WINDOWS
574567
gamespy_gp::login_manager const* lmngr = MainMenu()->GetLoginMngr();
575568
R_ASSERT(lmngr);
576569
gamespy_gp::profile const* tmp_profile = lmngr->get_current_profile();
@@ -621,7 +614,6 @@ void CServerList::ConnectToSelected()
621614
item->CreateConsoleCommand(command, m_playerName.c_str(), "", "");
622615
Console->Execute(command.c_str());
623616
}
624-
#endif
625617
}
626618

627619
void CServerList::InitHeader()

0 commit comments

Comments
 (0)