Skip to content

Commit

Permalink
теперь луа-функция log работает и в релизе
Browse files Browse the repository at this point in the history
  • Loading branch information
abramcumner committed Jan 21, 2017
1 parent 88fb83f commit 4724008
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
8 changes: 4 additions & 4 deletions xray/xrEngine/ai_script_lua_extension.cpp
Expand Up @@ -31,10 +31,10 @@ using namespace Script;

int __cdecl Lua::LuaOut(Lua::ELuaMessageType tLuaMessageType, LPCSTR caFormat, ...)
{
#ifndef ENGINE_BUILD
if (!psAI_Flags.test(aiLua))
return(0);
#endif
//#ifndef ENGINE_BUILD
// if (!psAI_Flags.test(aiLua))
// return(0);
//#endif

LPCSTR S = "", SS = "";
LPSTR S1;
Expand Down
11 changes: 8 additions & 3 deletions xray/xrServerEntities/script_engine_script.cpp
Expand Up @@ -15,9 +15,9 @@ using namespace luabind;

void LuaLog(LPCSTR caMessage)
{
#ifndef MASTER_GOLD
ai().script_engine().script_log (ScriptStorage::eLuaMessageTypeMessage,"%s",caMessage);
#endif // #ifndef MASTER_GOLD
//#ifndef MASTER_GOLD
ai().script_engine().script_log (ScriptStorage::eLuaMessageTypeUser,"%s",caMessage);
//#endif // #ifndef MASTER_GOLD

#ifdef USE_DEBUGGER
# ifndef USE_LUA_STUDIO
Expand All @@ -30,6 +30,11 @@ void LuaLog(LPCSTR caMessage)
void ErrorLog(LPCSTR caMessage)
{
ai().script_engine().error_log("%s",caMessage);

#ifdef PRINT_CALL_STACK
ai().script_engine().print_stack();
#endif // #ifdef PRINT_CALL_STACK

#ifdef USE_DEBUGGER
# ifndef USE_LUA_STUDIO
if( ai().script_engine().debugger() ){
Expand Down
16 changes: 10 additions & 6 deletions xray/xrServerEntities/script_storage.cpp
Expand Up @@ -291,18 +291,18 @@ void CScriptStorage::reinit ()
int CScriptStorage::vscript_log (ScriptStorage::ELuaMessageType tLuaMessageType, LPCSTR caFormat, va_list marker)
{
#ifndef NO_XRGAME_SCRIPT_ENGINE
# ifdef DEBUG
if (!psAI_Flags.test(aiLua) && (tLuaMessageType != ScriptStorage::eLuaMessageTypeError))
return(0);
# endif
//# ifdef DEBUG
// if (!psAI_Flags.test(aiLua) && (tLuaMessageType != ScriptStorage::eLuaMessageTypeError))
// return(0);
//# endif
#endif

#ifndef PRINT_CALL_STACK
return (0);
#else // #ifdef PRINT_CALL_STACK
# ifndef NO_XRGAME_SCRIPT_ENGINE
if (!psAI_Flags.test(aiLua) && (tLuaMessageType != ScriptStorage::eLuaMessageTypeError))
return(0);
//if (!psAI_Flags.test(aiLua) && (tLuaMessageType != ScriptStorage::eLuaMessageTypeError))
// return(0);
# endif // #ifndef NO_XRGAME_SCRIPT_ENGINE

LPCSTR S = "", SS = "";
Expand Down Expand Up @@ -348,6 +348,10 @@ int CScriptStorage::vscript_log (ScriptStorage::ELuaMessageType tLuaMessageType
S = "[LUA][HOOK_TAIL_RETURN] ";
SS = "[TAIL_RETURN] ";
break;
case ScriptStorage::eLuaMessageTypeUser:
S = "";
SS = "";
break;
}
default : NODEFAULT;
}
Expand Down
8 changes: 4 additions & 4 deletions xray/xrServerEntities/script_storage.h
Expand Up @@ -20,13 +20,13 @@ class CScriptThread;
#endif // #ifndef MASTER_GOLD

#ifdef XRGAME_EXPORTS
# ifndef MASTER_GOLD
//# ifndef MASTER_GOLD
# define PRINT_CALL_STACK
# endif // #ifndef MASTER_GOLD
//# endif // #ifndef MASTER_GOLD
#else // #ifdef XRGAME_EXPORTS
# ifndef NDEBUG
//# ifndef NDEBUG
# define PRINT_CALL_STACK
# endif // #ifndef NDEBUG
//# endif // #ifndef NDEBUG
#endif // #ifdef XRGAME_EXPORTS

using namespace ScriptStorage;
Expand Down
1 change: 1 addition & 0 deletions xray/xrServerEntities/script_storage_space.h
Expand Up @@ -17,6 +17,7 @@ namespace ScriptStorage {
eLuaMessageTypeHookReturn,
eLuaMessageTypeHookLine,
eLuaMessageTypeHookCount,
eLuaMessageTypeUser,
eLuaMessageTypeHookTailReturn = u32(-1),
};
}

0 comments on commit 4724008

Please sign in to comment.