diff options
author | est31 <MTest31@outlook.com> | 2015-09-01 03:07:02 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-09-01 19:00:33 +0200 |
commit | 0903190ba2ed2134c464f2efe694d7281ead1c09 (patch) | |
tree | 94d4a169560be1e9ef4b69574b9f1c8ab0b0c06c /src/network/clientpackethandler.cpp | |
parent | dce9468925b2208b8178722af218d9cd30a35a64 (diff) | |
download | minetest-0903190ba2ed2134c464f2efe694d7281ead1c09.tar.gz minetest-0903190ba2ed2134c464f2efe694d7281ead1c09.tar.bz2 minetest-0903190ba2ed2134c464f2efe694d7281ead1c09.zip |
Hide minimap if it has been disabled by server
Diffstat (limited to 'src/network/clientpackethandler.cpp')
-rw-r--r-- | src/network/clientpackethandler.cpp | 12 |
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) |