MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / OnScriptError

Method OnScriptError

CrySystem/ScriptSink.cpp:64–115  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

62
63//////////////////////////////////////////////////////////////////////
64void CScriptSink::OnScriptError(const char *sSourceFile,const char *sFuncName,int nLineNum,const char *sErrorDesc)
65{
66 string sTemp;
67 int n=0;
68
69 if(nLineNum!=-1) // line no info?
70 {
71 m_pSystem->Warning( VALIDATOR_MODULE_SCRIPTSYSTEM,VALIDATOR_ERROR,VALIDATOR_FLAG_SCRIPT,sSourceFile,
72 "$3#SCRIPT ERROR File: %s, Line [%03d], Function: %s,\n%s",sSourceFile,nLineNum,sFuncName,sErrorDesc );
73 }
74 else
75 {
76 m_pSystem->Warning( VALIDATOR_MODULE_SCRIPTSYSTEM,VALIDATOR_ERROR,VALIDATOR_FLAG_SCRIPT,sSourceFile,
77 "$3#SCRIPT ERROR File: %s, Function: %s,\n%s",sSourceFile,sFuncName,sErrorDesc );
78 }
79
80
81 m_pSystem->GetILog()->Log("\001$6#Function %s ",sFuncName);
82 while(sErrorDesc[n]!=0)
83 {
84 if(sErrorDesc[n]=='\n')
85 {
86 m_pSystem->GetILog()->Log("\001$6# %s",sTemp.c_str());
87 sTemp="";
88 while(sErrorDesc[n]=='\n')n++;
89 }else{
90 sTemp+=sErrorDesc[n];
91 n++;
92 }
93
94 }
95 if(!sTemp.empty())
96 m_pSystem->GetILog()->LogError("\001$6# %s ",sTemp.c_str());
97
98 if (m_pSystem->GetLuaDebugger())
99 {
100 if (sSourceFile != NULL &&
101 _stricmp(sSourceFile, "__script_buffer__") != 0 &&
102 _stricmp(sSourceFile, "=C") != 0 &&
103 _stricmp(sSourceFile, "undefined") != 0 &&
104 nLineNum!=-1 &&
105 sSourceFile[0] != '\0')
106 {
107 // char szMessage[2048];
108 // sprintf(szMessage, "Lua runtime error found in '%s' line %03d function '%s' - open debugger ?",
109 // sSourceFile, nLineNum, sFuncName);
110 // if (MessageBox(NULL, szMessage, "Lua Runtime Error", MB_YESNO | MB_ICONERROR) == IDYES)
111
112 m_pSystem->ShowDebugger(sSourceFile, nLineNum, sErrorDesc);
113 }
114 }
115}
116
117void CScriptSink::OnLoadedScriptDump(const char *sScriptPath)
118{

Callers 3

ErrorHandlerMethod · 0.80
FormatAndRaiseErrorMethod · 0.80
RaiseErrorMethod · 0.80

Calls 8

GetILogMethod · 0.80
GetLuaDebuggerMethod · 0.80
WarningMethod · 0.45
LogMethod · 0.45
c_strMethod · 0.45
emptyMethod · 0.45
LogErrorMethod · 0.45
ShowDebuggerMethod · 0.45

Tested by

no test coverage detected