]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/script/lua_api/l_internal.h
SAPI: Mark all Lua API functions requiring envlock
[dragonfireclient.git] / src / script / lua_api / l_internal.h
index e8a029b868ab63c68ab5bb39d6e8d70b55646349..456c8fcce9895bfdbf32853e67b21c1885aea158 100644 (file)
@@ -33,12 +33,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #define API_FCT(name) registerFunction(L, #name, l_##name,top)
 #define ASYNC_API_FCT(name) engine.registerFunction(#name, l_##name)
 
-#if (defined(WIN32) || defined(_WIN32_WCE))
+#define MAP_LOCK_REQUIRED
 #define NO_MAP_LOCK_REQUIRED
+
+/*
+#if (defined(WIN32) || defined(_WIN32_WCE))
+       #define NO_MAP_LOCK_REQUIRED
 #else
-#include "profiler.h"
-#define NO_MAP_LOCK_REQUIRED \
-       ScopeProfiler nolocktime(g_profiler,"Scriptapi: unlockable time",SPT_ADD)
+       #include "profiler.h"
+       #define NO_MAP_LOCK_REQUIRED \
+               ScopeProfiler nolocktime(g_profiler,"Scriptapi: unlockable time",SPT_ADD)
 #endif
+*/
+
+#define GET_ENV_PTR_NO_MAP_LOCK                              \
+       ServerEnvironment *env = (ServerEnvironment *)getEnv(L); \
+       if (env == NULL)                                         \
+               return 0
+
+#define GET_ENV_PTR         \
+       MAP_LOCK_REQUIRED;      \
+       GET_ENV_PTR_NO_MAP_LOCK
 
 #endif /* L_INTERNAL_H_ */