From 1dff721747f9e542a5577f3232751cca9ffb167b Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 4 Jul 2023 20:03:10 +0300 Subject: [PATCH] Fix infobox resetting to current hero during enemy turn --- client/adventureMap/AdventureMapInterface.cpp | 25 +++++++++++-------- client/gui/CIntObject.cpp | 4 +-- client/widgets/ObjectLists.cpp | 3 +++ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/client/adventureMap/AdventureMapInterface.cpp b/client/adventureMap/AdventureMapInterface.cpp index a67fc13ed..ff56d489c 100644 --- a/client/adventureMap/AdventureMapInterface.cpp +++ b/client/adventureMap/AdventureMapInterface.cpp @@ -83,8 +83,11 @@ void AdventureMapInterface::onAudioPaused() void AdventureMapInterface::onHeroMovementStarted(const CGHeroInstance * hero) { - widget->getInfoBar()->popAll(); - widget->getInfoBar()->showSelection(); + if (shortcuts->optionMapViewActive()) + { + widget->getInfoBar()->popAll(); + widget->getInfoBar()->showSelection(); + } } void AdventureMapInterface::onHeroChanged(const CGHeroInstance *h) @@ -134,15 +137,15 @@ void AdventureMapInterface::activate() } void AdventureMapInterface::deactivate() -{ - CIntObject::deactivate(); - CCS->curh->set(Cursor::Map::POINTER); - - if(LOCPLINT) - LOCPLINT->cingconsole->deactivate(); -} - -void AdventureMapInterface::showAll(Canvas & to) +{ + CIntObject::deactivate(); + CCS->curh->set(Cursor::Map::POINTER); + + if(LOCPLINT) + LOCPLINT->cingconsole->deactivate(); +} + +void AdventureMapInterface::showAll(Canvas & to) { CIntObject::showAll(to); LOCPLINT->cingconsole->show(to); diff --git a/client/gui/CIntObject.cpp b/client/gui/CIntObject.cpp index d82dc6dde..ea6d54234 100644 --- a/client/gui/CIntObject.cpp +++ b/client/gui/CIntObject.cpp @@ -37,8 +37,6 @@ CIntObject::~CIntObject() if(isActive()) deactivate(); - GH.events().assertElementInactive(this); - while(!children.empty()) { if((defActions & DISPOSE) && (children.front()->recActions & DISPOSE)) @@ -104,7 +102,7 @@ void CIntObject::deactivate() void CIntObject::addUsedEvents(ui16 newActions) { - if (isActive()) + if (isActive() && inputEnabled) activateEvents(~used & newActions); used |= newActions; } diff --git a/client/widgets/ObjectLists.cpp b/client/widgets/ObjectLists.cpp index e9f873464..421be9d35 100644 --- a/client/widgets/ObjectLists.cpp +++ b/client/widgets/ObjectLists.cpp @@ -138,6 +138,9 @@ void CListBox::reset() void CListBox::resize(size_t newSize) { + if (totalSize == newSize) + return; + totalSize = newSize; if (slider) slider->setAmount((int)totalSize);