1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Removed makingTurn variable

This commit is contained in:
Ivan Savenko 2023-01-21 16:15:20 +02:00
parent b1c67fbf47
commit a2035122e1
3 changed files with 9 additions and 5 deletions

View File

@ -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);

View File

@ -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);

View File

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