Bläddra i källkod

digging enable state

Laserlicht 3 månader sedan
förälder
incheckning
a303c01ea2

+ 6 - 1
client/adventureMap/AdventureMapShortcuts.cpp

@@ -97,7 +97,7 @@ std::vector<AdventureMapShortcutState> AdventureMapShortcuts::getShortcuts()
 		{ EShortcut::ADVENTURE_NEW_GAME,         optionInMapView(),      [this]() { this->newGame(); } },
 		{ EShortcut::ADVENTURE_LOAD_GAME,        optionInMapView(),      [this]() { this->loadGame(); } },
 		{ EShortcut::ADVENTURE_RESTART_GAME,     optionInMapView(),      [this]() { this->restartGame(); } },
-		{ EShortcut::ADVENTURE_DIG_GRAIL,        optionHeroSelected(),   [this]() { this->digGrail(); } },
+		{ EShortcut::ADVENTURE_DIG_GRAIL,        optionHeroDig(),        [this]() { this->digGrail(); } },
 		{ EShortcut::ADVENTURE_VIEW_PUZZLE,      optionSidePanelActive(),[this]() { this->viewPuzzleMap(); } },
 		{ EShortcut::ADVENTURE_VISIT_OBJECT,     optionCanVisitObject(), [this]() { this->visitObject(); } },
 		{ EShortcut::ADVENTURE_VIEW_SELECTED,    optionInMapView(),      [this]() { this->openObject(); } },
@@ -676,3 +676,8 @@ bool AdventureMapShortcuts::optionHeroBoat(EPathfindingLayer layer)
 	const CGHeroInstance *hero = GAME->interface()->localState->getCurrentHero();
 	return optionInMapView() && hero && hero->inBoat() && hero->getBoat()->layer == layer;
 }
+
+bool AdventureMapShortcuts::optionHeroDig()
+{
+	return optionInMapView() && GAME->interface()->localState->getCurrentHero() != nullptr && GAME->interface()->localState->getCurrentHero()->diggingStatus() == EDiggingStatus::CAN_DIG;
+}

+ 1 - 0
client/adventureMap/AdventureMapShortcuts.h

@@ -103,6 +103,7 @@ public:
 	bool optionMarketplace();
 	bool optionHeroGround();
 	bool optionHeroBoat(EPathfindingLayer layer);
+	bool optionHeroDig();
 
 	void setState(EAdventureState newState);
 	EAdventureState getState() const;