mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-20 07:13:56 -07:00
Warn if the derived class and the base class have the same AddSetting call instead of silently ignoring it.
Enabled byf69261d37b(refsd412b2010b/ D2314,7bb0f2ea69/ D2318). Helps structuring the GUI so that AddSetting and GetSetting are in the same file, which defragments code and may allow for future optimizations (setting values as class members for Draw calls), refs D2313. Differential Revision: https://code.wildfiregames.com/D2320 Tested on: clang 8.0.1, Jenkins This was SVN commit r22975.
This commit is contained in:
parent
cc494ec5df
commit
e67f364887
2 changed files with 4 additions and 8 deletions
|
|
@ -34,13 +34,11 @@ CDropDown::CDropDown(CGUI& pGUI)
|
|||
AddSetting<float>("dropdown_size");
|
||||
AddSetting<float>("dropdown_buffer");
|
||||
AddSetting<u32>("minimum_visible_items");
|
||||
// AddSetting<CStrW, "font");
|
||||
AddSetting<CStrW>("sound_closed");
|
||||
AddSetting<CStrW>("sound_disabled");
|
||||
AddSetting<CStrW>("sound_enter");
|
||||
AddSetting<CStrW>("sound_leave");
|
||||
AddSetting<CStrW>("sound_opened");
|
||||
AddSetting<CGUISpriteInstance>("sprite"); // Background that sits around the size
|
||||
// Setting "sprite" is registered by CList and used as the background
|
||||
AddSetting<CGUISpriteInstance>("sprite_disabled");
|
||||
AddSetting<CGUISpriteInstance>("sprite_list"); // Background of the drop down list
|
||||
AddSetting<CGUISpriteInstance>("sprite2"); // Button that sits to the right
|
||||
|
|
@ -52,7 +50,6 @@ CDropDown::CDropDown(CGUI& pGUI)
|
|||
// Add these in CList! And implement TODO
|
||||
//AddSetting<CGUIColor>("textcolor_over");
|
||||
//AddSetting<CGUIColor>("textcolor_pressed");
|
||||
AddSetting<CGUIColor>("textcolor_selected");
|
||||
AddSetting<CGUIColor>("textcolor_disabled");
|
||||
|
||||
// Scrollbar is forced to be true.
|
||||
|
|
|
|||
|
|
@ -116,11 +116,10 @@ void IGUIObject::AddToPointersMap(map_pObjects& ObjectMap)
|
|||
template<typename T>
|
||||
void IGUIObject::AddSetting(const CStr& Name)
|
||||
{
|
||||
// This can happen due to inheritance
|
||||
if (SettingExists(Name))
|
||||
return;
|
||||
|
||||
m_Settings[Name] = new CGUISetting<T>(*this, Name);
|
||||
LOGERROR("The setting '%s' already exists on the object '%s'!", Name.c_str(), GetPresentableName().c_str());
|
||||
else
|
||||
m_Settings.emplace(Name, new CGUISetting<T>(*this, Name));
|
||||
}
|
||||
|
||||
bool IGUIObject::SettingExists(const CStr& Setting) const
|
||||
|
|
|
|||
Loading…
Reference in a new issue