Merge pull request #8989 from dobrykafe/pr-lan-page-message

Change LAN tab 'No servers found' message to include port range
This commit is contained in:
Dennis Felsing 2024-09-18 21:27:28 +00:00 committed by GitHub
commit 16adc7d645
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View file

@ -985,9 +985,9 @@ void CServerBrowser::Refresh(int Type, bool Force)
m_BroadcastTime = time_get(); m_BroadcastTime = time_get();
for(int i = 8303; i <= 8310; i++) for(int Port = LAN_PORT_BEGIN; Port <= LAN_PORT_END; Port++)
{ {
Packet.m_Address.port = i; Packet.m_Address.port = Port;
m_pNetClient->Send(&Packet); m_pNetClient->Send(&Packet);
} }

View file

@ -293,6 +293,9 @@ public:
TYPE_FAVORITE_COMMUNITY_4, TYPE_FAVORITE_COMMUNITY_4,
TYPE_FAVORITE_COMMUNITY_5, TYPE_FAVORITE_COMMUNITY_5,
NUM_TYPES, NUM_TYPES,
LAN_PORT_BEGIN = 8303,
LAN_PORT_END = 8310,
}; };
class CServerEntry class CServerEntry

View file

@ -215,9 +215,18 @@ void CMenus::RenderServerbrowserServerList(CUIRect View, bool &WasListboxItemAct
Ui()->DoLabel(&View, Localize("Getting server list from master server"), 16.0f, TEXTALIGN_MC); Ui()->DoLabel(&View, Localize("Getting server list from master server"), 16.0f, TEXTALIGN_MC);
} }
else if(!ServerBrowser()->NumServers()) else if(!ServerBrowser()->NumServers())
{
if(ServerBrowser()->GetCurrentType() == IServerBrowser::TYPE_LAN)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), Localize("No local servers found (ports %d-%d)"), IServerBrowser::LAN_PORT_BEGIN, IServerBrowser::LAN_PORT_END);
Ui()->DoLabel(&View, aBuf, 16.0f, TEXTALIGN_MC);
}
else
{ {
Ui()->DoLabel(&View, Localize("No servers found"), 16.0f, TEXTALIGN_MC); Ui()->DoLabel(&View, Localize("No servers found"), 16.0f, TEXTALIGN_MC);
} }
}
else if(ServerBrowser()->NumServers() && !NumServers) else if(ServerBrowser()->NumServers() && !NumServers)
{ {
CUIRect Label, ResetButton; CUIRect Label, ResetButton;