Fix incorrect text wrapping in ingame server info

The maximum width for the server info and game info text was too small, which previously didn't matter, because the manual newlines broke text wrapping in this case, but with the fix from #6353 this now causes the text to break after the colons already.

This is fixed by using the maximum available width for the text instead of a too small magic number (`250.0f`).

For completeness, the maximum width for the title texts is unset (`-1.0f`), because they should never wrap, which is consistent with the MOTD title text.
This commit is contained in:
Robert Müller 2023-02-26 11:43:43 +01:00
parent 55a39e1f08
commit ffa4801220

View file

@ -392,7 +392,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
x = 5.0f;
y = 0.0f;
TextRender()->Text(ServerInfo.x + x, ServerInfo.y + y, 32, Localize("Server info"), 250.0f);
TextRender()->Text(ServerInfo.x + x, ServerInfo.y + y, 32, Localize("Server info"), -1.0f);
y += 32.0f + 5.0f;
mem_zero(aBuf, sizeof(aBuf));
@ -410,7 +410,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
Localize("Version"), CurrentServerInfo.m_aVersion,
Localize("Password"), CurrentServerInfo.m_Flags & 1 ? Localize("Yes") : Localize("No"));
TextRender()->Text(ServerInfo.x + x, ServerInfo.y + y, 20, aBuf, 250.0f);
TextRender()->Text(ServerInfo.x + x, ServerInfo.y + y, 20, aBuf, ServerInfo.w - 10.0f);
// copy info button
{
@ -451,7 +451,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
x = 5.0f;
y = 0.0f;
TextRender()->Text(GameInfo.x + x, GameInfo.y + y, 32, Localize("Game info"), 250.0f);
TextRender()->Text(GameInfo.x + x, GameInfo.y + y, 32, Localize("Game info"), -1.0f);
y += 32.0f + 5.0f;
if(m_pClient->m_Snap.m_pGameInfoObj)
@ -472,7 +472,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
Localize("Score limit"), m_pClient->m_Snap.m_pGameInfoObj->m_ScoreLimit,
Localize("Time limit"), m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit,
Localize("Players"), m_pClient->m_Snap.m_NumPlayers, CurrentServerInfo.m_MaxClients);
TextRender()->Text(GameInfo.x + x, GameInfo.y + y, 20, aBuf, 250.0f);
TextRender()->Text(GameInfo.x + x, GameInfo.y + y, 20, aBuf, GameInfo.w - 10.0f);
}
// motd