1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Allow changing queue size instantly on option toggle

This commit is contained in:
Ivan Savenko 2023-03-05 16:36:28 +02:00
parent 5f5ba0a54c
commit 7030fa8fe7
3 changed files with 19 additions and 20 deletions

View File

@ -745,8 +745,7 @@ void BattleInterface::executeOnAnimationCondition( EAnimationEvents event, bool
void BattleInterface::setBattleQueueVisibility(bool visible)
{
windowObject->hideQueue();
if(visible)
windowObject->showQueue();
else
windowObject->hideQueue();
}

View File

@ -72,6 +72,20 @@ BattleWindow::BattleWindow(BattleInterface & owner):
owner.fieldController.reset( new BattleFieldController(owner));
owner.fieldController->createHeroes();
createQueue();
if ( owner.tacticsMode )
tacticPhaseStarted();
else
tacticPhaseEnded();
addUsedEvents(RCLICK | KEYBOARD);
}
void BattleWindow::createQueue()
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
//create stack queue and adjust our own position
bool embedQueue;
std::string queueSize = settings["battle"]["queueSize"].String();
@ -89,13 +103,6 @@ BattleWindow::BattleWindow(BattleInterface & owner):
pos.h += queue->pos.h;
pos = center();
}
if ( owner.tacticsMode )
tacticPhaseStarted();
else
tacticPhaseEnded();
addUsedEvents(RCLICK | KEYBOARD);
}
BattleWindow::~BattleWindow()
@ -147,16 +154,9 @@ void BattleWindow::showQueue()
Settings showQueue = settings.write["battle"]["showQueue"];
showQueue->Bool() = true;
queue->enable();
if (!queue->embedded)
{
//re-center, taking into account stack queue position
pos.y -= queue->pos.h;
pos.h += queue->pos.h;
pos = center();
GH.totalRedraw();
}
createQueue();
updateQueue();
GH.totalRedraw();
}
void BattleWindow::updateQueue()

View File

@ -57,7 +57,7 @@ class BattleWindow : public InterfaceObjectConfigurable
/// flip battle queue visibility to opposite
void toggleQueueVisibility();
void createQueue();
std::shared_ptr<BattleConsole> buildBattleConsole(const JsonNode &) const;