summaryrefslogtreecommitdiff
path: root/src/network/clientpackethandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/clientpackethandler.cpp')
-rw-r--r--src/network/clientpackethandler.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index 04f94c58b..d49c96029 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#include "map.h"
#include "mapsector.h"
+#include "minimap.h"
#include "nodedef.h"
#include "serialization.h"
#include "server.h"
@@ -1094,8 +1095,19 @@ void Client::handleCommand_HudSetFlags(NetworkPacket* pkt)
Player *player = m_env.getLocalPlayer();
assert(player != NULL);
+ bool was_minimap_visible = player->hud_flags & HUD_FLAG_MINIMAP_VISIBLE;
+
player->hud_flags &= ~mask;
player->hud_flags |= flags;
+
+ m_minimap_disabled_by_server = !(player->hud_flags & HUD_FLAG_MINIMAP_VISIBLE);
+
+ // Hide minimap if it has been disabled by the server
+ if (m_minimap_disabled_by_server && was_minimap_visible) {
+ // defers a minimap update, therefore only call it if really
+ // needed, by checking that minimap was visible before
+ m_mapper->setMinimapMode(MINIMAP_MODE_OFF);
+ }
}
void Client::handleCommand_HudSetParam(NetworkPacket* pkt)