Print number of finished tees in /mapinfo as well

This commit is contained in:
def 2015-07-01 16:24:27 +02:00
parent b8c37bbeca
commit e552ef2643

View file

@ -532,7 +532,7 @@ void CSqlScore::MapInfoThread(void *pUser)
try
{
char aBuf[768];
str_format(aBuf, sizeof(aBuf), "SELECT l.Map, l.Server, Mapper, Points, Stars, (select count(Name) from record_race where Map = l.Map) as Finishes, UNIX_TIMESTAMP(l.Timestamp) as Stamp, UNIX_TIMESTAMP(CURRENT_TIMESTAMP)-UNIX_TIMESTAMP(l.Timestamp) as Ago FROM (SELECT * FROM %s_maps WHERE Map LIKE '%s' COLLATE utf8_general_ci ORDER BY LENGTH(Map), Map LIMIT 1) as l;", pData->m_pSqlData->m_pPrefix, pData->m_aMap, pData->m_pSqlData->m_pPrefix);
str_format(aBuf, sizeof(aBuf), "SELECT l.Map, l.Server, Mapper, Points, Stars, (select count(Name) from %s_race where Map = l.Map) as Finishes, (select count(distinct Name) from %s_race where Map = l.Map) as Finishers, UNIX_TIMESTAMP(l.Timestamp) as Stamp, UNIX_TIMESTAMP(CURRENT_TIMESTAMP)-UNIX_TIMESTAMP(l.Timestamp) as Ago FROM (SELECT * FROM %s_maps WHERE Map LIKE '%s' COLLATE utf8_general_ci ORDER BY LENGTH(Map), Map LIMIT 1) as l;", pData->m_pSqlData->m_pPrefix, pData->m_pSqlData->m_pPrefix, pData->m_pSqlData->m_pPrefix, pData->m_aMap, pData->m_pSqlData->m_pPrefix);
pData->m_pSqlData->m_pResults = pData->m_pSqlData->m_pStatement->executeQuery(aBuf);
if(pData->m_pSqlData->m_pResults->rowsCount() != 1)
@ -545,6 +545,7 @@ void CSqlScore::MapInfoThread(void *pUser)
int points = (int)pData->m_pSqlData->m_pResults->getInt("Points");
int stars = (int)pData->m_pSqlData->m_pResults->getInt("Stars");
int finishes = (int)pData->m_pSqlData->m_pResults->getInt("Finishes");
int finishers = (int)pData->m_pSqlData->m_pResults->getInt("Finishers");
char aMap[128];
strcpy(aMap, pData->m_pSqlData->m_pResults->getString("Map").c_str());
char aServer[32];
@ -574,7 +575,7 @@ void CSqlScore::MapInfoThread(void *pUser)
}
aServer[0] = toupper(aServer[0]);
str_format(aBuf, sizeof(aBuf), "\"%s\" by %s on %s (%s, %d %s, %d %s%s)", aMap, aMapper, aServer, aStars, points, points == 1 ? "point" : "points", finishes, finishes == 1 ? "finish" : "finishes", pReleasedString);
str_format(aBuf, sizeof(aBuf), "\"%s\" by %s on %s (%s, %d %s, %d %s by %s%s)", aMap, aMapper, aServer, aStars, points, points == 1 ? "point" : "points", finishes, finishes == 1 ? "finish" : "finishes", finishers, finishers == 1 ? "tee" : "tees", pReleasedString);
}
pData->m_pSqlData->GameServer()->SendChatTarget(pData->m_ClientID, aBuf);