Jelajahi Sumber

Removed makingTurn variable

Ivan Savenko 2 tahun lalu
induk
melakukan
a2035122e1

+ 6 - 3
client/battle/BattleInterface.cpp

@@ -54,7 +54,6 @@ BattleInterface::BattleInterface(const CCreatureSet *army1, const CCreatureSet *
 	, attackerInt(att)
 	, defenderInt(defen)
 	, curInt(att)
-	, myTurn(false)
 	, moveSoundHander(-1)
 {
 	for ( auto & event : animationEvents)
@@ -258,6 +257,7 @@ void BattleInterface::giveCommand(EActionType action, BattleHex tile, si32 addit
 	ba->actionSubtype = additional;
 
 	sendCommand(ba, actor);
+	CCS->curh->set(Cursor::Combat::POINTER);
 }
 
 void BattleInterface::sendCommand(BattleAction *& command, const CStack * actor)
@@ -267,7 +267,6 @@ void BattleInterface::sendCommand(BattleAction *& command, const CStack * actor)
 	if(!tacticsMode)
 	{
 		logGlobal->trace("Setting command for %s", (actor ? actor->nodeName() : "hero"));
-		myTurn = false;
 		stacksController->setActiveStack(nullptr);
 		givenCommand.setn(command);
 	}
@@ -553,7 +552,6 @@ void BattleInterface::activateStack()
 	if(!s)
 		return;
 
-	myTurn = true;
 	windowObject->updateQueue();
 	windowObject->blockUI(false);
 	fieldController->redrawBackgroundWithHexes();
@@ -561,6 +559,11 @@ void BattleInterface::activateStack()
 	GH.fakeMouseMove();
 }
 
+bool BattleInterface::makingTurn() const
+{
+	return stacksController->getActiveStack() != nullptr;
+}
+
 void BattleInterface::endAction(const BattleAction* action)
 {
 	const CStack *stack = curInt->cb->battleGetStackByID(action->stackNumber);

+ 2 - 1
client/battle/BattleInterface.h

@@ -146,7 +146,8 @@ public:
 
 	static CondSh<BattleAction *> givenCommand; //data != nullptr if we have i.e. moved current unit
 
-	bool myTurn; //if true, interface is active (commands can be ordered)
+	bool makingTurn() const;
+
 	int moveSoundHander; // sound handler used when moving a unit
 
 	BattleInterface(const CCreatureSet *army1, const CCreatureSet *army2, const CGHeroInstance *hero1, const CGHeroInstance *hero2, std::shared_ptr<CPlayerInterface> att, std::shared_ptr<CPlayerInterface> defen, std::shared_ptr<CPlayerInterface> spectatorInt = nullptr);

+ 1 - 1
client/battle/BattleWindow.cpp

@@ -391,7 +391,7 @@ void BattleWindow::bSpellf()
 	if (owner.actionsController->spellcastingModeActive())
 		return;
 
-	if (!owner.myTurn)
+	if (!owner.makingTurn())
 		return;
 
 	auto myHero = owner.currentHero();