aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-12-16 22:46:17 +0000
committerMax Horn2002-12-16 22:46:17 +0000
commite6e8468a31d04d0e5136623e5f7463c1579e0981 (patch)
tree7e2a4d746d0bd0717127ffbaaa8180bd859c9b0a
parent99a8e393169182992e4fd0758c6064fbb731beec (diff)
downloadscummvm-rg350-e6e8468a31d04d0e5136623e5f7463c1579e0981.tar.gz
scummvm-rg350-e6e8468a31d04d0e5136623e5f7463c1579e0981.tar.bz2
scummvm-rg350-e6e8468a31d04d0e5136623e5f7463c1579e0981.zip
indentation fixes; added a constructor (after all the debugger is a global var which is not allocated by new, hence we can't relay on memory being zeroed). And no I am not actually gonna use force against Endy, I just was frustrated :-)
svn-id: r6005
-rw-r--r--scumm/debugger.cpp17
-rw-r--r--scumm/debugger.h18
2 files changed, 26 insertions, 9 deletions
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp
index 6c5b0d2e96..bbb927b616 100644
--- a/scumm/debugger.cpp
+++ b/scumm/debugger.cpp
@@ -17,6 +17,15 @@
#define Debug_Printf printf
#endif
+ScummDebugger::ScummDebugger()
+{
+ _s = 0;
+ _frame_countdown = 0;
+ _dvar_count = 0;
+ _dcmd_count = 0;
+ _detach_now = false;
+}
+
// Initialisation Functions
void ScummDebugger::attach(Scumm *s)
{
@@ -77,7 +86,7 @@ void ScummDebugger::on_frame() {
_s->_sound->pauseSounds(old_soundsPaused); // Resume previous sound state
if (_detach_now) // Detach if we're finished with the debugger
- detach();
+ detach();
}
}
@@ -95,7 +104,8 @@ bool ScummDebugger::debuggerInputCallback(ConsoleDialog *console, const char *in
// Now the fun stuff:
// Command/Variable registration functions
-void ScummDebugger::DVar_Register(char *varname, void *pointer, int type, int optional) {
+void ScummDebugger::DVar_Register(const char *varname, void *pointer, int type, int optional) {
+ assert(_dvar_count < (int)sizeof(_dvars));
strcpy(_dvars[_dvar_count].name, varname);
_dvars[_dvar_count].type = type;
_dvars[_dvar_count].variable = pointer;
@@ -104,7 +114,8 @@ void ScummDebugger::DVar_Register(char *varname, void *pointer, int type, int op
_dvar_count++;
}
-void ScummDebugger::DCmd_Register(char *cmdname, DebugProc pointer) {
+void ScummDebugger::DCmd_Register(const char *cmdname, DebugProc pointer) {
+ assert(_dcmd_count < (int)sizeof(_dcmds));
strcpy(_dcmds[_dcmd_count].name, cmdname);
_dcmds[_dcmd_count].function = pointer;
diff --git a/scumm/debugger.h b/scumm/debugger.h
index afae964c11..3c80fe4699 100644
--- a/scumm/debugger.h
+++ b/scumm/debugger.h
@@ -20,8 +20,12 @@
#ifndef DEBUG_H
#define DEBUG_H
+
#define USE_CONSOLE
+
class Scumm;
+class ScummDebugger;
+
typedef bool (ScummDebugger::*DebugProc)();
enum {
@@ -44,21 +48,23 @@ struct DCmd {
class ScummDebugger {
public:
+ ScummDebugger();
+
void on_frame();
void attach(Scumm *s);
protected:
Scumm *_s;
- int _frame_countdown, _dvar_count, _dcmd_count;
- DVar _dvars[255];
- DCmd _dcmds[255];
+ int _frame_countdown, _dvar_count, _dcmd_count;
+ DVar _dvars[256];
+ DCmd _dcmds[256];
bool _detach_now;
void enter();
- void detach();
+ void detach();
- void DVar_Register(char *varname, void *pointer, int type, int optional);
- void DCmd_Register(char *cmdname, DebugProc pointer);
+ void DVar_Register(const char *varname, void *pointer, int type, int optional);
+ void DCmd_Register(const char *cmdname, DebugProc pointer);
bool RunCommand(char *input);
// Commands