fix map name being updated before OnMapChange(...) call

This commit is contained in:
Vlad 2024-02-29 00:21:38 +03:00
parent deae4ff920
commit f74ebfe3e8
2 changed files with 6 additions and 5 deletions

View file

@ -2504,11 +2504,12 @@ void CServer::PumpNetwork(bool PacketWaiting)
const char *CServer::GetMapName() const
{
// get the name of the map without his path
const char *pMapShortName = &Config()->m_SvMap[0];
for(int i = 0; i < str_length(Config()->m_SvMap) - 1; i++)
const char *pMapName = m_aCurrentMap;
const char *pMapShortName = pMapName;
for(int i = 0; i < str_length(pMapName) - 1; i++)
{
if(Config()->m_SvMap[i] == '/' || Config()->m_SvMap[i] == '\\')
pMapShortName = &Config()->m_SvMap[i + 1];
if(pMapName[i] == '/' || pMapName[i] == '\\')
pMapShortName = &pMapName[i + 1];
}
return pMapShortName;
}

View file

@ -300,7 +300,7 @@ void CScore::SaveTeam(int ClientID, const char *pCode, const char *pServer, bool
auto Tmp = std::make_unique<CSqlTeamSave>(SaveResult);
str_copy(Tmp->m_aCode, pCode, sizeof(Tmp->m_aCode));
str_copy(Tmp->m_aMap, g_Config.m_SvMap, sizeof(Tmp->m_aMap));
str_copy(Tmp->m_aMap, this->Server()->GetMapName(), sizeof(Tmp->m_aMap));
str_copy(Tmp->m_aServer, pServer, sizeof(Tmp->m_aServer));
str_copy(Tmp->m_aClientName, this->Server()->ClientName(ClientID), sizeof(Tmp->m_aClientName));
Tmp->m_aGeneratedCode[0] = '\0';