1 // ------------------------------------------------------------------
3 // ------------------------------------------------------------------
4 // This implements a tracer for debugging the game
5 // Basically, it records events on disk, so we can trace where the hell
6 // the bastard is crashing!
7 // ------------------------------------------------------------------
8 // Developed By Kronoman - Copyright (c) 2004
9 // In loving memory of my father
10 // ------------------------------------------------------------------
14 bool CMyTracer::DISABLE_TRACE
= false;
17 CMyTracer::CMyTracer()
22 CMyTracer::~CMyTracer()
27 void CMyTracer::add(string txt
)
29 if (DISABLE_TRACE
) return;
32 fp
= fopen(TRACE_SAVE_IN_FILE
, "a");
33 if (fp
== NULL
) return; // crap! can't save
35 fprintf(fp
,"%s\n", txt
.c_str());
39 void CMyTracer::add(const char *msg
, ...)
41 if (DISABLE_TRACE
) return;
45 /* parse the variable parameters */
48 vsprintf(buf
, msg
, ap
); // this is ANSI, POSIX, I hope... :O
51 this->add(string(buf
));
54 void CMyTracer::reset()
56 if (DISABLE_TRACE
) return;
59 fp
= fopen(TRACE_SAVE_IN_FILE
, "w");
60 if (fp
== NULL
) return;