From 7b74f04a611ddaf36d79c0c9ebbf7f2b89c12a64 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Fri, 17 Mar 2017 07:54:49 +0100 Subject: [CSM] Fix minimap problems (#5405) This fixes issue #5404 --- src/script/lua_api/l_minimap.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/script') 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; } -- cgit v1.2.3