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

Fix visibility of alternative actions button in tactics stage

This commit is contained in:
Ivan Savenko 2023-04-05 18:36:10 +03:00
parent cf966015bb
commit a3c5f75600

View File

@ -86,34 +86,34 @@ BattleWindow::BattleWindow(BattleInterface & owner):
void BattleWindow::createQueue() void BattleWindow::createQueue()
{ {
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
//create stack queue and adjust our own position //create stack queue and adjust our own position
bool embedQueue; bool embedQueue;
bool showQueue = settings["battle"]["showQueue"].Bool(); bool showQueue = settings["battle"]["showQueue"].Bool();
std::string queueSize = settings["battle"]["queueSize"].String(); std::string queueSize = settings["battle"]["queueSize"].String();
if(queueSize == "auto") if(queueSize == "auto")
embedQueue = GH.screenDimensions().y < 700; embedQueue = GH.screenDimensions().y < 700;
else else
embedQueue = GH.screenDimensions().y < 700 || queueSize == "small"; embedQueue = GH.screenDimensions().y < 700 || queueSize == "small";
queue = std::make_shared<StackQueue>(embedQueue, owner); queue = std::make_shared<StackQueue>(embedQueue, owner);
if(!embedQueue && showQueue) if(!embedQueue && showQueue)
{ {
//re-center, taking into account stack queue position //re-center, taking into account stack queue position
pos.y -= queue->pos.h; pos.y -= queue->pos.h;
pos.h += queue->pos.h; pos.h += queue->pos.h;
pos = center(); pos = center();
} }
if (!showQueue) if (!showQueue)
queue->disable(); queue->disable();
} }
BattleWindow::~BattleWindow() BattleWindow::~BattleWindow()
{ {
CPlayerInterface::battleInt = nullptr; CPlayerInterface::battleInt = nullptr;
} }
std::shared_ptr<BattleConsole> BattleWindow::buildBattleConsole(const JsonNode & config) const std::shared_ptr<BattleConsole> BattleWindow::buildBattleConsole(const JsonNode & config) const
{ {
@ -144,14 +144,14 @@ void BattleWindow::hideQueue()
if (!queue->embedded) if (!queue->embedded)
{ {
//re-center, taking into account stack queue position //re-center, taking into account stack queue position
pos.y += queue->pos.h; pos.y += queue->pos.h;
pos.h -= queue->pos.h; pos.h -= queue->pos.h;
pos = center(); pos = center();
} }
GH.totalRedraw(); GH.totalRedraw();
} }
void BattleWindow::showQueue() void BattleWindow::showQueue()
{ {
if(settings["battle"]["showQueue"].Bool() == true) if(settings["battle"]["showQueue"].Bool() == true)
return; return;
@ -217,9 +217,12 @@ void BattleWindow::tacticPhaseStarted()
auto menuTactics = widget<CIntObject>("menuTactics"); auto menuTactics = widget<CIntObject>("menuTactics");
auto tacticNext = widget<CIntObject>("tacticNext"); auto tacticNext = widget<CIntObject>("tacticNext");
auto tacticEnd = widget<CIntObject>("tacticEnd"); auto tacticEnd = widget<CIntObject>("tacticEnd");
auto alternativeAction = widget<CIntObject>("alternativeAction");
menuBattle->disable(); menuBattle->disable();
console->disable(); console->disable();
if (alternativeAction)
alternativeAction->disable();
menuTactics->enable(); menuTactics->enable();
tacticNext->enable(); tacticNext->enable();
@ -235,9 +238,12 @@ void BattleWindow::tacticPhaseEnded()
auto menuTactics = widget<CIntObject>("menuTactics"); auto menuTactics = widget<CIntObject>("menuTactics");
auto tacticNext = widget<CIntObject>("tacticNext"); auto tacticNext = widget<CIntObject>("tacticNext");
auto tacticEnd = widget<CIntObject>("tacticEnd"); auto tacticEnd = widget<CIntObject>("tacticEnd");
auto alternativeAction = widget<CIntObject>("alternativeAction");
menuBattle->enable(); menuBattle->enable();
console->enable(); console->enable();
if (alternativeAction)
alternativeAction->enable();
menuTactics->disable(); menuTactics->disable();
tacticNext->disable(); tacticNext->disable();