1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

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.
This commit is contained in:
paramat 2017-08-18 16:43:31 +01:00 committed by paramat
parent a3441638c6
commit 7657fe7a50
6 changed files with 33 additions and 17 deletions

View file

@ -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)