소스 검색

attempt to show shipyard dialog only when a hero is selected

fixes regression from a4e8255cbcfbb288c7bf9524d6763901a761e418
Andrey Filipenkov 2 년 전
부모
커밋
612b5e2746
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      client/windows/CAdvmapInterface.cpp

+ 5 - 1
client/windows/CAdvmapInterface.cpp

@@ -1587,6 +1587,7 @@ void CAdvMapInt::tileLClicked(const int3 &mapPos)
 	bool canSelect = topBlocking && topBlocking->ID == Obj::HERO && topBlocking->tempOwner == LOCPLINT->playerID;
 	bool canSelect = topBlocking && topBlocking->ID == Obj::HERO && topBlocking->tempOwner == LOCPLINT->playerID;
 	canSelect |= topBlocking && topBlocking->ID == Obj::TOWN && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, topBlocking->tempOwner);
 	canSelect |= topBlocking && topBlocking->ID == Obj::TOWN && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, topBlocking->tempOwner);
 
 
+	bool isHero = false;
 	if(selection->ID != Obj::HERO) //hero is not selected (presumably town)
 	if(selection->ID != Obj::HERO) //hero is not selected (presumably town)
 	{
 	{
 		assert(!terrain.currentPath); //path can be active only when hero is selected
 		assert(!terrain.currentPath); //path can be active only when hero is selected
@@ -1597,6 +1598,8 @@ void CAdvMapInt::tileLClicked(const int3 &mapPos)
 	}
 	}
 	else if(const CGHeroInstance * currentHero = curHero()) //hero is selected
 	else if(const CGHeroInstance * currentHero = curHero()) //hero is selected
 	{
 	{
+		isHero = true;
+
 		const CGPathNode *pn = LOCPLINT->cb->getPathsInfo(currentHero)->getPathInfo(mapPos);
 		const CGPathNode *pn = LOCPLINT->cb->getPathsInfo(currentHero)->getPathInfo(mapPos);
 		if(currentHero == topBlocking) //clicked selected hero
 		if(currentHero == topBlocking) //clicked selected hero
 		{
 		{
@@ -1638,7 +1641,8 @@ void CAdvMapInt::tileLClicked(const int3 &mapPos)
 		throw std::runtime_error("Nothing is selected...");
 		throw std::runtime_error("Nothing is selected...");
 	}
 	}
 
 
-	if(const IShipyard *shipyard = ourInaccessibleShipyard(topBlocking))
+	const auto shipyard = ourInaccessibleShipyard(topBlocking);
+	if(isHero && shipyard != nullptr)
 	{
 	{
 		LOCPLINT->showShipyardDialogOrProblemPopup(shipyard);
 		LOCPLINT->showShipyardDialogOrProblemPopup(shipyard);
 	}
 	}