mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02: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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user