1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Merge pull request #2151 from IvanSavenko/fix_advmap

Fix regressions from adventure map PR
This commit is contained in:
Ivan Savenko
2023-05-13 00:56:16 +03:00
committed by GitHub
3 changed files with 16 additions and 2 deletions

View File

@@ -300,7 +300,7 @@ std::shared_ptr<CToggleButton> InterfaceObjectConfigurable::buildToggleButton(co
assert(imgOrder.size() >= 4);
button->setImageOrder(imgOrder[0].Integer(), imgOrder[1].Integer(), imgOrder[2].Integer(), imgOrder[3].Integer());
}
loadButtonCallback(button, config["callback"]);
loadToggleButtonCallback(button, config["callback"]);
return button;
}
@@ -340,6 +340,19 @@ void InterfaceObjectConfigurable::loadButtonBorderColor(std::shared_ptr<CButton>
button->setBorderColor(color);
}
void InterfaceObjectConfigurable::loadToggleButtonCallback(std::shared_ptr<CToggleButton> button, const JsonNode & config) const
{
if(config.isNull())
return;
std::string callbackName = config.String();
if (callbacks.count(callbackName) > 0)
button->addCallback(callbacks.at(callbackName));
else
logGlobal->error("Invalid callback '%s' in widget", callbackName );
}
void InterfaceObjectConfigurable::loadButtonCallback(std::shared_ptr<CButton> button, const JsonNode & config) const
{
if(config.isNull())

View File

@@ -75,6 +75,7 @@ protected:
std::pair<std::string, std::string> readHintText(const JsonNode &) const;
EShortcut readHotkey(const JsonNode &) const;
void loadToggleButtonCallback(std::shared_ptr<CToggleButton> button, const JsonNode & config) const;
void loadButtonCallback(std::shared_ptr<CButton> button, const JsonNode & config) const;
void loadButtonHotkey(std::shared_ptr<CButton> button, const JsonNode & config) const;
void loadButtonBorderColor(std::shared_ptr<CButton> button, const JsonNode & config) const;

View File

@@ -68,7 +68,7 @@
"text": "vcmi.systemOptions.scalingButton.hover"
},
{
"name": "resolutionButton",
"name": "scalingButton",
"type": "button",
"position": {"x": 10, "y": 113},
"image": "settingsWindow/button32",