diff --git a/datasrc/countryflags/index.json b/datasrc/countryflags/index.json index 601690480..dd10f6e3e 100644 --- a/datasrc/countryflags/index.json +++ b/datasrc/countryflags/index.json @@ -22,19 +22,23 @@ }, { "id": "XBZ", - "code": 950 + "code": 950, + "blocked": true }, { "id": "XCA", - "code": 951 + "code": 951, + "blocked": true }, { "id": "XES", - "code": 952 + "code": 952, + "blovked": true }, { "id": "XGA", - "code": 953 + "code": 953, + "blocked": true }, { "id": "default", diff --git a/src/game/client/components/countryflags.cpp b/src/game/client/components/countryflags.cpp index 2182d890b..cb1936f24 100644 --- a/src/game/client/components/countryflags.cpp +++ b/src/game/client/components/countryflags.cpp @@ -88,6 +88,11 @@ void CCountryFlags::LoadCountryflagsIndexfile() CountryFlag.m_Texture = Graphics()->LoadTextureRaw(Info.m_Width, Info.m_Height, Info.m_Format, Info.m_pData, Info.m_Format, 0); mem_free(Info.m_pData); } + // blocked? + CountryFlag.m_Blocked = false; + const json_value Check = rStart[i]["blocked"]; + if(Check.type == json_boolean && Check) + CountryFlag.m_Blocked = true; m_aCountryFlags.add_unsorted(CountryFlag); // print message @@ -134,6 +139,7 @@ void CCountryFlags::OnInit() Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "countryflags", "failed to load country flags. folder='countryflags/'"); CCountryFlag DummyEntry; DummyEntry.m_CountryCode = -1; + DummyEntry.m_Blocked = false; mem_zero(DummyEntry.m_aCountryCodeString, sizeof(DummyEntry.m_aCountryCodeString)); m_aCountryFlags.add(DummyEntry); } @@ -154,9 +160,11 @@ const CCountryFlags::CCountryFlag *CCountryFlags::GetByIndex(int Index) const return &m_aCountryFlags[max(0, Index%m_aCountryFlags.size())]; } -void CCountryFlags::Render(int CountryCode, const vec4 *pColor, float x, float y, float w, float h) +void CCountryFlags::Render(int CountryCode, const vec4 *pColor, float x, float y, float w, float h, bool AllowBlocked) { const CCountryFlag *pFlag = GetByCountryCode(CountryCode); + if(!AllowBlocked && pFlag->m_Blocked) + pFlag = GetByCountryCode(-1); if(pFlag->m_Texture.IsValid()) { Graphics()->TextureSet(pFlag->m_Texture); diff --git a/src/game/client/components/countryflags.h b/src/game/client/components/countryflags.h index 3d21cd8ea..2ac57c959 100644 --- a/src/game/client/components/countryflags.h +++ b/src/game/client/components/countryflags.h @@ -13,6 +13,7 @@ public: { int m_CountryCode; char m_aCountryCodeString[8]; + bool m_Blocked; IGraphics::CTextureHandle m_Texture; bool operator<(const CCountryFlag &Other) { return str_comp(m_aCountryCodeString, Other.m_aCountryCodeString) < 0; } @@ -23,7 +24,7 @@ public: int Num() const; const CCountryFlag *GetByCountryCode(int CountryCode) const; const CCountryFlag *GetByIndex(int Index) const; - void Render(int CountryCode, const vec4 *pColor, float x, float y, float w, float h); + void Render(int CountryCode, const vec4 *pColor, float x, float y, float w, float h, bool AllowBlocked=false); private: enum diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 38708c6dc..28c203e00 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -1999,6 +1999,8 @@ int CMenus::Render() for(int i = 0; i < m_pClient->m_pCountryFlags->Num(); ++i) { const CCountryFlags::CCountryFlag *pEntry = m_pClient->m_pCountryFlags->GetByIndex(i); + if(pEntry->m_Blocked) + continue; if(pEntry->m_CountryCode == ActSelection) OldSelected = i; diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 2568db611..dea680ea6 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -745,7 +745,7 @@ void CMenus::RenderLanguageSelection(CUIRect MainView, bool Header) Rect.VMargin(6.0f, &Rect); Rect.HMargin(3.0f, &Rect); vec4 Color(1.0f, 1.0f, 1.0f, 1.0f); - m_pClient->m_pCountryFlags->Render(r.front().m_CountryCode, &Color, Rect.x, Rect.y, Rect.w, Rect.h); + m_pClient->m_pCountryFlags->Render(r.front().m_CountryCode, &Color, Rect.x, Rect.y, Rect.w, Rect.h, true); Item.m_Rect.y += 2.0f; if(s_SelectedLanguage != -1 && !str_comp(s_Languages[s_SelectedLanguage].m_Name, r.front().m_Name)) { @@ -1149,6 +1149,8 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView) for(int i = 0; i < m_pClient->m_pCountryFlags->Num(); ++i) { const CCountryFlags::CCountryFlag *pEntry = m_pClient->m_pCountryFlags->GetByIndex(i); + if(pEntry->m_Blocked) + continue; if(pEntry->m_CountryCode == g_Config.m_PlayerCountry) OldSelected = i;