Jelajahi Sumber

Fix infobox resetting to current hero during enemy turn

Ivan Savenko 2 tahun lalu
induk
melakukan
1dff721747

+ 14 - 11
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);

+ 1 - 3
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;
 }

+ 3 - 0
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);