diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2011-08-23 16:34:15 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2011-08-23 23:00:10 +0200 |
commit | 234bcab257567ed0d7975acee29894880f21eba2 (patch) | |
tree | ec97ccb3f23f0bb0406e3659328e946002cb5a08 | |
parent | 28c72e31820ca1ccdca927d5484ad4c3a0c28048 (diff) | |
download | manaserv-234bcab257567ed0d7975acee29894880f21eba2.tar.gz manaserv-234bcab257567ed0d7975acee29894880f21eba2.tar.bz2 manaserv-234bcab257567ed0d7975acee29894880f21eba2.tar.xz manaserv-234bcab257567ed0d7975acee29894880f21eba2.zip |
Allowed map names in chr_warp function.
Resolves: Mana-Mantis #293.
Reviewed-by: Bertram.
-rw-r--r-- | src/scripting/lua.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 7cc09d56..546f4a66 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -299,7 +299,7 @@ static int chr_warp(lua_State *s) Character *q = getCharacter(s, 1); bool b = lua_isnil(s, 2); - if (!q || !(b || lua_isnumber(s, 2))) + if (!q || !(b || lua_isnumber(s, 2) || lua_isstring(s, 2))) { raiseScriptError(s, "chr_warp called with incorrect parameters."); return 0; @@ -312,10 +312,14 @@ static int chr_warp(lua_State *s) Script *t = static_cast<Script *>(lua_touserdata(s, -1)); m = t->getMap(); } - else + else if (lua_isnumber(s, 2)) { m = MapManager::getMap(lua_tointeger(s, 2)); } + else + { + m = MapManager::getMap(lua_tostring(s, 2)); + } if (!m) { raiseScriptError(s, "chr_warp called with a non-existing map."); |