m_particle_manager(&m_env),
m_con(PROTOCOL_ID, 512, CONNECTION_TIMEOUT, ipv6, this),
m_device(device),
+ m_minimap_disabled_by_server(false),
m_server_ser_ver(SER_FMT_VER_INVALID),
m_proto_ver(0),
m_playeritem(0),
Mapper* getMapper ()
{ return m_mapper; }
+ bool isMinimapDisabledByServer()
+ { return m_minimap_disabled_by_server; }
+
// IGameDef interface
virtual IItemDefManager* getItemDefManager();
virtual INodeDefManager* getNodeDefManager();
con::Connection m_con;
IrrlichtDevice *m_device;
Mapper *m_mapper;
+ bool m_minimap_disabled_by_server;
// Server serialization version
u8 m_server_ser_ver;
updateFrame(highlight_boxes, &graph, &stats, &runData, dtime,
flags, cam_view);
updateProfilerGraphs(&graph);
+
+ // Update if minimap has been disabled by the server
+ flags.show_minimap &= !client->isMinimapDisabledByServer();
}
}
#define HUD_CORNER_CENTER 2
// Note that these visibility flags do not determine if the hud items are
-// actually drawn, but rather, allows the item to be drawn should the rest of
-// the game state permit it.
+// actually drawn, but rather, whether to draw the item should the rest
+// of the game state permit it.
#define HUD_FLAG_HOTBAR_VISIBLE (1 << 0)
#define HUD_FLAG_HEALTHBAR_VISIBLE (1 << 1)
#define HUD_FLAG_CROSSHAIR_VISIBLE (1 << 2)
#include "log.h"
#include "map.h"
#include "mapsector.h"
+#include "minimap.h"
#include "nodedef.h"
#include "serialization.h"
#include "server.h"
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)