From 0903190ba2ed2134c464f2efe694d7281ead1c09 Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 1 Sep 2015 03:07:02 +0200 Subject: Hide minimap if it has been disabled by server --- src/network/clientpackethandler.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/network') 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) -- cgit v1.2.3