Send result of random_unfinished_map to all clients

This commit is contained in:
bencie 2024-08-27 15:45:42 +02:00
parent 3a2cecb8b4
commit c4ff37d9d9
3 changed files with 4 additions and 3 deletions

View file

@ -1277,7 +1277,7 @@ void CGameContext::OnTick()
if(m_SqlRandomMapResult->m_Success)
{
if(PlayerExists(m_SqlRandomMapResult->m_ClientId) && m_SqlRandomMapResult->m_aMessage[0] != '\0')
SendChatTarget(m_SqlRandomMapResult->m_ClientId, m_SqlRandomMapResult->m_aMessage);
SendChat(-1, TEAM_ALL, m_SqlRandomMapResult->m_aMessage);
if(m_SqlRandomMapResult->m_aMap[0] != '\0')
Server()->ChangeMap(m_SqlRandomMapResult->m_aMap);
else

View file

@ -1560,7 +1560,8 @@ bool CScoreWorker::RandomUnfinishedMap(IDbConnection *pSqlServer, const ISqlData
}
else
{
str_copy(pResult->m_aMessage, "You have no more unfinished maps on this server!", sizeof(pResult->m_aMessage));
str_format(aBuf, sizeof(aBuf), "%s has no more unfinished maps on this server!", pData->m_aRequestingPlayer);
str_copy(pResult->m_aMessage, aBuf, sizeof(pResult->m_aMessage));
}
return false;
}

View file

@ -580,7 +580,7 @@ TEST_P(RandomMap, UnfinishedDoesntExist)
ASSERT_FALSE(CScoreWorker::RandomUnfinishedMap(m_pConn, &m_RandomMapRequest, m_aError, sizeof(m_aError))) << m_aError;
EXPECT_EQ(m_pRandomMapResult->m_ClientId, 0);
EXPECT_STREQ(m_pRandomMapResult->m_aMap, "");
EXPECT_STREQ(m_pRandomMapResult->m_aMessage, "You have no more unfinished maps on this server!");
EXPECT_STREQ(m_pRandomMapResult->m_aMessage, "nameless tee has no more unfinished maps on this server!");
}
auto g_pSqliteConn = CreateSqliteConnection(":memory:", true);