1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fix tactic button

This commit is contained in:
nordsoft 2022-12-25 14:33:10 +04:00 committed by Nordsoft91
parent 660d25a335
commit e8845244f7
3 changed files with 12 additions and 5 deletions

View File

@ -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"))
{

View File

@ -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;

View File

@ -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;