From 4e80356beadddff0e7b16a961eb92ec745e9fa8e Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 3 Jul 2023 19:36:10 +0300 Subject: [PATCH] Do not hide minimap on human player turn --- client/CPlayerInterface.cpp | 5 ++++- client/adventureMap/AdventureMapInterface.cpp | 4 ++-- client/adventureMap/AdventureMapInterface.h | 2 +- client/adventureMap/CMinimap.cpp | 2 +- client/adventureMap/CMinimap.h | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 595ade466..b40d078b3 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -183,7 +183,10 @@ void CPlayerInterface::playerStartsTurn(PlayerColor player) if (player != playerID && LOCPLINT == this) { waitWhileDialog(); - adventureInt->onEnemyTurnStarted(player); + + bool isHuman = cb->getStartInfo()->playerInfos.count(player) && cb->getStartInfo()->playerInfos.at(player).isControlledByHuman(); + + adventureInt->onEnemyTurnStarted(player, isHuman); } } diff --git a/client/adventureMap/AdventureMapInterface.cpp b/client/adventureMap/AdventureMapInterface.cpp index a4440d76f..fc10a67d0 100644 --- a/client/adventureMap/AdventureMapInterface.cpp +++ b/client/adventureMap/AdventureMapInterface.cpp @@ -309,13 +309,13 @@ void AdventureMapInterface::onHotseatWaitStarted(PlayerColor playerID) setState(EAdventureState::HOTSEAT_WAIT); } -void AdventureMapInterface::onEnemyTurnStarted(PlayerColor playerID) +void AdventureMapInterface::onEnemyTurnStarted(PlayerColor playerID, bool isHuman) { if(settings["session"]["spectate"].Bool()) return; mapAudio->onEnemyTurnStarted(); - widget->getMinimap()->setAIRadar(true); + widget->getMinimap()->setAIRadar(!isHuman); widget->getInfoBar()->startEnemyTurn(LOCPLINT->cb->getCurrentPlayer()); setState(EAdventureState::ENEMY_TURN); } diff --git a/client/adventureMap/AdventureMapInterface.h b/client/adventureMap/AdventureMapInterface.h index 488778bfc..6f69b2cdd 100644 --- a/client/adventureMap/AdventureMapInterface.h +++ b/client/adventureMap/AdventureMapInterface.h @@ -115,7 +115,7 @@ public: void onHotseatWaitStarted(PlayerColor playerID); /// Called by PlayerInterface when AI or remote human player starts his turn - void onEnemyTurnStarted(PlayerColor playerID); + void onEnemyTurnStarted(PlayerColor playerID, bool isHuman); /// Called by PlayerInterface when local human player starts his turn void onPlayerTurnStarted(PlayerColor playerID); diff --git a/client/adventureMap/CMinimap.cpp b/client/adventureMap/CMinimap.cpp index 57c740fcd..5fa99358f 100644 --- a/client/adventureMap/CMinimap.cpp +++ b/client/adventureMap/CMinimap.cpp @@ -231,7 +231,7 @@ void CMinimap::setAIRadar(bool on) redraw(); } -void CMinimap::updateTiles(std::unordered_set positions) +void CMinimap::updateTiles(const std::unordered_set & positions) { if(minimap) { diff --git a/client/adventureMap/CMinimap.h b/client/adventureMap/CMinimap.h index 496611bb5..76eb4c95d 100644 --- a/client/adventureMap/CMinimap.h +++ b/client/adventureMap/CMinimap.h @@ -68,6 +68,6 @@ public: void showAll(Canvas & to) override; - void updateTiles(std::unordered_set positions); + void updateTiles(const std::unordered_set & positions); };