aboutsummaryrefslogtreecommitdiff
path: root/engines/drascula/drascula.cpp
diff options
context:
space:
mode:
authorDavid Turner2011-01-28 08:07:50 +0000
committerDavid Turner2011-01-28 08:07:50 +0000
commit96174d6842fafe24afde9964e48967bc44b6badd (patch)
treede173dbe7f8e5b379d780d465c207e6d27dde6c4 /engines/drascula/drascula.cpp
parentf7e1ed37628973d5dc515fdf4e2ce27fbc3e1e26 (diff)
downloadscummvm-rg350-96174d6842fafe24afde9964e48967bc44b6badd.tar.gz
scummvm-rg350-96174d6842fafe24afde9964e48967bc44b6badd.tar.bz2
scummvm-rg350-96174d6842fafe24afde9964e48967bc44b6badd.zip
DRASCULA: Fixed Code to allow Quit/RTL Function and avoid Memory Leakage.
A memory leakage was traced down to a failure to call the engine destructor. This was due to the engine directly calling OSystem quit() i.e. _system->quit(), rather than just allowing engine::run() to return. Have removed this code and implemented the changes required to allow graceful Quit/RTL to occur. svn-id: r55583
Diffstat (limited to 'engines/drascula/drascula.cpp')
-rw-r--r--engines/drascula/drascula.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index 3ed8af3649..b931eb191c 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -156,6 +156,11 @@ DrasculaEngine::~DrasculaEngine() {
freeTexts(_textd1);
}
+bool DrasculaEngine::hasFeature(EngineFeature f) const {
+ return
+ (f == kSupportsRTL);
+}
+
Common::Error DrasculaEngine::run() {
// Initialize backend
initGraphics(320, 200, false);
@@ -198,7 +203,7 @@ Common::Error DrasculaEngine::run() {
checkCD();
- for (;;) {
+ while (!shouldQuit()) {
int i;
takeObject = 0;
_menuBar = false;
@@ -452,7 +457,7 @@ bool DrasculaEngine::runCurrentChapter() {
showCursor();
- while (1) {
+ while (!shouldQuit()) {
if (characterMoved == 0) {
stepX = STEP_X;
stepY = STEP_Y;
@@ -636,8 +641,9 @@ bool DrasculaEngine::runCurrentChapter() {
if (currentChapter != 3)
framesWithoutAction++;
-
}
+
+ return false;
}
@@ -772,11 +778,6 @@ void DrasculaEngine::updateEvents() {
case Common::EVENT_RBUTTONUP:
rightMouseButton = 1;
break;
- case Common::EVENT_QUIT:
- // TODO
- endChapter();
- _system->quit();
- break;
default:
break;
}