From da52e1c8dccbd33fea11f7bc49429a188751c8d4 Mon Sep 17 00:00:00 2001 From: Beherith Date: Thu, 15 Feb 2024 11:44:06 +0100 Subject: [PATCH] Allow turning off the display of the host IP and username you are connecting with from the connecting screen on load. (#1282) --- rts/Game/ClientSetup.cpp | 10 +++++----- rts/Game/ClientSetup.h | 2 ++ rts/Game/PreGame.cpp | 11 +++++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/rts/Game/ClientSetup.cpp b/rts/Game/ClientSetup.cpp index 26b952c757..b17ad88f08 100644 --- a/rts/Game/ClientSetup.cpp +++ b/rts/Game/ClientSetup.cpp @@ -43,11 +43,11 @@ void ClientSetup::LoadFromStartScript(const std::string& setup) } // Technical parameters - file.GetDef(hostIP, hostIP, "GAME\\HostIP"); - file.GetDef(hostPort, IntToString(hostPort), "GAME\\HostPort"); - - file.GetDef(myPlayerName, "", "GAME\\MyPlayerName"); - file.GetDef(myPasswd, "", "GAME\\MyPasswd"); + file.GetDef(hostIP, hostIP, "GAME\\HostIP"); + file.GetDef(hostPort, IntToString(hostPort), "GAME\\HostPort"); + file.GetDef(showServerName, "", "GAME\\ShowServerName"); + file.GetDef(myPlayerName, "", "GAME\\MyPlayerName"); + file.GetDef(myPasswd, "", "GAME\\MyPasswd"); if (!file.GetValue(isHost, "GAME\\IsHost")) LOG_L(L_WARNING, "[ClientSetup::%s] IsHost-entry missing from setup-script; assuming this is a client", __func__); diff --git a/rts/Game/ClientSetup.h b/rts/Game/ClientSetup.h index d602cac3f4..226650b9af 100644 --- a/rts/Game/ClientSetup.h +++ b/rts/Game/ClientSetup.h @@ -28,6 +28,8 @@ class ClientSetup int hostPort; bool isHost; + + std::string showServerName; }; #endif // CLIENT_SETUP_H diff --git a/rts/Game/PreGame.cpp b/rts/Game/PreGame.cpp index 853f13ceaf..c6ec193062 100644 --- a/rts/Game/PreGame.cpp +++ b/rts/Game/PreGame.cpp @@ -178,10 +178,13 @@ bool CPreGame::Draw() } else { font->glPrint(0.5f, 0.48f, 2.0f, FONT_CENTER | FONT_SCALE | FONT_NORM, "Waiting for server response"); } - - font->glFormat(0.60f, 0.40f, 1.0f, FONT_SCALE | FONT_NORM, "Connecting to: %s", clientNet->ConnectionStr().c_str()); - font->glFormat(0.60f, 0.35f, 1.0f, FONT_SCALE | FONT_NORM, "User name: %s", clientSetup->myPlayerName.c_str()); - + if (clientSetup->showServerName.empty()) { + font->glFormat(0.60f, 0.40f, 1.0f, FONT_SCALE | FONT_NORM, "Connecting to: %s", clientNet->ConnectionStr().c_str()); + font->glFormat(0.60f, 0.35f, 1.0f, FONT_SCALE | FONT_NORM, "User name: %s", clientSetup->myPlayerName.c_str()); + } + else { + font->glFormat(0.60f, 0.40f, 1.0f, FONT_SCALE | FONT_NORM, "Connecting to: %s", clientSetup->showServerName.c_str()); + } font->glFormat(0.5f,0.25f,0.8f,FONT_CENTER | FONT_SCALE | FONT_NORM, "Press SHIFT + ESC to quit"); // credits font->glFormat(0.5f,0.06f,1.0f,FONT_CENTER | FONT_SCALE | FONT_NORM, "Spring %s", SpringVersion::GetFull().c_str());