1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-15 20:03:15 +02:00

Update town visual on capturing

This commit is contained in:
Ivan Savenko
2023-03-15 00:30:58 +02:00
parent 844bf9b9ab
commit 39f2bef1ab
2 changed files with 36 additions and 29 deletions

View File

@@ -324,13 +324,13 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details, bool verbose)
if (!hero) if (!hero)
return; return;
adventureInt->infoBar->requestPopAll(); adventureInt->infoBar->requestPopAll();
if (details.result == TryMoveHero::EMBARK || details.result == TryMoveHero::DISEMBARK) if (details.result == TryMoveHero::EMBARK || details.result == TryMoveHero::DISEMBARK)
{ {
if(hero->getRemovalSound() && hero->tempOwner == playerID) if(hero->getRemovalSound() && hero->tempOwner == playerID)
CCS->soundh->playSound(hero->getRemovalSound().get()); CCS->soundh->playSound(hero->getRemovalSound().get());
} }
adventureInt->minimap->updateTile(hero->convertToVisitablePos(details.start)); adventureInt->minimap->updateTile(hero->convertToVisitablePos(details.start));
adventureInt->minimap->updateTile(hero->convertToVisitablePos(details.end)); adventureInt->minimap->updateTile(hero->convertToVisitablePos(details.end));
@@ -372,12 +372,12 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details, bool verbose)
} }
} }
if(details.stopMovement()) //hero failed to move if(details.stopMovement()) //hero failed to move
{ {
stillMoveHero.setn(STOP_MOVE); stillMoveHero.setn(STOP_MOVE);
adventureInt->heroList->update(hero); adventureInt->heroList->update(hero);
return; return;
} }
adventureInt->heroList->redraw(); adventureInt->heroList->redraw();
@@ -1201,22 +1201,22 @@ void CPlayerInterface::showMapObjectSelectDialog(QueryID askID, const Component
GH.pushInt(wnd); GH.pushInt(wnd);
} }
void CPlayerInterface::tileRevealed(const std::unordered_set<int3, ShashInt3> &pos) void CPlayerInterface::tileRevealed(const std::unordered_set<int3, ShashInt3> &pos)
{ {
EVENT_HANDLER_CALLED_BY_CLIENT; EVENT_HANDLER_CALLED_BY_CLIENT;
//FIXME: wait for dialog? Magi hut/eye would benefit from this but may break other areas //FIXME: wait for dialog? Magi hut/eye would benefit from this but may break other areas
for (auto & po : pos) for (auto & po : pos)
adventureInt->minimap->updateTile(po); adventureInt->minimap->updateTile(po);
} }
void CPlayerInterface::tileHidden(const std::unordered_set<int3, ShashInt3> &pos) void CPlayerInterface::tileHidden(const std::unordered_set<int3, ShashInt3> &pos)
{ {
EVENT_HANDLER_CALLED_BY_CLIENT; EVENT_HANDLER_CALLED_BY_CLIENT;
for (auto & po : pos) for (auto & po : pos)
adventureInt->minimap->updateTile(po); adventureInt->minimap->updateTile(po);
} }
void CPlayerInterface::openHeroWindow(const CGHeroInstance *hero) void CPlayerInterface::openHeroWindow(const CGHeroInstance *hero)
{ {
boost::unique_lock<boost::recursive_mutex> un(*pim); boost::unique_lock<boost::recursive_mutex> un(*pim);
GH.pushIntT<CHeroWindow>(hero); GH.pushIntT<CHeroWindow>(hero);

View File

@@ -604,6 +604,13 @@ void ApplyClientNetPackVisitor::visitSetObjectProperty(SetObjectProperty & pack)
if(gs.isVisible(gs.getObjInstance(pack.id), it->first)) if(gs.isVisible(gs.getObjInstance(pack.id), it->first))
callInterfaceIfPresent(cl, it->first, &IGameEventsReceiver::objectPropertyChanged, &pack); callInterfaceIfPresent(cl, it->first, &IGameEventsReceiver::objectPropertyChanged, &pack);
} }
if (pack.what == ObjProperty::OWNER)
{
// invalidate section of map view with our objec and force an update with new flag color
CGI->mh->onObjectInstantRemove(gs.getObjInstance(pack.id));
CGI->mh->onObjectInstantAdd(gs.getObjInstance(pack.id));
}
} }
void ApplyClientNetPackVisitor::visitHeroLevelUp(HeroLevelUp & pack) void ApplyClientNetPackVisitor::visitHeroLevelUp(HeroLevelUp & pack)