diff options
author | Max Horn | 2006-09-16 16:58:27 +0000 |
---|---|---|
committer | Max Horn | 2006-09-16 16:58:27 +0000 |
commit | 919092e5fcd0389b4cbd862e9e8cceab202e6741 (patch) | |
tree | 7d9c8f643191812bb1eb24f2e7cc2e67586149d5 /engines/lure | |
parent | 1add07becae0179e026a90924b419b74ffb1078f (diff) | |
download | scummvm-rg350-919092e5fcd0389b4cbd862e9e8cceab202e6741.tar.gz scummvm-rg350-919092e5fcd0389b4cbd862e9e8cceab202e6741.tar.bz2 scummvm-rg350-919092e5fcd0389b4cbd862e9e8cceab202e6741.zip |
Overhaul of the debugger code
* Moved Common::Debuggger to GUI::Debugger (mainly to satisfy linker
restrictions)
* Change the base Debugger class to *not* be a template class anymore;
instead, a thin (template based) wrapper class is used to hook up
debugger commands
* Removed duplicate Cmd_Exit and Cmd_Help methods in favor of a single
version of each in GUI::Debugger
* New Cmd_Help doesn't word wrap after 39/78 chars, but rather queries
the console to determine when to wrap
* Debugger::preEnter and postEnter aren't pure virtual anymore
svn-id: r23890
Diffstat (limited to 'engines/lure')
-rw-r--r-- | engines/lure/debugger.cpp | 58 | ||||
-rw-r--r-- | engines/lure/debugger.h | 9 |
2 files changed, 12 insertions, 55 deletions
diff --git a/engines/lure/debugger.cpp b/engines/lure/debugger.cpp index 4c67176a27..1d26556917 100644 --- a/engines/lure/debugger.cpp +++ b/engines/lure/debugger.cpp @@ -22,7 +22,6 @@ #include "common/stdafx.h" #include "common/config-manager.h" -#include "common/debugger.cpp" #include "lure/debugger.h" #include "lure/res.h" #include "lure/res_struct.h" @@ -31,19 +30,16 @@ namespace Lure { -Debugger::Debugger(): Common::Debugger<Debugger>() { - DCmd_Register("continue", &Debugger::cmd_exit); - DCmd_Register("exit", &Debugger::cmd_exit); - DCmd_Register("help", &Debugger::cmd_help); - DCmd_Register("quit", &Debugger::cmd_exit); - DCmd_Register("enter", &Debugger::cmd_enterRoom); - DCmd_Register("rooms", &Debugger::cmd_listRooms); - DCmd_Register("fields", &Debugger::cmd_listFields); - DCmd_Register("setfield", &Debugger::cmd_setField); - DCmd_Register("queryfield", &Debugger::cmd_queryField); - DCmd_Register("give", &Debugger::cmd_giveItem); - DCmd_Register("hotspots", &Debugger::cmd_hotspots); - DCmd_Register("hotspot", &Debugger::cmd_hotspot); +Debugger::Debugger(): GUI::Debugger() { + DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); + DCmd_Register("enter", WRAP_METHOD(Debugger, cmd_enterRoom)); + DCmd_Register("rooms", WRAP_METHOD(Debugger, cmd_listRooms)); + DCmd_Register("fields", WRAP_METHOD(Debugger, cmd_listFields)); + DCmd_Register("setfield", WRAP_METHOD(Debugger, cmd_setField)); + DCmd_Register("queryfield", WRAP_METHOD(Debugger, cmd_queryField)); + DCmd_Register("give", WRAP_METHOD(Debugger, cmd_giveItem)); + DCmd_Register("hotspots", WRAP_METHOD(Debugger, cmd_hotspots)); + DCmd_Register("hotspot", WRAP_METHOD(Debugger, cmd_hotspot)); } static int strToInt(const char *s) { @@ -73,14 +69,6 @@ static int strToInt(const char *s) { return result; } -void Debugger::preEnter() { - // NO IMPLEMENTATION -} - -void Debugger::postEnter() { - // NO IMPLEMENTATION -} - bool Debugger::cmd_enterRoom(int argc, const char **argv) { Resources &res = Resources::getReference(); Room &room = Room::getReference(); @@ -114,32 +102,6 @@ bool Debugger::cmd_enterRoom(int argc, const char **argv) { return true; } -bool Debugger::cmd_exit(int argc, const char **argv) { - _detach_now = true; - return false; -} - -bool Debugger::cmd_help(int argc, const char **argv) { - // console normally has 39 line width - // wrap around nicely - int width = 0, size, i; - - DebugPrintf("Commands are:\n"); - for (i = 0 ; i < _dcmd_count ; i++) { - size = strlen(_dcmds[i].name) + 1; - - if ((width + size) >= 69) { - DebugPrintf("\n"); - width = size; - } else - width += size; - - DebugPrintf("%s ", _dcmds[i].name); - } - DebugPrintf("\n"); - return true; -} - bool Debugger::cmd_listRooms(int argc, const char **argv) { RoomDataList &rooms = Resources::getReference().roomData(); RoomDataList::iterator i; diff --git a/engines/lure/debugger.h b/engines/lure/debugger.h index cfd48ec274..6080c76fb5 100644 --- a/engines/lure/debugger.h +++ b/engines/lure/debugger.h @@ -23,23 +23,18 @@ #ifndef LURE_DEBUGGER_H #define LURE_DEBUGGER_H -#include "common/debugger.h" +#include "gui/debugger.h" namespace Lure { class KyraEngine; -class Debugger : public Common::Debugger<Debugger> { +class Debugger : public GUI::Debugger { public: Debugger(); virtual ~Debugger() {} // we need this for __SYMBIAN32__ archaic gcc/UIQ protected: - virtual void preEnter(); - virtual void postEnter(); - - bool cmd_exit(int argc, const char **argv); - bool cmd_help(int argc, const char **argv); bool cmd_enterRoom(int argc, const char **argv); bool cmd_listRooms(int argc, const char **argv); bool cmd_listFields(int argc, const char **argv); |