1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fixed map options to support adventure map rewrite

This commit is contained in:
Ivan Savenko 2023-03-05 20:14:23 +02:00
parent 95440ad540
commit 37b2fb7ff3
2 changed files with 31 additions and 14 deletions

View File

@ -40,25 +40,42 @@ AdventureOptionsTab::AdventureOptionsTab()
addCallback("playerHeroSpeedChanged", [this](int value)
{
auto targetLabel = widget<CLabel>("heroSpeedValueLabel");
int valuePercentage = value / 50; // H3 max value is "50", displaying it to be 100%
if (targetLabel)
targetLabel->setText(std::to_string(valuePercentage) + "%");
return setIntSetting("adventure", "heroMoveTime", value);
{
if (value <= 0)
{
targetLabel->setText("-");
}
else
{
int valuePercentage = 100 * 100 / value;
targetLabel->setText(std::to_string(valuePercentage) + "%");
}
}
setIntSetting("adventure", "heroMoveTime", value);
});
addCallback("enemyHeroSpeedChanged", [this](int value)
{
auto targetLabel = widget<CLabel>("enemySpeedValueLabel");
int valuePercentage = value / 50; // H3 max value is "50", displaying it to be 100%
if (targetLabel)
targetLabel->setText(std::to_string(valuePercentage) + "%");
return setIntSetting("adventure", "enemyMoveTime", value);
if (targetLabel)
{
if (value <= 0)
{
targetLabel->setText("-");
}
else
{
int valuePercentage = 100 * 100 / value;
targetLabel->setText(std::to_string(valuePercentage) + "%");
}
}
setIntSetting("adventure", "enemyMoveTime", value);
});
addCallback("mapScrollSpeedChanged", [this](int value)
{
auto targetLabel = widget<CLabel>("mapScrollingValueLabel");
int valuePercentage = value / 1200; // H3 max value is "1200", displaying it to be 100%
int valuePercentage = 100 * value / 1200; // H3 max value is "1200", displaying it to be 100%
if (targetLabel)
targetLabel->setText(std::to_string(valuePercentage) + "%");

View File

@ -192,7 +192,7 @@
"items":
[
{
"index": 400,
"index": 200,
"type": "toggleButton",
"image": "settingsWindow/button46",
"help": "vcmi.adventureOptions.mapScrollSpeed1",
@ -209,7 +209,7 @@
},
{
"index": 800,
"index": 400,
"type": "toggleButton",
"image": "settingsWindow/button46",
"help": "core.help.357",
@ -226,7 +226,7 @@
},
{
"index": 3,
"index": 800,
"type": "toggleButton",
"image": "settingsWindow/button46",
"help": "core.help.358",
@ -259,7 +259,7 @@
]
},
{
"index": -1, // TODO
"index": 2400, // TODO
"type": "toggleButton",
"image": "settingsWindow/button46",
"help": "vcmi.adventureOptions.mapScrollSpeed5",
@ -275,7 +275,7 @@
]
},
{
"index": -2, // TODO
"index": 4800, // TODO
"type": "toggleButton",
"image": "settingsWindow/button46",
"help": "vcmi.adventureOptions.mapScrollSpeed6",