浏览代码

Block turn end button after player ends turn

Ivan Savenko 2 年之前
父节点
当前提交
56074e18a9
共有 2 个文件被更改,包括 7 次插入1 次删除
  1. 6 1
      client/adventureMap/AdventureMapShortcuts.cpp
  2. 1 0
      client/adventureMap/AdventureMapShortcuts.h

+ 6 - 1
client/adventureMap/AdventureMapShortcuts.cpp

@@ -71,7 +71,7 @@ std::vector<AdventureMapShortcutState> AdventureMapShortcuts::getShortcuts()
 		{ EShortcut::ADVENTURE_GAME_OPTIONS,     optionInMapView(),      [this]() { this->adventureOptions(); } },
 		{ EShortcut::GLOBAL_OPTIONS,             optionInMapView(),      [this]() { this->systemOptions(); } },
 		{ EShortcut::ADVENTURE_NEXT_HERO,        optionHasNextHero(),    [this]() { this->nextHero(); } },
-		{ EShortcut::GAME_END_TURN,              optionInMapView(),      [this]() { this->endTurn(); } },
+		{ EShortcut::GAME_END_TURN,              optionCanEndTurn(),     [this]() { this->endTurn(); } },
 		{ EShortcut::ADVENTURE_THIEVES_GUILD,    optionInMapView(),      [this]() { this->showThievesGuild(); } },
 		{ EShortcut::ADVENTURE_VIEW_SCENARIO,    optionInMapView(),      [this]() { this->showScenarioInfo(); } },
 		{ EShortcut::GAME_SAVE_GAME,             optionInMapView(),      [this]() { this->saveGame(); } },
@@ -453,6 +453,11 @@ bool AdventureMapShortcuts::optionHasNextHero()
 	return optionInMapView() && nextSuitableHero != nullptr;
 }
 
+bool AdventureMapShortcuts::optionCanEndTurn()
+{
+	return optionInMapView() && LOCPLINT->makingTurn;
+}
+
 bool AdventureMapShortcuts::optionSpellcasting()
 {
 	return state == EAdventureState::CASTING_SPELL;

+ 1 - 0
client/adventureMap/AdventureMapShortcuts.h

@@ -78,6 +78,7 @@ public:
 	bool optionHeroCanMove();
 	bool optionHasNextHero();
 	bool optionCanVisitObject();
+	bool optionCanEndTurn();
 	bool optionSpellcasting();
 	bool optionInMapView();
 	bool optionInWorldView();