mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-07 00:58:39 +02:00
Remove custom flag from Quick spell panel
This commit is contained in:
@ -214,7 +214,6 @@ void BattleWindow::hideStickyQuickSpellWindow()
|
|||||||
showStickyQuickSpellWindow->Bool() = false;
|
showStickyQuickSpellWindow->Bool() = false;
|
||||||
|
|
||||||
quickSpellWindow->disable();
|
quickSpellWindow->disable();
|
||||||
quickSpellWindow->isEnabled = false;
|
|
||||||
|
|
||||||
setPositionInfoWindow();
|
setPositionInfoWindow();
|
||||||
createTimerInfoWindows();
|
createTimerInfoWindows();
|
||||||
@ -229,15 +228,9 @@ void BattleWindow::showStickyQuickSpellWindow()
|
|||||||
auto hero = owner.getBattle()->battleGetMyHero();
|
auto hero = owner.getBattle()->battleGetMyHero();
|
||||||
|
|
||||||
if(ENGINE->screenDimensions().x >= 1050 && hero != nullptr && hero->hasSpellbook())
|
if(ENGINE->screenDimensions().x >= 1050 && hero != nullptr && hero->hasSpellbook())
|
||||||
{
|
|
||||||
quickSpellWindow->enable();
|
quickSpellWindow->enable();
|
||||||
quickSpellWindow->isEnabled = true;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
quickSpellWindow->disable();
|
quickSpellWindow->disable();
|
||||||
quickSpellWindow->isEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
setPositionInfoWindow();
|
setPositionInfoWindow();
|
||||||
createTimerInfoWindows();
|
createTimerInfoWindows();
|
||||||
@ -248,7 +241,7 @@ void BattleWindow::createTimerInfoWindows()
|
|||||||
{
|
{
|
||||||
OBJECT_CONSTRUCTION;
|
OBJECT_CONSTRUCTION;
|
||||||
|
|
||||||
int xOffsetAttacker = quickSpellWindow->isEnabled ? -53 : 0;
|
int xOffsetAttacker = quickSpellWindow->isDisabled() ? 0 : -53;
|
||||||
|
|
||||||
if(GAME->interface()->cb->getStartInfo()->turnTimerInfo.battleTimer != 0 || GAME->interface()->cb->getStartInfo()->turnTimerInfo.unitTimer != 0)
|
if(GAME->interface()->cb->getStartInfo()->turnTimerInfo.battleTimer != 0 || GAME->interface()->cb->getStartInfo()->turnTimerInfo.unitTimer != 0)
|
||||||
{
|
{
|
||||||
@ -385,7 +378,7 @@ void BattleWindow::updateQueue()
|
|||||||
|
|
||||||
void BattleWindow::setPositionInfoWindow()
|
void BattleWindow::setPositionInfoWindow()
|
||||||
{
|
{
|
||||||
int xOffsetAttacker = quickSpellWindow->isEnabled ? -53 : 0;
|
int xOffsetAttacker = quickSpellWindow->isDisabled() ? 0 : -53;
|
||||||
if(defenderHeroWindow)
|
if(defenderHeroWindow)
|
||||||
{
|
{
|
||||||
Point position = (ENGINE->screenDimensions().x >= 1000)
|
Point position = (ENGINE->screenDimensions().x >= 1000)
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
QuickSpellPanel::QuickSpellPanel(BattleInterface & owner)
|
QuickSpellPanel::QuickSpellPanel(BattleInterface & owner)
|
||||||
: CIntObject(0)
|
: CIntObject(0)
|
||||||
, owner(owner)
|
, owner(owner)
|
||||||
, isEnabled(true)
|
|
||||||
{
|
{
|
||||||
OBJECT_CONSTRUCTION;
|
OBJECT_CONSTRUCTION;
|
||||||
|
|
||||||
|
@ -32,8 +32,6 @@ private:
|
|||||||
public:
|
public:
|
||||||
static constexpr int QUICKSPELL_SLOTS = 12;
|
static constexpr int QUICKSPELL_SLOTS = 12;
|
||||||
|
|
||||||
bool isEnabled; // isActive() is not working on multiple conditions, because of this we need a seperate flag
|
|
||||||
|
|
||||||
QuickSpellPanel(BattleInterface & owner);
|
QuickSpellPanel(BattleInterface & owner);
|
||||||
|
|
||||||
void create();
|
void create();
|
||||||
|
@ -121,6 +121,11 @@ void CIntObject::enable()
|
|||||||
recActions = ALL_ACTIONS;
|
recActions = ALL_ACTIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CIntObject::isDisabled()
|
||||||
|
{
|
||||||
|
return recActions == NO_ACTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
void CIntObject::setEnabled(bool on)
|
void CIntObject::setEnabled(bool on)
|
||||||
{
|
{
|
||||||
if (on)
|
if (on)
|
||||||
|
@ -73,6 +73,9 @@ public:
|
|||||||
void disable();
|
void disable();
|
||||||
/// activates if needed, all activity enabled (Warning: may not be symmetric with disable if recActions was limited!)
|
/// activates if needed, all activity enabled (Warning: may not be symmetric with disable if recActions was limited!)
|
||||||
void enable();
|
void enable();
|
||||||
|
/// returns true if element was disabled via disable() call
|
||||||
|
bool isDisabled();
|
||||||
|
|
||||||
/// deactivates or activates UI element based on flag
|
/// deactivates or activates UI element based on flag
|
||||||
void setEnabled(bool on);
|
void setEnabled(bool on);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user