[Scummvm-cvs-logs] CVS: scummvm/scumm scumm.h,1.155,1.156 scummvm.cpp,2.56,2.57

Pawel Kolodziejski aquadran at users.sourceforge.net
Fri Mar 7 07:39:07 CET 2003


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

Modified Files:
	scumm.h scummvm.cpp 
Log Message:
implemented formating string error for each engine

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -d -r1.155 -r1.156
--- scumm.h	6 Mar 2003 21:46:23 -0000	1.155
+++ scumm.h	7 Mar 2003 15:37:58 -0000	1.156
@@ -256,9 +256,9 @@
 };
 
 class Scumm : public Engine {
-	friend void NORETURN CDECL error(const char *s, ...);	// FIXME - ugly but error() accesses g_scumm...
 	friend class ScummDebugger;
 	friend class ScummRenderer;	// FIXME - this is mostly for the destructor
+	void errorString(const char *buf_input, char *buf_output);
 public:
 	/* Put often used variables at the top.
 	 * That results in a shorter form of the opcode

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.56
retrieving revision 2.57
diff -u -d -r2.56 -r2.57
--- scummvm.cpp	7 Mar 2003 02:19:26 -0000	2.56
+++ scummvm.cpp	7 Mar 2003 15:37:59 -0000	2.57
@@ -1482,58 +1482,14 @@
 	return toSimpleDir(1, temp) * 45;
 }
 
-void NORETURN CDECL error(const char *s, ...) {
-	char buf[1024];
-#if defined( USE_WINDBG ) || defined ( _WIN32_WCE )
-	char buf2[1024];
-#endif
-
-	va_list va;
-
-	va_start(va, s);
-	vsprintf(buf, s, va);
-	va_end(va);
-
-#ifdef __GP32__ //ph0x FIXME?
-	printf("ERROR: %s\n", buf);
-#endif
-
-	if (g_scumm && g_scumm->_currentScript != 0xFF) {
-		ScriptSlot *ss = &g_scumm->vm.slot[g_scumm->_currentScript];
-		fprintf(stderr, "Error(%d:%d:0x%X): %s!\n",
-						g_scumm->_roomResource,
-						ss->number,
-						g_scumm->_scriptPointer - g_scumm->_scriptOrgPointer, buf);
-#if defined( USE_WINDBG ) || defined( _WIN32_WCE )
-		sprintf(buf2, "Error(%d:%d:0x%X): %s!\n",
-			g_scumm->_roomResource,
-			ss->number,
-			g_scumm->_scriptPointer - g_scumm->_scriptOrgPointer,
-			buf);
-#if defined ( _WIN32_WCE )	
-		drawError(buf2);
-#else
-		OutputDebugString(buf2);
-#endif
-#endif
-
+void Scumm::errorString(const char *buf1, char *buf2) {
+	if (_currentScript != 0xFF) {
+		ScriptSlot *ss = &vm.slot[_currentScript];
+		sprintf(buf2, "(%d:%d:0x%X): %s", _roomResource,
+			ss->number, _scriptPointer - _scriptOrgPointer, buf1);
 	} else {
-		fprintf(stderr, "Error: %s!\n", buf);
-#if defined( USE_WINDBG ) || defined( _WIN32_WCE )
-		sprintf(&buf[strlen(buf)], "\n");
-#if defined ( _WIN32_WCE )	
-		drawError(buf);
-#else
-		OutputDebugString(buf);
-#endif
-#endif
+		strcpy(buf2, buf1);
 	}
-
-	// Finally exit. quit() will terminate the program if g_system iss present
-	if (g_system)
-		g_system->quit();
-	
-	exit(1);
 }
 
 void Scumm::waitForTimer(int msec_delay) {





More information about the Scummvm-git-logs mailing list