1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Fix updating of heroes when moving to/from garrison

This commit is contained in:
Ivan Savenko
2023-07-13 16:20:45 +03:00
parent cc6e8e8c7e
commit 3836217da5
2 changed files with 6 additions and 16 deletions

View File

@@ -287,14 +287,8 @@ void CHeroList::updateElement(const CGHeroInstance * hero)
void CHeroList::updateWidget()
{
for(auto & elem : listBox->getItems())
{
auto item = std::dynamic_pointer_cast<CHeroItem>(elem);
if (item)
item->update();
}
listBox->resize(LOCPLINT->localState->getWanderingHeroes().size());
listBox->reset();
if (LOCPLINT->localState->getCurrentHero())
select(LOCPLINT->localState->getCurrentHero());
@@ -370,14 +364,8 @@ void CTownList::updateElement(const CGTownInstance * town)
void CTownList::updateWidget()
{
for(auto & elem : listBox->getItems())
{
auto item = std::dynamic_pointer_cast<CTownItem>(elem);
if (item)
item->update();
}
listBox->resize(LOCPLINT->localState->getOwnedTowns().size());
listBox->reset();
if (LOCPLINT->localState->getCurrentTown())
select(LOCPLINT->localState->getCurrentTown());