MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Error

Method Error

code/rd-vanilla/G2_API.cpp:215–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213 return ret;
214 }
215 int Error(const char *m,int kind,const char *, int line)
216 {
217 char mess[1000];
218 assert(m);
219 std::string full=mName;
220 if (kind==2)
221 {
222 full+=":NOTE: ";
223 }
224 else if (kind==1)
225 {
226// assert(!"G2API Warning");
227 full+=":WARNING: ";
228 }
229 else
230 {
231// assert(!"G2API Error");
232 full+=":ERROR : ";
233 }
234 full+=m;
235 sprintf(mess," [line %d]",line);
236 full+=mess;
237
238 // assert(0);
239 int ret=0; //place a breakpoint here
240 std::map<std::string,int>::iterator f=mErrors.find(full);
241 if (f==mErrors.end())
242 {
243 ret++; // or a breakpoint here for the first occurance
244 mErrors.insert(std::make_pair(full,0));
245 f=mErrors.find(full);
246 }
247 assert(f!=mErrors.end());
248 (*f).second++;
249 if ((*f).second==1000)
250 {
251 ret*=-1; // breakpoint to find a specific occurance of an error
252 }
253 if ((*f).second<=MAX_ERROR_PRINTS&&kind<2)
254 {
255 Com_Printf("%s (hit # %d)\n",full.c_str(),(*f).second);
256 if (1)
257 {
258 sprintf(mess,"%s (hit # %d)\n",full.c_str(),(*f).second);
259 Com_DPrintf(mess);
260 }
261 }
262 return ret;
263 }
264};
265
266#include "assert.h"

Callers 7

G_ErrorFunction · 0.45
Com_ErrorFunction · 0.45
Com_ErrorFunction · 0.45
R_LoadSubmodelsFunction · 0.45
ScanAndLoadShaderFilesFunction · 0.45
UI_InitFunction · 0.45

Calls 6

Com_PrintfFunction · 0.70
Com_DPrintfFunction · 0.70
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected