mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Correctly update battle queue state after changing its state
This commit is contained in:
@@ -86,30 +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;
|
||||||
std::string queueSize = settings["battle"]["queueSize"].String();
|
bool showQueue = settings["battle"]["showQueue"].Bool();
|
||||||
|
std::string queueSize = settings["battle"]["queueSize"].String();
|
||||||
if(queueSize == "auto")
|
|
||||||
embedQueue = GH.screenDimensions().y < 700;
|
if(queueSize == "auto")
|
||||||
else
|
embedQueue = GH.screenDimensions().y < 700;
|
||||||
embedQueue = GH.screenDimensions().y < 700 || queueSize == "small";
|
else
|
||||||
|
embedQueue = GH.screenDimensions().y < 700 || queueSize == "small";
|
||||||
queue = std::make_shared<StackQueue>(embedQueue, owner);
|
|
||||||
if(!embedQueue && settings["battle"]["showQueue"].Bool())
|
queue = std::make_shared<StackQueue>(embedQueue, owner);
|
||||||
{
|
if(!embedQueue && showQueue)
|
||||||
//re-center, taking into account stack queue position
|
{
|
||||||
pos.y -= queue->pos.h;
|
//re-center, taking into account stack queue position
|
||||||
pos.h += queue->pos.h;
|
pos.y -= queue->pos.h;
|
||||||
pos = center();
|
pos.h += queue->pos.h;
|
||||||
}
|
pos = center();
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleWindow::~BattleWindow()
|
if (!showQueue)
|
||||||
{
|
queue->disable();
|
||||||
CPlayerInterface::battleInt = nullptr;
|
}
|
||||||
}
|
|
||||||
|
BattleWindow::~BattleWindow()
|
||||||
|
{
|
||||||
|
CPlayerInterface::battleInt = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<BattleConsole> BattleWindow::buildBattleConsole(const JsonNode & config) const
|
std::shared_ptr<BattleConsole> BattleWindow::buildBattleConsole(const JsonNode & config) const
|
||||||
{
|
{
|
||||||
@@ -140,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;
|
||||||
|
@@ -84,14 +84,19 @@ int BattleOptionsTab::getAnimSpeed() const
|
|||||||
|
|
||||||
int BattleOptionsTab::getQueueSizeId() const
|
int BattleOptionsTab::getQueueSizeId() const
|
||||||
{
|
{
|
||||||
std::string text = settings["battle"]["queueSize"].String();
|
std::string sizeText = settings["battle"]["queueSize"].String();
|
||||||
if(text == "none")
|
bool visible = settings["battle"]["showQueue"].Bool();
|
||||||
|
|
||||||
|
if(!visible)
|
||||||
return -1;
|
return -1;
|
||||||
if(text == "auto")
|
|
||||||
|
if(sizeText == "none")
|
||||||
|
return -1;
|
||||||
|
if(sizeText == "auto")
|
||||||
return 0;
|
return 0;
|
||||||
if(text == "small")
|
if(sizeText == "small")
|
||||||
return 1;
|
return 1;
|
||||||
if(text == "big")
|
if(sizeText == "big")
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user