summaryrefslogtreecommitdiffstats
path: root/src/scripting/luautil.cpp
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-05-04 23:48:20 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-05-11 23:31:15 +0200
commit01df6f017d798a1973ab5c20d3d895cb7f86dcb5 (patch)
tree4af7dea96f2a365acc06820262e78d66f4fa858d /src/scripting/luautil.cpp
parent7e88a973c00bd96af1288399a4e6dab207e8683c (diff)
downloadmanaserv-01df6f017d798a1973ab5c20d3d895cb7f86dcb5.tar.gz
manaserv-01df6f017d798a1973ab5c20d3d895cb7f86dcb5.tar.xz
manaserv-01df6f017d798a1973ab5c20d3d895cb7f86dcb5.zip
Added function to check for lenght of a possible path
Diffstat (limited to 'src/scripting/luautil.cpp')
-rw-r--r--src/scripting/luautil.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/scripting/luautil.cpp b/src/scripting/luautil.cpp
index f889aa6..7dd2b19 100644
--- a/src/scripting/luautil.cpp
+++ b/src/scripting/luautil.cpp
@@ -21,6 +21,8 @@
#include "luautil.h"
+#include <string.h>
+
#include "game-server/character.h"
#include "game-server/itemmanager.h"
#include "game-server/monster.h"
@@ -235,6 +237,20 @@ AbilityManager::AbilityInfo *checkAbility(lua_State *s, int p)
return abilityInfo;
}
+unsigned char checkWalkMask(lua_State *s, int p)
+{
+ const char *stringMask = luaL_checkstring(s, p);
+ unsigned char mask = 0x00;
+ if (strchr(stringMask, 'w'))
+ mask |= Map::BLOCKMASK_WALL;
+ if (strchr(stringMask, 'c'))
+ mask |= Map::BLOCKMASK_CHARACTER;
+ if (strchr(stringMask, 'm'))
+ mask |= Map::BLOCKMASK_MONSTER;
+
+ return mask;
+}
+
MapComposite *checkCurrentMap(lua_State *s, Script *script /* = 0 */)
{