aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorPaweł Kołodziejski2003-03-07 15:38:11 +0000
committerPaweł Kołodziejski2003-03-07 15:38:11 +0000
commit243c4ffbc0818d51d385052177de1b695c49d795 (patch)
tree6d4962c17da16133d0c4c9d8c3029618d07e8882 /scumm
parent1e0b221341c9a0a941286cfbcfeb3129bb223546 (diff)
downloadscummvm-rg350-243c4ffbc0818d51d385052177de1b695c49d795.tar.gz
scummvm-rg350-243c4ffbc0818d51d385052177de1b695c49d795.tar.bz2
scummvm-rg350-243c4ffbc0818d51d385052177de1b695c49d795.zip
implemented formating string error for each engine
svn-id: r6744
Diffstat (limited to 'scumm')
-rw-r--r--scumm/scumm.h2
-rw-r--r--scumm/scummvm.cpp56
2 files changed, 7 insertions, 51 deletions
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 970a67b297..bcd8966b6e 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -256,9 +256,9 @@ struct langIndexNode {
};
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
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 68cf83b074..21aeadbf05 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -1482,58 +1482,14 @@ int normalizeAngle(int angle) {
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) {