nordsoft 2 anni fa
parent
commit
e8845244f7

+ 3 - 5
client/battle/BattleControlPanel.cpp

@@ -99,12 +99,10 @@ void BattleControlPanel::tacticPhaseStarted()
 }
 void BattleControlPanel::tacticPhaseEnded()
 {
-	build(variables["battleItems"]);
+	deleteWidget("tacticNext");
+	deleteWidget("tacticEnd");
 
-	if(auto w = widget<CButton>("tacticNext"))
-		w.reset();
-	if(auto w = widget<CButton>("tacticEnd"))
-		w.reset();
+	build(variables["battleItems"]);
 
 	if(auto w = widget<CPicture>("menu"))
 	{

+ 7 - 0
client/gui/InterfaceObjectConfigurable.cpp

@@ -66,6 +66,13 @@ void InterfaceObjectConfigurable::addCallback(const std::string & callbackName,
 	callbacks[callbackName] = callback;
 }
 
+void InterfaceObjectConfigurable::deleteWidget(const std::string & name)
+{
+	auto iter = widgets.find(name);
+	if(iter != widgets.end())
+		widgets.erase(iter);
+}
+
 void InterfaceObjectConfigurable::build(const JsonNode &config)
 {
 	OBJ_CONSTRUCTION;

+ 2 - 0
client/gui/InterfaceObjectConfigurable.h

@@ -52,6 +52,8 @@ protected:
 			return nullptr;
 		return std::dynamic_pointer_cast<T>(iter->second);
 	}
+	
+	void deleteWidget(const std::string & name);
 		
 	//basic serializers
 	Point readPosition(const JsonNode &) const;