diff --git a/src/xrScriptEngine/script_engine.cpp b/src/xrScriptEngine/script_engine.cpp index 564199b9924..baada83450d 100644 --- a/src/xrScriptEngine/script_engine.cpp +++ b/src/xrScriptEngine/script_engine.cpp @@ -1167,6 +1167,37 @@ bool CScriptEngine::function_object(LPCSTR function_to_call, luabind::object &ob return true; } +void CScriptEngine::add_script_process(const ScriptProcessor &process_id, CScriptProcess *script_process) +{ + VERIFY(m_script_processes.find(process_id)==m_script_processes.end()); + m_script_processes.insert(std::make_pair(process_id, script_process)); +} + +CScriptProcess *CScriptEngine::script_process(const ScriptProcessor &process_id) const +{ + auto it = m_script_processes.find(process_id); + if (it!=m_script_processes.end()) + return it->second; + return nullptr; +} + +void CScriptEngine::parse_script_namespace(const char *name, char *ns, u32 nsSize, char *func, u32 funcSize) +{ + auto p = strrchr(name, '.'); + if (!p) + { + xr_strcpy(ns, nsSize, GlobalNamespace); + p = name-1; + } + else + { + VERIFY(p-name+1<=nsSize); + strncpy(ns, name, p-name); + ns[p-name] = 0; + } + xr_strcpy(func, funcSize, p+1); +} + #if defined(USE_DEBUGGER) && !defined(USE_LUA_STUDIO) void CScriptEngine::stopDebugger() { diff --git a/src/xrScriptEngine/script_engine.hpp b/src/xrScriptEngine/script_engine.hpp index e91cc38a4ba..ad473a057da 100644 --- a/src/xrScriptEngine/script_engine.hpp +++ b/src/xrScriptEngine/script_engine.hpp @@ -157,8 +157,8 @@ class XRSCRIPTENGINE_API CScriptEngine #endif void setup_callbacks(); bool load_file(const char *scriptName, const char *namespaceName); - IC CScriptProcess *script_process(const ScriptProcessor &process_id) const; - IC void add_script_process(const ScriptProcessor &process_id, CScriptProcess *script_process); + CScriptProcess *script_process(const ScriptProcessor &process_id) const; + void add_script_process(const ScriptProcessor &process_id, CScriptProcess *script_process); void remove_script_process(const ScriptProcessor &process_id); static int auto_load(lua_State *L); void setup_auto_load(); @@ -166,7 +166,7 @@ class XRSCRIPTENGINE_API CScriptEngine bool process_file(LPCSTR file_name); bool process_file(LPCSTR file_name, bool reload_modules); bool function_object(LPCSTR function_to_call, luabind::object &object, int type = LUA_TFUNCTION); - IC void parse_script_namespace(const char *name, char *ns, u32 nsSize, char *func, u32 funcSize); + void parse_script_namespace(const char *name, char *ns, u32 nsSize, char *func, u32 funcSize); template IC bool functor(LPCSTR function_to_call, luabind::functor &lua_function); #ifdef USE_DEBUGGER @@ -193,4 +193,12 @@ class XRSCRIPTENGINE_API CScriptEngine void DestroyScriptThread(const CScriptThread *thread); }; -#include "script_engine_inline.hpp" +template +IC bool CScriptEngine::functor(LPCSTR function_to_call, luabind::functor &lua_function) +{ + luabind::object object; + if (!function_object(function_to_call, object)) + return false; + lua_function = object; + return true; +} diff --git a/src/xrScriptEngine/script_engine_inline.hpp b/src/xrScriptEngine/script_engine_inline.hpp deleted file mode 100644 index 4b4fd1511a0..00000000000 --- a/src/xrScriptEngine/script_engine_inline.hpp +++ /dev/null @@ -1,51 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : script_engine_inline.h -// Created : 01.04.2004 -// Modified : 01.04.2004 -// Author : Dmitriy Iassenev -// Description : XRay Script Engine inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -IC void CScriptEngine::add_script_process(const ScriptProcessor &process_id, CScriptProcess *script_process) -{ - CScriptProcessStorage::const_iterator I = m_script_processes.find(process_id); - VERIFY (I == m_script_processes.end()); - m_script_processes.insert(std::make_pair(process_id, script_process)); -} - -CScriptProcess *CScriptEngine::script_process(const ScriptProcessor &process_id) const -{ - CScriptProcessStorage::const_iterator I = m_script_processes.find(process_id); - if ((I != m_script_processes.end())) - return ((*I).second); - return nullptr; -} - -IC void CScriptEngine::parse_script_namespace(const char *name, char *ns, u32 nsSize, char *func, u32 funcSize) -{ - auto p = strrchr(name, '.'); - if (!p) - { - xr_strcpy(ns, nsSize, GlobalNamespace); - p = name-1; - } - else - { - VERIFY(u32(p-name+1)<=nsSize); - strncpy(ns, name, p-name); - ns[p-name] = 0; - } - xr_strcpy(func, funcSize, p+1); -} - -template -IC bool CScriptEngine::functor(LPCSTR function_to_call, luabind::functor &lua_function) -{ - luabind::object object; - if (!function_object(function_to_call, object)) - return false; - lua_function = object; - return true; -} diff --git a/src/xrScriptEngine/xrScriptEngine.vcxproj b/src/xrScriptEngine/xrScriptEngine.vcxproj index 29b6b643000..579c1ce6a0b 100644 --- a/src/xrScriptEngine/xrScriptEngine.vcxproj +++ b/src/xrScriptEngine/xrScriptEngine.vcxproj @@ -240,7 +240,6 @@ - diff --git a/src/xrScriptEngine/xrScriptEngine.vcxproj.filters b/src/xrScriptEngine/xrScriptEngine.vcxproj.filters index de00ce5199f..fb5586e4cd5 100644 --- a/src/xrScriptEngine/xrScriptEngine.vcxproj.filters +++ b/src/xrScriptEngine/xrScriptEngine.vcxproj.filters @@ -57,9 +57,6 @@ Engine - - Engine - Engine