Skip to content

Commit

Permalink
Allow turning off the display of the host IP and username you are con…
Browse files Browse the repository at this point in the history
…necting with from the connecting screen on load. (#1282)
  • Loading branch information
Beherith authored Feb 15, 2024
1 parent d08065e commit da52e1c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
10 changes: 5 additions & 5 deletions rts/Game/ClientSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down
2 changes: 2 additions & 0 deletions rts/Game/ClientSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class ClientSetup
int hostPort;

bool isHost;

std::string showServerName;
};

#endif // CLIENT_SETUP_H
11 changes: 7 additions & 4 deletions rts/Game/PreGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit da52e1c

Please sign in to comment.