diff options
author | paramat <paramat@users.noreply.github.com> | 2017-08-18 16:43:31 +0100 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2017-08-20 23:58:15 +0100 |
commit | 7657fe7a505425e82d9cab7ae5638f7927138fb0 (patch) | |
tree | fed13b884e8fff6b8dd43f86399400539c530115 /src/network/clientpackethandler.cpp | |
parent | a3441638c67c9a9f626d7542a53fef6340d42751 (diff) | |
download | minetest-7657fe7a505425e82d9cab7ae5638f7927138fb0.tar.gz minetest-7657fe7a505425e82d9cab7ae5638f7927138fb0.tar.bz2 minetest-7657fe7a505425e82d9cab7ae5638f7927138fb0.zip |
Minimap: Add new HUD flag for minimap radar mode
Flag default is true to not change default behaviour.
The existing minimap HUD flag remains the master control for minimap.
Diffstat (limited to 'src/network/clientpackethandler.cpp')
-rw-r--r-- | src/network/clientpackethandler.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 1d5a28277..86bb88f61 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -1183,18 +1183,23 @@ void Client::handleCommand_HudSetFlags(NetworkPacket* pkt) assert(player != NULL); bool was_minimap_visible = player->hud_flags & HUD_FLAG_MINIMAP_VISIBLE; + bool was_minimap_radar_visible = player->hud_flags & HUD_FLAG_MINIMAP_RADAR_VISIBLE; player->hud_flags &= ~mask; player->hud_flags |= flags; m_minimap_disabled_by_server = !(player->hud_flags & HUD_FLAG_MINIMAP_VISIBLE); + bool m_minimap_radar_disabled_by_server = !(player->hud_flags & HUD_FLAG_MINIMAP_RADAR_VISIBLE); // Hide minimap if it has been disabled by the server - if (m_minimap && m_minimap_disabled_by_server && was_minimap_visible) { + if (m_minimap && 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_minimap->setMinimapMode(MINIMAP_MODE_OFF); - } + + // Switch to surface mode if radar disabled by server + if (m_minimap && m_minimap_radar_disabled_by_server && was_minimap_radar_visible) + m_minimap->setMinimapMode(MINIMAP_MODE_SURFACEx1); } void Client::handleCommand_HudSetParam(NetworkPacket* pkt) |