Merge pull request #8829 from furo321/use-getmapname

Use `GetMapName()` when getting the map name
This commit is contained in:
Dennis Felsing 2024-08-27 21:16:12 +00:00 committed by GitHub
commit 76c44cfb40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 10 deletions

View file

@ -2341,7 +2341,7 @@ void CServer::UpdateRegisterServerInfo()
JsonWriter.WriteAttribute("map"); JsonWriter.WriteAttribute("map");
JsonWriter.BeginObject(); JsonWriter.BeginObject();
JsonWriter.WriteAttribute("name"); JsonWriter.WriteAttribute("name");
JsonWriter.WriteStrValue(m_aCurrentMap); JsonWriter.WriteStrValue(GetMapName());
JsonWriter.WriteAttribute("sha256"); JsonWriter.WriteAttribute("sha256");
JsonWriter.WriteStrValue(aMapSha256); JsonWriter.WriteStrValue(aMapSha256);
JsonWriter.WriteAttribute("size"); JsonWriter.WriteAttribute("size");

View file

@ -565,7 +565,7 @@ void CGameContext::ConMapInfo(IConsole::IResult *pResult, void *pUserData)
if(pResult->NumArguments() > 0) if(pResult->NumArguments() > 0)
pSelf->Score()->MapInfo(pResult->m_ClientId, pResult->GetString(0)); pSelf->Score()->MapInfo(pResult->m_ClientId, pResult->GetString(0));
else else
pSelf->Score()->MapInfo(pResult->m_ClientId, g_Config.m_SvMap); pSelf->Score()->MapInfo(pResult->m_ClientId, pSelf->Server()->GetMapName());
} }
void CGameContext::ConTimeout(IConsole::IResult *pResult, void *pUserData) void CGameContext::ConTimeout(IConsole::IResult *pResult, void *pUserData)

View file

@ -37,7 +37,7 @@ void CScore::ExecPlayerThread(
return; return;
auto Tmp = std::make_unique<CSqlPlayerRequest>(pResult); auto Tmp = std::make_unique<CSqlPlayerRequest>(pResult);
str_copy(Tmp->m_aName, pName, sizeof(Tmp->m_aName)); str_copy(Tmp->m_aName, pName, sizeof(Tmp->m_aName));
str_copy(Tmp->m_aMap, g_Config.m_SvMap, sizeof(Tmp->m_aMap)); str_copy(Tmp->m_aMap, Server()->GetMapName(), sizeof(Tmp->m_aMap));
str_copy(Tmp->m_aServer, g_Config.m_SvSqlServerName, sizeof(Tmp->m_aServer)); str_copy(Tmp->m_aServer, g_Config.m_SvSqlServerName, sizeof(Tmp->m_aServer));
str_copy(Tmp->m_aRequestingPlayer, Server()->ClientName(ClientId), sizeof(Tmp->m_aRequestingPlayer)); str_copy(Tmp->m_aRequestingPlayer, Server()->ClientName(ClientId), sizeof(Tmp->m_aRequestingPlayer));
Tmp->m_Offset = Offset; Tmp->m_Offset = Offset;
@ -113,7 +113,7 @@ void CScore::LoadBestTime()
m_pGameServer->m_pController->m_pLoadBestTimeResult = LoadBestTimeResult; m_pGameServer->m_pController->m_pLoadBestTimeResult = LoadBestTimeResult;
auto Tmp = std::make_unique<CSqlLoadBestTimeData>(LoadBestTimeResult); auto Tmp = std::make_unique<CSqlLoadBestTimeData>(LoadBestTimeResult);
str_copy(Tmp->m_aMap, g_Config.m_SvMap, sizeof(Tmp->m_aMap)); str_copy(Tmp->m_aMap, Server()->GetMapName(), sizeof(Tmp->m_aMap));
m_pPool->Execute(CScoreWorker::LoadBestTime, std::move(Tmp), "load best time"); m_pPool->Execute(CScoreWorker::LoadBestTime, std::move(Tmp), "load best time");
} }
@ -154,7 +154,7 @@ void CScore::SaveScore(int ClientId, int TimeTicks, const char *pTimestamp, cons
dbg_msg("sql", "WARNING: previous save score result didn't complete, overwriting it now"); dbg_msg("sql", "WARNING: previous save score result didn't complete, overwriting it now");
pCurPlayer->m_ScoreFinishResult = std::make_shared<CScorePlayerResult>(); pCurPlayer->m_ScoreFinishResult = std::make_shared<CScorePlayerResult>();
auto Tmp = std::make_unique<CSqlScoreData>(pCurPlayer->m_ScoreFinishResult); auto Tmp = std::make_unique<CSqlScoreData>(pCurPlayer->m_ScoreFinishResult);
str_copy(Tmp->m_aMap, g_Config.m_SvMap, sizeof(Tmp->m_aMap)); str_copy(Tmp->m_aMap, Server()->GetMapName(), sizeof(Tmp->m_aMap));
FormatUuid(GameServer()->GameUuid(), Tmp->m_aGameUuid, sizeof(Tmp->m_aGameUuid)); FormatUuid(GameServer()->GameUuid(), Tmp->m_aGameUuid, sizeof(Tmp->m_aGameUuid));
Tmp->m_ClientId = ClientId; Tmp->m_ClientId = ClientId;
str_copy(Tmp->m_aName, Server()->ClientName(ClientId), sizeof(Tmp->m_aName)); str_copy(Tmp->m_aName, Server()->ClientName(ClientId), sizeof(Tmp->m_aName));
@ -186,7 +186,7 @@ void CScore::SaveTeamScore(int Team, int *pClientIds, unsigned int Size, int Tim
Tmp->m_Time = (float)TimeTicks / (float)Server()->TickSpeed(); Tmp->m_Time = (float)TimeTicks / (float)Server()->TickSpeed();
str_copy(Tmp->m_aTimestamp, pTimestamp, sizeof(Tmp->m_aTimestamp)); str_copy(Tmp->m_aTimestamp, pTimestamp, sizeof(Tmp->m_aTimestamp));
FormatUuid(GameServer()->GameUuid(), Tmp->m_aGameUuid, sizeof(Tmp->m_aGameUuid)); FormatUuid(GameServer()->GameUuid(), Tmp->m_aGameUuid, sizeof(Tmp->m_aGameUuid));
str_copy(Tmp->m_aMap, g_Config.m_SvMap, sizeof(Tmp->m_aMap)); str_copy(Tmp->m_aMap, Server()->GetMapName(), sizeof(Tmp->m_aMap));
Tmp->m_TeamrankUuid = RandomUuid(); Tmp->m_TeamrankUuid = RandomUuid();
m_pPool->ExecuteWrite(CScoreWorker::SaveTeamScore, std::move(Tmp), "save team score"); m_pPool->ExecuteWrite(CScoreWorker::SaveTeamScore, std::move(Tmp), "save team score");
@ -262,7 +262,7 @@ void CScore::RandomMap(int ClientId, int Stars)
auto Tmp = std::make_unique<CSqlRandomMapRequest>(pResult); auto Tmp = std::make_unique<CSqlRandomMapRequest>(pResult);
Tmp->m_Stars = Stars; Tmp->m_Stars = Stars;
str_copy(Tmp->m_aCurrentMap, g_Config.m_SvMap, sizeof(Tmp->m_aCurrentMap)); str_copy(Tmp->m_aCurrentMap, Server()->GetMapName(), sizeof(Tmp->m_aCurrentMap));
str_copy(Tmp->m_aServerType, g_Config.m_SvServerType, sizeof(Tmp->m_aServerType)); str_copy(Tmp->m_aServerType, g_Config.m_SvServerType, sizeof(Tmp->m_aServerType));
str_copy(Tmp->m_aRequestingPlayer, GameServer()->Server()->ClientName(ClientId), sizeof(Tmp->m_aRequestingPlayer)); str_copy(Tmp->m_aRequestingPlayer, GameServer()->Server()->ClientName(ClientId), sizeof(Tmp->m_aRequestingPlayer));
@ -276,7 +276,7 @@ void CScore::RandomUnfinishedMap(int ClientId, int Stars)
auto Tmp = std::make_unique<CSqlRandomMapRequest>(pResult); auto Tmp = std::make_unique<CSqlRandomMapRequest>(pResult);
Tmp->m_Stars = Stars; Tmp->m_Stars = Stars;
str_copy(Tmp->m_aCurrentMap, g_Config.m_SvMap, sizeof(Tmp->m_aCurrentMap)); str_copy(Tmp->m_aCurrentMap, Server()->GetMapName(), sizeof(Tmp->m_aCurrentMap));
str_copy(Tmp->m_aServerType, g_Config.m_SvServerType, sizeof(Tmp->m_aServerType)); str_copy(Tmp->m_aServerType, g_Config.m_SvServerType, sizeof(Tmp->m_aServerType));
str_copy(Tmp->m_aRequestingPlayer, GameServer()->Server()->ClientName(ClientId), sizeof(Tmp->m_aRequestingPlayer)); str_copy(Tmp->m_aRequestingPlayer, GameServer()->Server()->ClientName(ClientId), sizeof(Tmp->m_aRequestingPlayer));
@ -310,7 +310,7 @@ void CScore::SaveTeam(int ClientId, const char *pCode, const char *pServer)
auto Tmp = std::make_unique<CSqlTeamSave>(SaveResult); auto Tmp = std::make_unique<CSqlTeamSave>(SaveResult);
str_copy(Tmp->m_aCode, pCode, sizeof(Tmp->m_aCode)); 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, Server()->GetMapName(), sizeof(Tmp->m_aMap));
str_copy(Tmp->m_aServer, pServer, sizeof(Tmp->m_aServer)); str_copy(Tmp->m_aServer, pServer, sizeof(Tmp->m_aServer));
str_copy(Tmp->m_aClientName, this->Server()->ClientName(ClientId), sizeof(Tmp->m_aClientName)); str_copy(Tmp->m_aClientName, this->Server()->ClientName(ClientId), sizeof(Tmp->m_aClientName));
Tmp->m_aGeneratedCode[0] = '\0'; Tmp->m_aGeneratedCode[0] = '\0';
@ -372,7 +372,7 @@ void CScore::LoadTeam(const char *pCode, int ClientId)
pController->Teams().SetSaving(Team, SaveResult); pController->Teams().SetSaving(Team, SaveResult);
auto Tmp = std::make_unique<CSqlTeamLoad>(SaveResult); auto Tmp = std::make_unique<CSqlTeamLoad>(SaveResult);
str_copy(Tmp->m_aCode, pCode, sizeof(Tmp->m_aCode)); 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, Server()->GetMapName(), sizeof(Tmp->m_aMap));
Tmp->m_ClientId = ClientId; Tmp->m_ClientId = ClientId;
str_copy(Tmp->m_aRequestingPlayer, Server()->ClientName(ClientId), sizeof(Tmp->m_aRequestingPlayer)); str_copy(Tmp->m_aRequestingPlayer, Server()->ClientName(ClientId), sizeof(Tmp->m_aRequestingPlayer));
Tmp->m_NumPlayer = 0; Tmp->m_NumPlayer = 0;