1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Fix minimap updating on hero loss

This commit is contained in:
Ivan Savenko
2023-02-12 13:02:06 +02:00
parent 91b17bed79
commit 72fe1fcfa9
5 changed files with 11 additions and 1 deletions

View File

@@ -1530,6 +1530,12 @@ void CPlayerInterface::objectRemoved(const CGObjectInstance * obj)
}
}
void CPlayerInterface::objectRemovedAfter()
{
EVENT_HANDLER_CALLED_BY_CLIENT;
adventureInt->minimap->update();
}
void CPlayerInterface::playerBlocked(int reason, bool start)
{
if(reason == PlayerBlocked::EReason::UPCOMING_BATTLE)

View File

@@ -176,6 +176,7 @@ public:
void centerView (int3 pos, int focusTime) override;
void objectPropertyChanged(const SetObjectProperty * sop) override;
void objectRemoved(const CGObjectInstance *obj) override;
void objectRemovedAfter() override;
void playerBlocked(int reason, bool start) override;
void gameOver(PlayerColor player, const EVictoryLossCheckResult & victoryLossCheckResult) override;
void playerStartsTurn(PlayerColor player) override; //called before yourTurn on active itnerface

View File

@@ -429,6 +429,8 @@ void ApplyFirstClientNetPackVisitor::visitRemoveObject(RemoveObject & pack)
void ApplyClientNetPackVisitor::visitRemoveObject(RemoveObject & pack)
{
cl.invalidatePaths();
for(auto i=cl.playerint.begin(); i!=cl.playerint.end(); i++)
i->second->objectRemovedAfter();
}
void ApplyFirstClientNetPackVisitor::visitTryMoveHero(TryMoveHero & pack)

View File

@@ -127,6 +127,7 @@ public:
virtual void requestRealized(PackageApplied *pa){};
virtual void objectPropertyChanged(const SetObjectProperty * sop){}; //eg. mine has been flagged
virtual void objectRemoved(const CGObjectInstance *obj){}; //eg. collected resource, picked artifact, beaten hero
virtual void objectRemovedAfter(){}; //eg. collected resource, picked artifact, beaten hero
virtual void playerBlocked(int reason, bool start){}; //reason: 0 - upcoming battle
virtual void gameOver(PlayerColor player, const EVictoryLossCheckResult & victoryLossCheckResult) {}; //player lost or won the game
virtual void playerStartsTurn(PlayerColor player){};

View File

@@ -2016,7 +2016,7 @@ void NewTurn::applyGs(CGameState *gs)
for(const auto & re : res)
{
assert(i->first < PlayerColor::PLAYER_LIMIT);
assert(re.first < PlayerColor::PLAYER_LIMIT);
gs->getPlayerState(re.first)->resources = re.second;
}