浏览代码

Fix infobox resetting to current hero during enemy turn

Ivan Savenko 2 年之前
父节点
当前提交
1dff721747
共有 3 个文件被更改,包括 18 次插入14 次删除
  1. 14 11
      client/adventureMap/AdventureMapInterface.cpp
  2. 1 3
      client/gui/CIntObject.cpp
  3. 3 0
      client/widgets/ObjectLists.cpp

+ 14 - 11
client/adventureMap/AdventureMapInterface.cpp

@@ -83,8 +83,11 @@ void AdventureMapInterface::onAudioPaused()
 
 
 void AdventureMapInterface::onHeroMovementStarted(const CGHeroInstance * hero)
 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)
 void AdventureMapInterface::onHeroChanged(const CGHeroInstance *h)
@@ -134,15 +137,15 @@ void AdventureMapInterface::activate()
 }
 }
 
 
 void AdventureMapInterface::deactivate()
 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);
 	CIntObject::showAll(to);
 	LOCPLINT->cingconsole->show(to);
 	LOCPLINT->cingconsole->show(to);

+ 1 - 3
client/gui/CIntObject.cpp

@@ -37,8 +37,6 @@ CIntObject::~CIntObject()
 	if(isActive())
 	if(isActive())
 		deactivate();
 		deactivate();
 
 
-	GH.events().assertElementInactive(this);
-
 	while(!children.empty())
 	while(!children.empty())
 	{
 	{
 		if((defActions & DISPOSE) && (children.front()->recActions & DISPOSE))
 		if((defActions & DISPOSE) && (children.front()->recActions & DISPOSE))
@@ -104,7 +102,7 @@ void CIntObject::deactivate()
 
 
 void CIntObject::addUsedEvents(ui16 newActions)
 void CIntObject::addUsedEvents(ui16 newActions)
 {
 {
-	if (isActive())
+	if (isActive() && inputEnabled)
 		activateEvents(~used & newActions);
 		activateEvents(~used & newActions);
 	used |= newActions;
 	used |= newActions;
 }
 }

+ 3 - 0
client/widgets/ObjectLists.cpp

@@ -138,6 +138,9 @@ void CListBox::reset()
 
 
 void CListBox::resize(size_t newSize)
 void CListBox::resize(size_t newSize)
 {
 {
+	if (totalSize == newSize)
+		return;
+
 	totalSize = newSize;
 	totalSize = newSize;
 	if (slider)
 	if (slider)
 		slider->setAmount((int)totalSize);
 		slider->setAmount((int)totalSize);