aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_minimap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api/l_minimap.cpp')
-rw-r--r--src/script/lua_api/l_minimap.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/script/lua_api/l_minimap.cpp b/src/script/lua_api/l_minimap.cpp
index 5fba76eb8..3bbb6e5e3 100644
--- a/src/script/lua_api/l_minimap.cpp
+++ b/src/script/lua_api/l_minimap.cpp
@@ -89,7 +89,7 @@ int LuaMinimap::l_get_mode(lua_State *L)
LuaMinimap *ref = checkobject(L, 1);
Minimap *m = getobject(ref);
- lua_pushinteger(L, m->getMinimapMode());
+ lua_pushinteger(L, m->getModeIndex());
return 1;
}
@@ -98,13 +98,11 @@ int LuaMinimap::l_set_mode(lua_State *L)
LuaMinimap *ref = checkobject(L, 1);
Minimap *m = getobject(ref);
- s32 mode = lua_tointeger(L, 2);
- if (mode < MINIMAP_MODE_OFF ||
- mode >= MINIMAP_MODE_COUNT) {
+ u32 mode = lua_tointeger(L, 2);
+ if (mode >= m->getMaxModeIndex())
return 0;
- }
- m->setMinimapMode((MinimapMode) mode);
+ m->setModeIndex(mode);
return 1;
}
@@ -140,8 +138,11 @@ int LuaMinimap::l_show(lua_State *L)
LuaMinimap *ref = checkobject(L, 1);
Minimap *m = getobject(ref);
- if (m->getMinimapMode() == MINIMAP_MODE_OFF)
- m->setMinimapMode(MINIMAP_MODE_SURFACEx1);
+ // This is not very adapted to new minimap mode management. Btw, tried
+ // to do something compatible.
+
+ if (m->getModeIndex() == 0 && m->getMaxModeIndex() > 0)
+ m->setModeIndex(1);
client->showMinimap(true);
return 1;
@@ -155,8 +156,11 @@ int LuaMinimap::l_hide(lua_State *L)
LuaMinimap *ref = checkobject(L, 1);
Minimap *m = getobject(ref);
- if (m->getMinimapMode() != MINIMAP_MODE_OFF)
- m->setMinimapMode(MINIMAP_MODE_OFF);
+ // This is not very adapted to new minimap mode management. Btw, tried
+ // to do something compatible.
+
+ if (m->getModeIndex() != 0)
+ m->setModeIndex(0);
client->showMinimap(false);
return 1;