[Scummvm-cvs-logs] CVS: scummvm/scumm debugger.cpp,1.12,1.13 debugger.h,1.9,1.10

Jonathan Gray khalek at users.sourceforge.net
Sat Jan 18 08:05:02 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv29662

Modified Files:
	debugger.cpp debugger.h 
Log Message:
add help command to debugger to list commands and vars, we should probably have a help string for each but this is much better than reading the code for now :)

Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- debugger.cpp	18 Jan 2003 15:54:38 -0000	1.12
+++ debugger.cpp	18 Jan 2003 16:04:27 -0000	1.13
@@ -66,6 +66,7 @@
 		DCmd_Register("savegame", &ScummDebugger::Cmd_SaveGame);
 
 		DCmd_Register("level", &ScummDebugger::Cmd_DebugLevel);
+		DCmd_Register("help", &ScummDebugger::Cmd_Help);
 	}
 }
 
@@ -359,7 +360,46 @@
 	return true;
 }
 
+bool ScummDebugger::Cmd_Help(int argc, const char **argv) {
+	// console normally has 39 line width
+	// wrap around nicely
+	int width = 0, size;
+	
+	Debug_Printf("Commands are:\n");
+	for (int i=0 ; i < _dcmd_count ; i++) {
+		size = strlen(_dcmds[i].name) + 1;
+				
+		if ((width + size) >= 39) {
+			Debug_Printf("\n");
+			width = size;
+		} else
+			width += size;
+
+		Debug_Printf("%s ", _dcmds[i].name);
+	}
+
+	width = 0;
+	
+	Debug_Printf("\n\nVariables are:\n");
+	for (int i=0 ; i < _dvar_count ; i++) {
+		size = strlen(_dvars[i].name) + 1;
+				
+		if ((width + size) >= 39) {
+			Debug_Printf("\n");
+			width = size;
+		} else
+			width += size;
+
+		Debug_Printf("%s ", _dvars[i].name);
+	}
+
+	Debug_Printf("\n");
+	
+	return true;
+}
+
 bool ScummDebugger::Cmd_DebugLevel(int argc, const char **argv) {
+	
 	if (argc == 1) {
 		if (_s->_debugMode == false)
 			Debug_Printf("Debugging is not enabled at this time\n");

Index: debugger.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- debugger.h	18 Jan 2003 14:51:06 -0000	1.9
+++ debugger.h	18 Jan 2003 16:04:28 -0000	1.10
@@ -78,6 +78,7 @@
 	bool Cmd_Actor(int argc, const char **argv);
 	
 	bool Cmd_DebugLevel(int argc, const char **argv);
+	bool Cmd_Help(int argc, const char **argv);
 	
 	void printBox(int box);
 





More information about the Scummvm-git-logs mailing list