SLUDGE: Add debug channel for fatal msg

This commit is contained in:
yinsimei 2017-06-03 19:50:02 +02:00 committed by Eugene Sandulenko
parent 733e758fcb
commit 00b64e01d4
4 changed files with 7 additions and 6 deletions

View File

@ -35,6 +35,7 @@
#include "stringy.h"
#include "errors.h"
#include "graphics.h"
#include "sludge.h"
namespace Sludge {
@ -133,7 +134,7 @@ void setFatalInfo(const char *userFunc, const char *BIF) {
if (fatalInfo)
sprintf(fatalInfo, "Currently in this sub: %s\nCalling: %s", userFunc,
BIF);
debug("%s", fatalInfo);
debug(kSludgeDebugFatal, "%s", fatalInfo);
}
void setResourceForFatal(int n) {

View File

@ -40,7 +40,7 @@ SludgeEngine::SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc)
_rnd = new Common::RandomSource("sludge");
// Add debug channels
DebugMan.addDebugChannel(kSludgeDebugScript, "Script", "Script debug level");
DebugMan.addDebugChannel(kSludgeDebugFatal, "Script", "Script debug level");
DebugMan.addDebugChannel(kSludgeDebugDataLoad, "Data Load", "Data loading debug level");
DebugMan.addDebugChannel(kSludgeDebugStackMachine, "Stack Machine", "Stack Machine debug level");
DebugMan.addDebugChannel(kSludgeDebugBuiltin, "Built-in", "Built-in debug level");

View File

@ -37,7 +37,7 @@ struct SludgeGameDescription;
// debug channels
enum {
kSludgeDebugScript = 1 << 0,
kSludgeDebugFatal = 1 << 0,
kSludgeDebugDataLoad = 1 << 1,
kSludgeDebugStackMachine = 1 << 2,
kSludgeDebugBuiltin = 1 << 3,

View File

@ -172,9 +172,9 @@ Common::File *openAndVerify(char *filename, char extra1, char extra2,
}
char c;
c = fp->readByte();
debug("%c", c);
debug(kSludgeDebugDataLoad, "%c", c);
while ((c = fp->readByte())) {
debug("%c", c);
debug(kSludgeDebugDataLoad, "%c", c);
}
int majVersion = fp->readByte();
@ -519,7 +519,7 @@ bool initSludge(char *filename) {
}
numGlobals = fp->readUint16BE();
debug("numGlobals : %i", numGlobals);
debug(kSludgeDebugDataLoad, "numGlobals : %i", numGlobals);
globalVars = new variable[numGlobals];
if (!checkNew(globalVars))