From 01df6f017d798a1973ab5c20d3d895cb7f86dcb5 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Sat, 4 May 2013 23:48:20 +0200 Subject: Added function to check for lenght of a possible path --- src/scripting/luautil.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/scripting/luautil.cpp') 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 + #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 */) { -- cgit