Fix server port in teehistorian

Official servers weren't affected because they didn't use the default of
`sv_port 0`.
This commit is contained in:
heinrich5991 2020-08-29 14:14:37 +02:00
parent 5f6df2b5a4
commit 31cfa9250d
4 changed files with 8 additions and 1 deletions

View file

@ -41,6 +41,7 @@ public:
int Tick() const { return m_CurrentGameTick; }
int TickSpeed() const { return m_TickSpeed; }
virtual int Port() const = 0;
virtual int MaxClients() const = 0;
virtual int ClientCount() = 0;
virtual int DistinctClientCount() = 0;

View file

@ -618,6 +618,11 @@ bool CServer::ClientAuthed(int ClientID)
return ClientID >= 0 && ClientID < MAX_CLIENTS && m_aClients[ClientID].m_Authed;
}
int CServer::Port() const
{
return m_NetServer.Address().port;
}
int CServer::MaxClients() const
{
return m_NetServer.MaxClients();

View file

@ -293,6 +293,7 @@ public:
int ClientCountry(int ClientID);
bool ClientIngame(int ClientID);
bool ClientAuthed(int ClientID);
int Port() const;
int MaxClients() const;
int ClientCount();
int DistinctClientCount();

View file

@ -3096,7 +3096,7 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/)
GameInfo.m_pPrngDescription = m_Prng.Description();
GameInfo.m_pServerName = g_Config.m_SvName;
GameInfo.m_ServerPort = g_Config.m_SvPort;
GameInfo.m_ServerPort = Server()->Port();
GameInfo.m_pGameType = m_pController->m_pGameType;
GameInfo.m_pConfig = &g_Config;