3129: Editor: Fix selection of None value in auto rules (fixes #3013) r=Jupeyy a=def-

by starting the indexing at 0

3138: Fix out of bounds access in GetSolo r=Jupeyy a=def-

As discovered in #3135

3143: Ignore ddnet-info.json dl failure again r=Jupeyy a=def-

too aggressive, might just be bad internet at the moment

Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
bors[bot] 2020-10-19 12:46:44 +00:00 committed by GitHub
commit aca143cb7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View file

@ -2874,7 +2874,6 @@ void CClient::Update()
FinishDDNetInfo();
else if(m_pDDNetInfoTask->State() == HTTP_ERROR)
{
m_Warnings.emplace_back(SWarning(Localize("Downloading ddnet-info.json failed")));
Storage()->RemoveFile(m_aDDNetInfoTmp, IStorage::TYPE_SAVE);
ResetDDNetInfo();
}

View file

@ -1490,7 +1490,7 @@ int CEditor::PopupSelectConfigAutoMap(CEditor *pEditor, CUIRect View, void *pCon
pEditor->UI()->ClipEnable(&View);
for(int i = -1; i < pAutoMapper->ConfigNamesNum(); i++)
for(int i = 0; i < pAutoMapper->ConfigNamesNum() + 1; i++)
{
if(ListCur > ListStopAt)
break;
@ -1499,8 +1499,10 @@ int CEditor::PopupSelectConfigAutoMap(CEditor *pEditor, CUIRect View, void *pCon
{
View.HSplitTop(ButtonMargin, 0, &View);
View.HSplitTop(ButtonHeight, &Button, &View);
if(pEditor->DoButton_MenuItem(&s_AutoMapperConfigButtons[i], i == -1 ? "None" : pAutoMapper->GetConfigName(i), i == s_AutoMapConfigCurrent, &Button, 0, 0))
if(pEditor->DoButton_MenuItem(&s_AutoMapperConfigButtons[i], i == 0 ? "None" : pAutoMapper->GetConfigName(i - 1), i == s_AutoMapConfigCurrent, &Button, 0, 0))
{
s_AutoMapConfigSelected = i;
}
}
ListCur += ButtonHeight + ButtonMargin;
}
@ -1530,7 +1532,7 @@ int CEditor::PopupSelectConfigAutoMapResult()
s_AutoMapConfigCurrent = s_AutoMapConfigSelected;
s_AutoMapConfigSelected = -100;
return s_AutoMapConfigCurrent;
return s_AutoMapConfigCurrent - 1;
}
// DDRace

View file

@ -37,6 +37,8 @@ public:
bool GetSolo(int ClientID) const
{
if(ClientID < 0 || ClientID >= MAX_CLIENTS)
return false;
return m_IsSolo[ClientID];
}
};