aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBertrand Augereau2011-12-04 17:46:36 +0100
committerBertrand Augereau2011-12-04 17:46:36 +0100
commit4d83a53e52be33845ca61fa10258fe75692c59e7 (patch)
treea3b1e176bc21f9cb77229f9e05a034e2bfd38747 /engines
parent1789ca436e8ae4cfdd4e6e7baee3c8e84928f5bd (diff)
downloadscummvm-rg350-4d83a53e52be33845ca61fa10258fe75692c59e7.tar.gz
scummvm-rg350-4d83a53e52be33845ca61fa10258fe75692c59e7.tar.bz2
scummvm-rg350-4d83a53e52be33845ca61fa10258fe75692c59e7.zip
DREAMWEB: Cleaner finalization of the engine
All the segments are destroyed with the VM but it won't be the case when individual buffers will be malloc'ed.
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/stubs.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index a498c905d2..b50710c10c 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -530,7 +530,7 @@ void DreamGenContext::dreamweb() {
setMode();
decide();
if (quitRequested())
- return; // exit game
+ goto done;
if (data.byte(kGetback) == 4)
startNewGame = false; // savegame has been loaded
@@ -544,14 +544,14 @@ void DreamGenContext::dreamweb() {
titles();
if (quitRequested())
- return; // exit game
+ goto done;
// "credits"
clearPalette();
realCredits();
if (quitRequested())
- return; // exit game
+ goto done;
clearChanges();
setMode();
@@ -579,12 +579,12 @@ void DreamGenContext::dreamweb() {
while (true) {
if (quitRequested())
- return; // exit game
+ goto done;
screenUpdate();
if (quitRequested())
- return; // exit game
+ goto done;
if (data.byte(kWongame) != 0) {
// "endofgame"
@@ -593,7 +593,7 @@ void DreamGenContext::dreamweb() {
hangOn(200);
endGame();
quickQuit2();
- return;
+ goto done;
}
if (data.byte(kMandead) == 1 || data.byte(kMandead) == 2)
@@ -633,6 +633,10 @@ void DreamGenContext::dreamweb() {
hangOn(100);
}
+done: // The engine will need some cleaner finalization, let's put it here for now
+ getRidOfAll();
+ deallocateMem(data.word(kIcons1));
+ deallocateMem(data.word(kIcons2));
}
bool DreamGenContext::quitRequested() {