1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Add hotkey to track human player hero in MP. Fixed broken 'toggle grid'

hotkey
This commit is contained in:
Ivan Savenko
2024-04-30 19:10:10 +03:00
parent 74d3b4ab43
commit dd9e002031
6 changed files with 53 additions and 32 deletions

View File

@@ -64,6 +64,8 @@ std::vector<AdventureMapShortcutState> AdventureMapShortcuts::getShortcuts()
{ EShortcut::ADVENTURE_TOGGLE_MAP_LEVEL, optionCanToggleLevel(), [this]() { this->switchMapLevel(); } },
{ EShortcut::ADVENTURE_QUEST_LOG, optionCanViewQuests(), [this]() { this->showQuestlog(); } },
{ EShortcut::ADVENTURE_TOGGLE_SLEEP, optionHeroSelected(), [this]() { this->toggleSleepWake(); } },
{ EShortcut::ADVENTURE_TOGGLE_GRID, optionInMapView(), [this]() { this->toggleGrid(); } },
{ EShortcut::ADVENTURE_TRACK_HERO, optionInMapView(), [this]() { this->toggleTrackHero(); } },
{ EShortcut::ADVENTURE_SET_HERO_ASLEEP, optionHeroAwake(), [this]() { this->setHeroSleeping(); } },
{ EShortcut::ADVENTURE_SET_HERO_AWAKE, optionHeroSleeping(), [this]() { this->setHeroAwake(); } },
{ EShortcut::ADVENTURE_MOVE_HERO, optionHeroCanMove(), [this]() { this->moveHeroAlongPath(); } },
@@ -143,6 +145,18 @@ void AdventureMapShortcuts::showQuestlog()
LOCPLINT->showQuestLog();
}
void AdventureMapShortcuts::toggleTrackHero()
{
Settings s = settings.write["session"];
s["adventureTrackHero"].Bool() = !settings["session"]["adventureTrackHero"].Bool();
}
void AdventureMapShortcuts::toggleGrid()
{
Settings s = settings.write["gameTweaks"];
s["showGrid"].Bool() = !settings["gameTweaks"]["showGrid"].Bool();
}
void AdventureMapShortcuts::toggleSleepWake()
{
if (!optionHeroSelected())