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/script | |
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/script')
-rw-r--r-- | src/script/lua_api/l_minimap.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
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; } |