diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-03-17 07:54:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-17 07:54:49 +0100 |
commit | 7b74f04a611ddaf36d79c0c9ebbf7f2b89c12a64 (patch) | |
tree | 51f9cf13b08c9e4e444780ff479e3ffee4649699 /src | |
parent | 0891975ad6c8d6d3e15b20f33b22cf5baca7eb62 (diff) | |
download | minetest-7b74f04a611ddaf36d79c0c9ebbf7f2b89c12a64.tar.gz minetest-7b74f04a611ddaf36d79c0c9ebbf7f2b89c12a64.tar.bz2 minetest-7b74f04a611ddaf36d79c0c9ebbf7f2b89c12a64.zip |
[CSM] Fix minimap problems (#5405)
This fixes issue #5404
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 7 | ||||
-rw-r--r-- | src/client.h | 2 | ||||
-rw-r--r-- | src/game.cpp | 2 | ||||
-rw-r--r-- | src/script/lua_api/l_minimap.cpp | 16 |
4 files changed, 12 insertions, 15 deletions
diff --git a/src/client.cpp b/src/client.cpp index b355fa617..e87c0ff94 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -224,7 +224,6 @@ Client::Client( m_device(device), m_camera(NULL), m_minimap_disabled_by_server(false), - m_minimap_shown_by_mod(false), m_server_ser_ver(SER_FMT_VER_INVALID), m_proto_ver(0), m_playeritem(0), @@ -1933,11 +1932,7 @@ void Client::makeScreenshot(IrrlichtDevice *device) bool Client::shouldShowMinimap() const { - if (m_minimap_disabled_by_server) { - return false; - } - - return m_minimap_shown_by_mod; + return !m_minimap_disabled_by_server; } // IGameDef interface diff --git a/src/client.h b/src/client.h index 5c8a0ae25..fc1cbe310 100644 --- a/src/client.h +++ b/src/client.h @@ -532,7 +532,6 @@ public: { return m_camera; } bool shouldShowMinimap() const; - void setMinimapShownByMod(bool state) { m_minimap_shown_by_mod = state; } // IGameDef interface virtual IItemDefManager* getItemDefManager(); @@ -634,7 +633,6 @@ private: Camera *m_camera; Minimap *m_minimap; bool m_minimap_disabled_by_server; - bool m_minimap_shown_by_mod; // Server serialization version u8 m_server_ser_ver; diff --git a/src/game.cpp b/src/game.cpp index 386267017..4a3acf493 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1769,7 +1769,7 @@ void Game::run() updateProfilerGraphs(&graph); // Update if minimap has been disabled by the server - flags.show_minimap = client->shouldShowMinimap(); + flags.show_minimap &= client->shouldShowMinimap(); } } diff --git a/src/script/lua_api/l_minimap.cpp b/src/script/lua_api/l_minimap.cpp index bbe9aef82..cb0245576 100644 --- a/src/script/lua_api/l_minimap.cpp +++ b/src/script/lua_api/l_minimap.cpp @@ -118,17 +118,21 @@ int LuaMinimap::l_toggle_shape(lua_State *L) int LuaMinimap::l_show(lua_State *L) { - Client *client = getClient(L); - assert(client); - client->setMinimapShownByMod(true); + LuaMinimap *ref = checkobject(L, 1); + Minimap *m = getobject(ref); + + if (m->getMinimapMode() == MINIMAP_MODE_OFF) + m->setMinimapMode(MINIMAP_MODE_SURFACEx1); return 1; } int LuaMinimap::l_hide(lua_State *L) { - Client *client = getClient(L); - assert(client); - client->setMinimapShownByMod(false); + LuaMinimap *ref = checkobject(L, 1); + Minimap *m = getobject(ref); + + if (m->getMinimapMode() != MINIMAP_MODE_OFF) + m->setMinimapMode(MINIMAP_MODE_OFF); return 1; } |