mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Hide minimap if it has been disabled by server
This commit is contained in:
parent
dce9468925
commit
0903190ba2
5 changed files with 22 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue