فهرست منبع

Properly disable combat panel during spell targeting

Ivan Savenko 2 سال پیش
والد
کامیت
238de8a5d7
2فایلهای تغییر یافته به همراه7 افزوده شده و 5 حذف شده
  1. 5 0
      client/battle/BattleActionsController.cpp
  2. 2 5
      client/battle/BattleWindow.cpp

+ 5 - 0
client/battle/BattleActionsController.cpp

@@ -119,7 +119,10 @@ BattleActionsController::BattleActionsController(BattleInterface & owner):
 void BattleActionsController::endCastingSpell()
 {
 	if(heroSpellToCast)
+	{
 		heroSpellToCast.reset();
+		owner.windowObject->blockUI(false);
+	}
 
 	if(owner.stacksController->getActiveStack())
 		possibleActions = getPossibleActionsForStack(owner.stacksController->getActiveStack()); //restore actions after they were cleared
@@ -287,6 +290,8 @@ void BattleActionsController::castThisSpell(SpellID spellID)
 		possibleActions.push_back (spellSelMode); //only this one action can be performed at the moment
 		GH.fakeMouseMove();//update cursor
 	}
+
+	owner.windowObject->blockUI(true);
 }
 
 const CSpell * BattleActionsController::getHeroSpellToCast( ) const

+ 2 - 5
client/battle/BattleWindow.cpp

@@ -541,11 +541,8 @@ void BattleWindow::blockUI(bool on)
 		w->block(on || owner.tacticsMode);
 	if(auto w = widget<CButton>("alternativeAction"))
 		w->block(on || owner.tacticsMode);
-
-	// block only if during enemy turn and auto-fight is off
-	// otherwise - crash on accessing non-exisiting active stack
-	if(auto w = widget<CButton>("options"))
-		w->block(!owner.curInt->isAutoFightOn && !owner.stacksController->getActiveStack());
+	if(auto w = widget<CButton>("autofight"))
+		w->block(owner.actionsController->spellcastingModeActive());
 
 	auto btactEnd = widget<CButton>("tacticEnd");
 	auto btactNext = widget<CButton>("tacticNext");