mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 01:24:18 +00:00
4910: Fix /top5 inconvenience / local ranking problem r=def- a=srdante Fixes #4810 Solution based on the suggestion from `@def-` . <!-- What is the motivation for the changes of this pull request --> ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) 4912: update catalan translation r=def- a=edg-l <!-- What is the motivation for the changes of this pull request --> ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: srdante <minidantebtc@gmail.com> Co-authored-by: Edgar Luque <git@edgarluque.com>
This commit is contained in:
commit
68470cc6b0
|
@ -1301,46 +1301,46 @@ CHN
|
|||
== CHN
|
||||
|
||||
The format of texture %s is not RGBA which will cause visual bugs.
|
||||
==
|
||||
== El format de la textura %s no és RGBA i pot causar errors visuals.
|
||||
|
||||
Join Tutorial Server
|
||||
==
|
||||
== Entrar al tutorial
|
||||
|
||||
Skip Tutorial
|
||||
==
|
||||
== Saltar el Tutorial
|
||||
|
||||
Settings file
|
||||
==
|
||||
== Arxiu de configuració
|
||||
|
||||
Config directory
|
||||
==
|
||||
== Directori amb la configuració
|
||||
|
||||
Windowed fullscreen
|
||||
==
|
||||
== Windowed fullscreen
|
||||
|
||||
Renderer
|
||||
==
|
||||
== Renderitzador
|
||||
|
||||
default
|
||||
==
|
||||
== predeterminat
|
||||
|
||||
custom
|
||||
==
|
||||
== personalitzat
|
||||
|
||||
Graphics cards
|
||||
==
|
||||
== Tarjetes gràfiques
|
||||
|
||||
auto
|
||||
==
|
||||
== auto
|
||||
|
||||
Run on join
|
||||
==
|
||||
== Córrer en unir-se
|
||||
|
||||
Chat command (e.g. showall 1)
|
||||
==
|
||||
== Commanda del xat (e.g showall 1)
|
||||
|
||||
Tutorial
|
||||
==
|
||||
== Tutorial
|
||||
|
||||
Can't find a Tutorial server
|
||||
==
|
||||
== No s'ha pogut trobar un servidor del tutorial
|
||||
|
|
|
@ -779,9 +779,9 @@ bool CScoreWorker::ShowTop(IDbConnection *pSqlServer, const ISqlData *pGameData,
|
|||
// check sort method
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf),
|
||||
"SELECT Name, Time, Ranking, Server "
|
||||
"SELECT Name, Time, Ranking "
|
||||
"FROM ("
|
||||
" SELECT RANK() OVER w AS Ranking, MIN(Time) AS Time, MAX(Server) AS Server, Name "
|
||||
" SELECT RANK() OVER w AS Ranking, MIN(Time) AS Time, Name "
|
||||
" FROM %s_race "
|
||||
" WHERE Map = ? "
|
||||
" AND Server LIKE ? "
|
||||
|
@ -809,7 +809,6 @@ bool CScoreWorker::ShowTop(IDbConnection *pSqlServer, const ISqlData *pGameData,
|
|||
|
||||
char aTime[32];
|
||||
bool End = false;
|
||||
bool HasLocal = false;
|
||||
|
||||
while(!pSqlServer->Step(&End, pError, ErrorSize) && !End)
|
||||
{
|
||||
|
@ -821,48 +820,35 @@ bool CScoreWorker::ShowTop(IDbConnection *pSqlServer, const ISqlData *pGameData,
|
|||
str_format(pResult->m_Data.m_aaMessages[Line], sizeof(pResult->m_Data.m_aaMessages[Line]),
|
||||
"%d. %s Time: %s", Rank, aName, aTime);
|
||||
|
||||
char aRecordServer[6];
|
||||
pSqlServer->GetString(4, aRecordServer, sizeof(aRecordServer));
|
||||
|
||||
HasLocal = HasLocal || str_comp(aRecordServer, pData->m_aServer) == 0;
|
||||
|
||||
Line++;
|
||||
}
|
||||
|
||||
if(!HasLocal)
|
||||
char aServerLike[16];
|
||||
str_format(aServerLike, sizeof(aServerLike), "%%%s%%", pData->m_aServer);
|
||||
|
||||
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
|
||||
{
|
||||
char aServerLike[16];
|
||||
str_format(aServerLike, sizeof(aServerLike), "%%%s%%", pData->m_aServer);
|
||||
return true;
|
||||
}
|
||||
pSqlServer->BindString(1, pData->m_aMap);
|
||||
pSqlServer->BindString(2, aServerLike);
|
||||
pSqlServer->BindInt(3, 3);
|
||||
|
||||
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
pSqlServer->BindString(1, pData->m_aMap);
|
||||
pSqlServer->BindString(2, aServerLike);
|
||||
pSqlServer->BindInt(3, 3);
|
||||
str_format(pResult->m_Data.m_aaMessages[Line], sizeof(pResult->m_Data.m_aaMessages[Line]),
|
||||
"------------ %s Top ------------", pData->m_aServer);
|
||||
Line++;
|
||||
|
||||
// show top
|
||||
while(!pSqlServer->Step(&End, pError, ErrorSize) && !End)
|
||||
{
|
||||
char aName[MAX_NAME_LENGTH];
|
||||
pSqlServer->GetString(1, aName, sizeof(aName));
|
||||
float Time = pSqlServer->GetFloat(2);
|
||||
str_time_float(Time, TIME_HOURS_CENTISECS, aTime, sizeof(aTime));
|
||||
int Rank = pSqlServer->GetInt(3);
|
||||
str_format(pResult->m_Data.m_aaMessages[Line], sizeof(pResult->m_Data.m_aaMessages[Line]),
|
||||
"------------ %s Top ------------", pData->m_aServer);
|
||||
"%d. %s Time: %s", Rank, aName, aTime);
|
||||
Line++;
|
||||
|
||||
// show top
|
||||
while(!pSqlServer->Step(&End, pError, ErrorSize) && !End)
|
||||
{
|
||||
char aName[MAX_NAME_LENGTH];
|
||||
pSqlServer->GetString(1, aName, sizeof(aName));
|
||||
float Time = pSqlServer->GetFloat(2);
|
||||
str_time_float(Time, TIME_HOURS_CENTISECS, aTime, sizeof(aTime));
|
||||
int Rank = pSqlServer->GetInt(3);
|
||||
str_format(pResult->m_Data.m_aaMessages[Line], sizeof(pResult->m_Data.m_aaMessages[Line]),
|
||||
"%d. %s Time: %s", Rank, aName, aTime);
|
||||
Line++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
str_copy(pResult->m_Data.m_aaMessages[Line], "---------------------------------------",
|
||||
sizeof(pResult->m_Data.m_aaMessages[Line]));
|
||||
}
|
||||
|
||||
return !End;
|
||||
|
|
|
@ -164,7 +164,8 @@ TEST_P(SingleScore, TopServer)
|
|||
ExpectLines(m_pPlayerResult,
|
||||
{"------------ Global Top ------------",
|
||||
"1. nameless tee Time: 01:40.00",
|
||||
"---------------------------------------"});
|
||||
"------------ USA Top ------------",
|
||||
"1. nameless tee Time: 01:40.00"});
|
||||
}
|
||||
|
||||
TEST_P(SingleScore, RankServer)
|
||||
|
|
Loading…
Reference in a new issue