[Scummvm-cvs-logs] SF.net SVN: scummvm:[35087] scummvm/trunk/engines/groovie
jvprat at users.sourceforge.net
jvprat at users.sourceforge.net
Sat Nov 15 19:56:40 CET 2008
Revision: 35087
http://scummvm.svn.sourceforge.net/scummvm/?rev=35087&view=rev
Author: jvprat
Date: 2008-11-15 18:56:39 +0000 (Sat, 15 Nov 2008)
Log Message:
-----------
Simplify error debugging by implementing GroovieEngine::errorString()
Modified Paths:
--------------
scummvm/trunk/engines/groovie/groovie.cpp
scummvm/trunk/engines/groovie/groovie.h
scummvm/trunk/engines/groovie/script.cpp
scummvm/trunk/engines/groovie/script.h
Modified: scummvm/trunk/engines/groovie/groovie.cpp
===================================================================
--- scummvm/trunk/engines/groovie/groovie.cpp 2008-11-15 15:58:36 UTC (rev 35086)
+++ scummvm/trunk/engines/groovie/groovie.cpp 2008-11-15 18:56:39 UTC (rev 35087)
@@ -172,12 +172,6 @@
_debugger->onFrame();
}
- // If there's still a script error after debugging, end the execution
- if (_script.haveError()) {
- quitGame();
- break;
- }
-
// Handle input
Common::Event ev;
while (_eventMan->pollEvent(ev)) {
@@ -245,6 +239,11 @@
(f == kSupportsLoadingDuringRuntime);
}
+void GroovieEngine::errorString(const char *buf_input, char *buf_output, int buf_output_size) {
+ snprintf(buf_output, buf_output_size, "%s%s\n",
+ _script.getContext().c_str(), buf_input);
+}
+
void GroovieEngine::syncSoundSettings() {
_musicPlayer->setUserVolume(ConfMan.getInt("music_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, ConfMan.getInt("speech_volume"));
Modified: scummvm/trunk/engines/groovie/groovie.h
===================================================================
--- scummvm/trunk/engines/groovie/groovie.h 2008-11-15 15:58:36 UTC (rev 35086)
+++ scummvm/trunk/engines/groovie/groovie.h 2008-11-15 18:56:39 UTC (rev 35087)
@@ -74,6 +74,8 @@
Common::Error init();
Common::Error go();
+ void errorString(const char *buf_input, char *buf_output, int buf_output_size);
+
public:
bool hasFeature(EngineFeature f) const;
Modified: scummvm/trunk/engines/groovie/script.cpp
===================================================================
--- scummvm/trunk/engines/groovie/script.cpp 2008-11-15 15:58:36 UTC (rev 35086)
+++ scummvm/trunk/engines/groovie/script.cpp 2008-11-15 18:56:39 UTC (rev 35087)
@@ -60,7 +60,7 @@
Script::Script(GroovieEngine *vm) :
_code(NULL), _savedCode(NULL), _stacktop(0),
- _debugger(NULL), _error(false), _vm(vm),
+ _debugger(NULL), _vm(vm),
_videoFile(NULL), _videoRef(0), _font(NULL) {
// Initialize the random source
_vm->_system->getEventManager()->registerRandomSource(_random, "GroovieScripts");
@@ -145,9 +145,6 @@
}
void Script::step() {
- // Reset the error status
- _error = false;
-
// Prepare the base debug string
char debugstring[10];
sprintf(debugstring, "@0x%04X: ", _currentInstruction);
@@ -182,24 +179,10 @@
_eventKbdChar = c;
}
-bool Script::haveError() {
- return _error;
+Common::String &Script::getContext() {
+ return _debugString;
}
-void Script::error(const char *msg) {
- // Prepend the debugging info to the error
- Common::String msg2 = _debugString + msg;
-
- // Print the error message
- ::error("ERROR: %s\n", msg2.c_str());
-
- // Show it in the debugger
- _debugger->attach(msg2.c_str());
-
- // Set the error state
- _error = true;
-}
-
uint8 Script::readScript8bits() {
uint8 data = _code[_currentInstruction];
_currentInstruction++;
@@ -946,7 +929,7 @@
void Script::o_endscript() {
debugScript(1, true, "END OF SCRIPT");
- _error = true;
+ _vm->quitGame();
}
void Script::o_sethotspottop() {
Modified: scummvm/trunk/engines/groovie/script.h
===================================================================
--- scummvm/trunk/engines/groovie/script.h 2008-11-15 15:58:36 UTC (rev 35086)
+++ scummvm/trunk/engines/groovie/script.h 2008-11-15 18:56:39 UTC (rev 35087)
@@ -51,7 +51,7 @@
void setMouseClick();
void setKbdChar(uint8 c);
- bool haveError();
+ Common::String &getContext();
private:
GroovieEngine *_vm;
@@ -104,8 +104,6 @@
// Debugging
Debugger *_debugger;
Common::String _debugString;
- void error(const char *msg);
- bool _error;
// Helper functions
uint8 readScript8bits();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list