Merge pull request #1822 from Dune-jr/fix-countryflags

Fixed the selection of UK flags
This commit is contained in:
oy 2018-12-09 19:00:24 +01:00 committed by GitHub
commit 0e9b8aa220
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 6 deletions

View file

@ -155,8 +155,15 @@ const CCountryFlags::CCountryFlag *CCountryFlags::GetByCountryCode(int CountryCo
return GetByIndex(m_CodeIndexLUT[max(0, (CountryCode-CODE_LB)%CODE_RANGE)]);
}
const CCountryFlags::CCountryFlag *CCountryFlags::GetByIndex(int Index) const
const CCountryFlags::CCountryFlag *CCountryFlags::GetByIndex(int Index, bool SkipBlocked) const
{
if(SkipBlocked)
{
for(int i = 0; i < m_aCountryFlags.size(); i++)
if(!m_aCountryFlags[i].m_Blocked)
if(!Index--)
return &m_aCountryFlags[i];
}
return &m_aCountryFlags[max(0, Index%m_aCountryFlags.size())];
}

View file

@ -23,7 +23,7 @@ public:
int Num() const;
const CCountryFlag *GetByCountryCode(int CountryCode) const;
const CCountryFlag *GetByIndex(int Index) const;
const CCountryFlag *GetByIndex(int Index, bool SkipBlocked = false) const;
void Render(int CountryCode, const vec4 *pColor, float x, float y, float w, float h, bool AllowBlocked=false);
private:

View file

@ -2043,7 +2043,7 @@ int CMenus::Render()
const int NewSelected = UiDoListboxEnd(&s_ListBoxState, 0);
if(OldSelected != NewSelected)
ActSelection = m_pClient->m_pCountryFlags->GetByIndex(NewSelected)->m_CountryCode;
ActSelection = m_pClient->m_pCountryFlags->GetByIndex(NewSelected, true)->m_CountryCode;
Part.VMargin(120.0f, &Part);

View file

@ -1202,9 +1202,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
const int NewSelected = UiDoListboxEnd(&s_ListBoxState, 0);
if(OldSelected != NewSelected)
{
g_Config.m_PlayerCountry = m_pClient->m_pCountryFlags->GetByIndex(NewSelected)->m_CountryCode;
}
g_Config.m_PlayerCountry = m_pClient->m_pCountryFlags->GetByIndex(NewSelected, true)->m_CountryCode;
}
void CMenus::RenderSettingsTeeBasic(CUIRect MainView)