mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-24 03:47:18 +02:00
Clang-tidy related fixed
This commit is contained in:
parent
7e409df3cb
commit
7137329e80
@ -35,38 +35,62 @@ AdventureOptionsTab::AdventureOptionsTab()
|
||||
{
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
const JsonNode config(ResourceID("config/widgets/settings/adventureOptionsTab.json"));
|
||||
addCallback("playerHeroSpeedChanged", std::bind(&setIntSetting, "adventure", "heroSpeed", _1));
|
||||
addCallback("enemyHeroSpeedChanged", std::bind(&setIntSetting, "adventure", "enemySpeed", _1));
|
||||
addCallback("mapScrollSpeedChanged", std::bind(&setIntSetting, "adventure", "scrollSpeed", _1));
|
||||
addCallback("heroReminderChanged", std::bind(&setBoolSetting, "adventure", "heroReminder", _1));
|
||||
addCallback("quickCombatChanged", std::bind(&setBoolSetting, "adventure", "quickCombat", _1));
|
||||
addCallback("playerHeroSpeedChanged", [](int value)
|
||||
{
|
||||
return setIntSetting("adventure", "heroSpeed", value);
|
||||
});
|
||||
addCallback("enemyHeroSpeedChanged", [](int value)
|
||||
{
|
||||
return setIntSetting("adventure", "enemySpeed", value);
|
||||
});
|
||||
addCallback("mapScrollSpeedChanged", [](int value)
|
||||
{
|
||||
return setIntSetting("adventure", "scrollSpeed", value);
|
||||
});
|
||||
addCallback("heroReminderChanged", [](bool value)
|
||||
{
|
||||
return setBoolSetting("adventure", "heroReminder", value);
|
||||
});
|
||||
addCallback("quickCombatChanged", [](bool value)
|
||||
{
|
||||
return setBoolSetting("adventure", "quickCombat", value);
|
||||
});
|
||||
//settings that do not belong to base game:
|
||||
addCallback("numericQuantitiesChanged", std::bind(&setBoolSetting, "gameTweaks", "numericCreaturesQuantities", _1));
|
||||
addCallback("forceMovementInfoChanged", std::bind(&setBoolSetting, "gameTweaks", "forceMovementInfo", _1));
|
||||
addCallback("showGridChanged", std::bind(&setBoolSetting, "gameTweaks", "showGrid", _1));
|
||||
addCallback("numericQuantitiesChanged", [](bool value)
|
||||
{
|
||||
return setBoolSetting("gameTweaks", "numericCreaturesQuantities", value);
|
||||
});
|
||||
addCallback("forceMovementInfoChanged", [](bool value)
|
||||
{
|
||||
return setBoolSetting("gameTweaks", "forceMovementInfo", value);
|
||||
});
|
||||
addCallback("showGridChanged", [](bool value)
|
||||
{
|
||||
return setBoolSetting("gameTweaks", "showGrid", value);
|
||||
});
|
||||
build(config);
|
||||
|
||||
std::shared_ptr<CToggleGroup> playerHeroSpeedToggle = widget<CToggleGroup>("heroMovementSpeedPicker");
|
||||
playerHeroSpeedToggle->setSelected((int)settings["adventure"]["heroSpeed"].Float());
|
||||
playerHeroSpeedToggle->setSelected(static_cast<int>(settings["adventure"]["heroSpeed"].Float()));
|
||||
|
||||
std::shared_ptr<CToggleGroup> enemyHeroSpeedToggle = widget<CToggleGroup>("enemyMovementSpeedPicker");
|
||||
enemyHeroSpeedToggle->setSelected((int)settings["adventure"]["enemySpeed"].Float());
|
||||
enemyHeroSpeedToggle->setSelected(static_cast<int>(settings["adventure"]["enemySpeed"].Float()));
|
||||
|
||||
std::shared_ptr<CToggleGroup> mapScrollSpeedToggle = widget<CToggleGroup>("mapScrollSpeedPicker");
|
||||
mapScrollSpeedToggle->setSelected((int)settings["adventure"]["scrollSpeed"].Float());
|
||||
mapScrollSpeedToggle->setSelected(static_cast<int>(settings["adventure"]["scrollSpeed"].Float()));
|
||||
|
||||
std::shared_ptr<CToggleButton> heroReminderCheckbox = widget<CToggleButton>("heroReminderCheckbox");
|
||||
heroReminderCheckbox->setSelected((bool)settings["adventure"]["heroReminder"].Bool());
|
||||
heroReminderCheckbox->setSelected(settings["adventure"]["heroReminder"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> quickCombatCheckbox = widget<CToggleButton>("quickCombatCheckbox");
|
||||
quickCombatCheckbox->setSelected((bool)settings["adventure"]["quickCombat"].Bool());
|
||||
quickCombatCheckbox->setSelected(settings["adventure"]["quickCombat"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> numericQuantitiesCheckbox = widget<CToggleButton>("numericQuantitiesCheckbox");
|
||||
numericQuantitiesCheckbox->setSelected((bool)settings["gameTweaks"]["numericCreaturesQuantities"].Bool());
|
||||
numericQuantitiesCheckbox->setSelected(settings["gameTweaks"]["numericCreaturesQuantities"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> forceMovementInfoCheckbox = widget<CToggleButton>("forceMovementInfoCheckbox");
|
||||
forceMovementInfoCheckbox->setSelected((bool)settings["gameTweaks"]["forceMovementInfo"].Bool());
|
||||
forceMovementInfoCheckbox->setSelected(settings["gameTweaks"]["forceMovementInfo"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> showGridCheckbox = widget<CToggleButton>("showGridCheckbox");
|
||||
showGridCheckbox->setSelected((bool)settings["gameTweaks"]["showGrid"].Bool());
|
||||
showGridCheckbox->setSelected(settings["gameTweaks"]["showGrid"].Bool());
|
||||
}
|
@ -25,13 +25,34 @@ BattleOptionsTab::BattleOptionsTab(BattleInterface * owner):
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
|
||||
const JsonNode config(ResourceID("config/widgets/settings/battleOptionsTab.json"));
|
||||
addCallback("viewGridChanged", std::bind(&BattleOptionsTab::viewGridChangedCallback, this, _1, owner));
|
||||
addCallback("movementShadowChanged", std::bind(&BattleOptionsTab::movementShadowChangedCallback, this, _1, owner));
|
||||
addCallback("mouseShadowChanged", std::bind(&BattleOptionsTab::mouseShadowChangedCallback, this, _1));
|
||||
addCallback("animationSpeedChanged", std::bind(&BattleOptionsTab::animationSpeedChangedCallback, this, _1));
|
||||
addCallback("showQueueChanged", std::bind(&BattleOptionsTab::showQueueChangedCallback, this, _1, owner));
|
||||
addCallback("queueSizeChanged", std::bind(&BattleOptionsTab::queueSizeChangedCallback, this, _1));
|
||||
addCallback("skipBattleIntroMusicChanged", std::bind(&BattleOptionsTab::skipBattleIntroMusicChangedCallback, this, _1));
|
||||
addCallback("viewGridChanged", [this, owner](bool value)
|
||||
{
|
||||
viewGridChangedCallback(value, owner);
|
||||
});
|
||||
addCallback("movementShadowChanged", [this, owner](bool value)
|
||||
{
|
||||
movementShadowChangedCallback(value, owner);
|
||||
});
|
||||
addCallback("mouseShadowChanged", [this](bool value)
|
||||
{
|
||||
mouseShadowChangedCallback(value);
|
||||
});
|
||||
addCallback("animationSpeedChanged", [this](int value)
|
||||
{
|
||||
animationSpeedChangedCallback(value);
|
||||
});
|
||||
addCallback("showQueueChanged", [this, owner](bool value)
|
||||
{
|
||||
showQueueChangedCallback(value, owner);
|
||||
});
|
||||
addCallback("queueSizeChanged", [this](int value)
|
||||
{
|
||||
queueSizeChangedCallback(value);
|
||||
});
|
||||
addCallback("skipBattleIntroMusicChanged", [this](bool value)
|
||||
{
|
||||
skipBattleIntroMusicChangedCallback(value);
|
||||
});
|
||||
build(config);
|
||||
|
||||
std::shared_ptr<CToggleGroup> animationSpeedToggle = widget<CToggleGroup>("animationSpeedPicker");
|
||||
@ -41,19 +62,19 @@ BattleOptionsTab::BattleOptionsTab(BattleInterface * owner):
|
||||
queueSizeToggle->setSelected(getQueueSizeId());
|
||||
|
||||
std::shared_ptr<CToggleButton> viewGridCheckbox = widget<CToggleButton>("viewGridCheckbox");
|
||||
viewGridCheckbox->setSelected((bool)settings["battle"]["cellBorders"].Bool());
|
||||
viewGridCheckbox->setSelected(settings["battle"]["cellBorders"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> movementShadowCheckbox = widget<CToggleButton>("movementShadowCheckbox");
|
||||
movementShadowCheckbox->setSelected((bool)settings["battle"]["stackRange"].Bool());
|
||||
movementShadowCheckbox->setSelected(settings["battle"]["stackRange"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> mouseShadowCheckbox = widget<CToggleButton>("mouseShadowCheckbox");
|
||||
mouseShadowCheckbox->setSelected((bool)settings["battle"]["mouseShadow"].Bool());
|
||||
mouseShadowCheckbox->setSelected(settings["battle"]["mouseShadow"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> showQueueCheckbox = widget<CToggleButton>("showQueueCheckbox");
|
||||
showQueueCheckbox->setSelected((bool)settings["battle"]["showQueue"].Bool());
|
||||
showQueueCheckbox->setSelected(settings["battle"]["showQueue"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> skipBattleIntroMusicCheckbox = widget<CToggleButton>("skipBattleIntroMusicCheckbox");
|
||||
skipBattleIntroMusicCheckbox->setSelected((bool)settings["gameTweaks"]["skipBattleIntroMusic"].Bool());
|
||||
skipBattleIntroMusicCheckbox->setSelected(settings["gameTweaks"]["skipBattleIntroMusic"].Bool());
|
||||
}
|
||||
|
||||
int BattleOptionsTab::getAnimSpeed() const
|
||||
@ -117,7 +138,7 @@ void BattleOptionsTab::mouseShadowChangedCallback(bool value)
|
||||
void BattleOptionsTab::animationSpeedChangedCallback(int value)
|
||||
{
|
||||
Settings speed = settings.write["battle"]["speedFactor"];
|
||||
speed->Float() = float(value);
|
||||
speed->Float() = static_cast<float>(value);
|
||||
}
|
||||
|
||||
void BattleOptionsTab::showQueueChangedCallback(bool value, BattleInterface * parentBattleInterface)
|
||||
|
@ -49,16 +49,42 @@ GeneralOptionsTab::GeneralOptionsTab()
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
|
||||
const JsonNode config(ResourceID("config/widgets/settings/generalOptionsTab.json"));
|
||||
addCallback("spellbookAnimationChanged", std::bind(&setBoolSetting, "video", "spellbookAnimation", _1));
|
||||
addCallback("setMusic", [this](int value) { setIntSetting("general", "music", value); widget<CSlider>("musicSlider")->redraw(); });
|
||||
addCallback("setVolume", [this](int value) { setIntSetting("general", "sound", value); widget<CSlider>("soundVolumeSlider")->redraw(); });
|
||||
addCallback("spellbookAnimationChanged", [](bool value)
|
||||
{
|
||||
return setBoolSetting("video", "spellbookAnimation", value);
|
||||
});
|
||||
addCallback("setMusic", [this](int value)
|
||||
{
|
||||
setIntSetting("general", "music", value);
|
||||
widget<CSlider>("musicSlider")->redraw();
|
||||
});
|
||||
addCallback("setVolume", [this](int value)
|
||||
{
|
||||
setIntSetting("general", "sound", value);
|
||||
widget<CSlider>("soundVolumeSlider")->redraw();
|
||||
});
|
||||
//settings that do not belong to base game:
|
||||
addCallback("fullscreenChanged", std::bind(&GeneralOptionsTab::setFullscreenMode, this, _1));
|
||||
addCallback("setGameResolution", std::bind(&GeneralOptionsTab::selectGameResolution, this));
|
||||
addCallback("framerateChanged", std::bind(&setBoolSetting, "general", "showfps", _1));
|
||||
addCallback("fullscreenChanged", [this](bool value)
|
||||
{
|
||||
setFullscreenMode(value);
|
||||
});
|
||||
addCallback("setGameResolution", [this](int dummyValue)
|
||||
{
|
||||
selectGameResolution();
|
||||
});
|
||||
addCallback("framerateChanged", [](bool value)
|
||||
{
|
||||
setBoolSetting("general", "showfps", value);
|
||||
});
|
||||
//moved from "other" tab that is disabled for now to avoid excessible tabs with barely any content
|
||||
addCallback("availableCreaturesAsDwellingLabelChanged", std::bind(&setBoolSetting, "gameTweaks", "availableCreaturesAsDwellingLabel", _1));
|
||||
addCallback("compactTownCreatureInfoChanged", std::bind(&setBoolSetting, "gameTweaks", "compactTownCreatureInfo", _1));
|
||||
addCallback("availableCreaturesAsDwellingLabelChanged", [](bool value)
|
||||
{
|
||||
setBoolSetting("gameTweaks", "availableCreaturesAsDwellingLabel", value);
|
||||
});
|
||||
addCallback("compactTownCreatureInfoChanged", [](bool value)
|
||||
{
|
||||
return setBoolSetting("gameTweaks", "compactTownCreatureInfo", value);
|
||||
});
|
||||
build(config);
|
||||
|
||||
std::shared_ptr<CLabel> resolutionLabel = widget<CLabel>("resolutionLabel");
|
||||
@ -67,17 +93,17 @@ GeneralOptionsTab::GeneralOptionsTab()
|
||||
|
||||
|
||||
std::shared_ptr<CToggleButton> spellbookAnimationCheckbox = widget<CToggleButton>("spellbookAnimationCheckbox");
|
||||
spellbookAnimationCheckbox->setSelected((bool)settings["video"]["spellbookAnimation"].Bool());
|
||||
spellbookAnimationCheckbox->setSelected(settings["video"]["spellbookAnimation"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> fullscreenCheckbox = widget<CToggleButton>("fullscreenCheckbox");
|
||||
fullscreenCheckbox->setSelected((bool)settings["video"]["fullscreen"].Bool());
|
||||
fullscreenCheckbox->setSelected(settings["video"]["fullscreen"].Bool());
|
||||
onFullscreenChanged([&](const JsonNode &newState) //used when pressing F4 etc. to change fullscreen checkbox state
|
||||
{
|
||||
widget<CToggleButton>("fullscreenCheckbox")->setSelected(newState.Bool());
|
||||
});
|
||||
|
||||
std::shared_ptr<CToggleButton> framerateCheckbox = widget<CToggleButton>("framerateCheckbox");
|
||||
framerateCheckbox->setSelected((bool)settings["general"]["showfps"].Bool());
|
||||
framerateCheckbox->setSelected(settings["general"]["showfps"].Bool());
|
||||
|
||||
std::shared_ptr<CSlider> musicSlider = widget<CSlider>("musicSlider");
|
||||
musicSlider->moveTo(CCS->musich->getVolume());
|
||||
@ -86,10 +112,10 @@ GeneralOptionsTab::GeneralOptionsTab()
|
||||
volumeSlider->moveTo(CCS->soundh->getVolume());
|
||||
|
||||
std::shared_ptr<CToggleButton> availableCreaturesAsDwellingLabelCheckbox = widget<CToggleButton>("availableCreaturesAsDwellingLabelCheckbox");
|
||||
availableCreaturesAsDwellingLabelCheckbox->setSelected((bool)settings["gameTweaks"]["availableCreaturesAsDwellingLabel"].Bool());
|
||||
availableCreaturesAsDwellingLabelCheckbox->setSelected(settings["gameTweaks"]["availableCreaturesAsDwellingLabel"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> compactTownCreatureInfo = widget<CToggleButton>("compactTownCreatureInfoCheckbox");
|
||||
compactTownCreatureInfo->setSelected((bool)settings["gameTweaks"]["compactTownCreatureInfo"].Bool());
|
||||
compactTownCreatureInfo->setSelected(settings["gameTweaks"]["compactTownCreatureInfo"].Bool());
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +153,10 @@ void GeneralOptionsTab::selectGameResolution()
|
||||
GH.pushIntT<CObjectListWindow>(items, nullptr,
|
||||
CGI->generaltexth->translate("vcmi.systemOptions.resolutionMenu.hover"),
|
||||
CGI->generaltexth->translate("vcmi.systemOptions.resolutionMenu.help"),
|
||||
std::bind(&GeneralOptionsTab::setGameResolution, this, _1),
|
||||
[this](int index)
|
||||
{
|
||||
setGameResolution(index);
|
||||
},
|
||||
currentResolutionIndex);
|
||||
}
|
||||
|
||||
|
@ -27,15 +27,21 @@ OtherOptionsWindow::OtherOptionsWindow() : InterfaceObjectConfigurable()
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
|
||||
const JsonNode config(ResourceID("config/widgets/settings/otherOptionsTab.json"));
|
||||
addCallback("availableCreaturesAsDwellingLabelChanged", std::bind(&setBoolSetting, "gameTweaks", "availableCreaturesAsDwellingLabel", _1));
|
||||
addCallback("compactTownCreatureInfoChanged", std::bind(&setBoolSetting, "gameTweaks", "compactTownCreatureInfo", _1));
|
||||
addCallback("availableCreaturesAsDwellingLabelChanged", [](bool value)
|
||||
{
|
||||
return setBoolSetting("gameTweaks", "availableCreaturesAsDwellingLabel", value);
|
||||
});
|
||||
addCallback("compactTownCreatureInfoChanged", [](bool value)
|
||||
{
|
||||
return setBoolSetting("gameTweaks", "compactTownCreatureInfo", value);
|
||||
});
|
||||
build(config);
|
||||
|
||||
std::shared_ptr<CToggleButton> availableCreaturesAsDwellingLabelCheckbox = widget<CToggleButton>("availableCreaturesAsDwellingLabelCheckbox");
|
||||
availableCreaturesAsDwellingLabelCheckbox->setSelected((bool)settings["gameTweaks"]["availableCreaturesAsDwellingLabel"].Bool());
|
||||
availableCreaturesAsDwellingLabelCheckbox->setSelected(settings["gameTweaks"]["availableCreaturesAsDwellingLabel"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> compactTownCreatureInfo = widget<CToggleButton>("compactTownCreatureInfoCheckbox");
|
||||
compactTownCreatureInfo->setSelected((bool)settings["gameTweaks"]["compactTownCreatureInfo"].Bool());
|
||||
compactTownCreatureInfo->setSelected(settings["gameTweaks"]["compactTownCreatureInfo"].Bool());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user