浏览代码

Correctly update hero list on reordering via radial menu

Ivan Savenko 1 年之前
父节点
当前提交
a08546e964

+ 2 - 0
client/PlayerLocalState.cpp

@@ -239,6 +239,8 @@ void PlayerLocalState::swapWanderingHero(int pos1, int pos2)
 {
 	assert(wanderingHeroes[pos1] && wanderingHeroes[pos2]);
 	std::swap(wanderingHeroes[pos1], wanderingHeroes[pos2]);
+
+	adventureInt->onHeroOrderChanged();
 }
 
 const std::vector<const CGTownInstance *> & PlayerLocalState::getOwnedTowns()

+ 5 - 0
client/adventureMap/AdventureMapInterface.cpp

@@ -331,6 +331,11 @@ void AdventureMapInterface::onTownOrderChanged()
 	widget->getTownList()->updateWidget();
 }
 
+void AdventureMapInterface::onHeroOrderChanged()
+{
+	widget->getHeroList()->updateWidget();
+}
+
 void AdventureMapInterface::onMapTilesChanged(boost::optional<std::unordered_set<int3>> positions)
 {
 	if (positions)

+ 3 - 0
client/adventureMap/AdventureMapInterface.h

@@ -149,6 +149,9 @@ public:
 	/// Called when town order changes
 	void onTownOrderChanged();
 
+	/// Called when hero order changes
+	void onHeroOrderChanged();
+
 	/// Called when map audio should be paused, e.g. on combat or town screen access
 	void onAudioPaused();