mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-29 00:41:38 +02:00
Do not show desktop-only options on mobile systems
This commit is contained in:
@ -115,6 +115,11 @@ void InterfaceObjectConfigurable::build(const JsonNode &config)
|
||||
addWidget(item["name"].String(), buildWidget(item));
|
||||
}
|
||||
|
||||
void InterfaceObjectConfigurable::addConditional(const std::string & name, bool active)
|
||||
{
|
||||
conditionals[name] = active;
|
||||
}
|
||||
|
||||
void InterfaceObjectConfigurable::addWidget(const std::string & namePreferred, std::shared_ptr<CIntObject> widget)
|
||||
{
|
||||
static const std::string unnamedObjectPrefix = "__widget_";
|
||||
@ -502,6 +507,21 @@ std::shared_ptr<CIntObject> InterfaceObjectConfigurable::buildLayout(const JsonN
|
||||
if (item["type"].String().empty())
|
||||
item["type"].String() = customType;
|
||||
|
||||
if (!item["created"].isNull())
|
||||
{
|
||||
std::string name = item["created"].String();
|
||||
|
||||
if (conditionals.count(name) != 0)
|
||||
{
|
||||
if (!conditionals.at(name))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
logMod->warn("Unknown condition %s in widget!", name);
|
||||
}
|
||||
}
|
||||
|
||||
auto widget = buildWidget(item);
|
||||
|
||||
addWidget(item["name"].String(), widget);
|
||||
|
Reference in New Issue
Block a user