Переглянути джерело

CAdvMapInt: block spellbook button when no hero selected

ArseniyShestakov 10 роки тому
батько
коміт
807fd6391b

+ 7 - 0
client/windows/CAdvmapInterface.cpp

@@ -767,6 +767,11 @@ void CAdvMapInt::updateMoveHero(const CGHeroInstance *h, tribool hasPath)
 	moveHero->block(!hasPath || (h->movement == 0));
 }
 
+void CAdvMapInt::updateSpellbook(const CGHeroInstance *h)
+{
+	spellbook->block(!h);
+}
+
 int CAdvMapInt::getNextHeroIndex(int startIndex)
 {
 	if (LOCPLINT->wanderingHeroes.size() == 0)
@@ -1262,6 +1267,7 @@ void CAdvMapInt::select(const CArmedInstance *sel, bool centerView /*= true*/)
 
 		updateSleepWake(nullptr);
 		updateMoveHero(nullptr);
+		updateSpellbook(nullptr);
 	}
 	else //hero selected
 	{
@@ -1275,6 +1281,7 @@ void CAdvMapInt::select(const CArmedInstance *sel, bool centerView /*= true*/)
 
 		updateSleepWake(hero);
 		updateMoveHero(hero);
+		updateSpellbook(hero);
 	}
 	townList.redraw();
 	heroList.redraw();

+ 1 - 0
client/windows/CAdvmapInterface.h

@@ -235,6 +235,7 @@ public:
 	//button updates
 	void updateSleepWake(const CGHeroInstance *h);
 	void updateMoveHero(const CGHeroInstance *h, tribool hasPath = boost::logic::indeterminate);
+	void updateSpellbook(const CGHeroInstance *h);
 	void updateNextHero(const CGHeroInstance *h);
 
 	/// changes current adventure map mode; used to switch between default view and world view; scale is ignored if EAdvMapMode == NORMAL