aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2011-05-13 14:39:34 +0200
committerMax Horn2011-05-13 14:39:34 +0200
commit749a1beb350d33fb1e48494134bdca70bc8c2ad8 (patch)
tree64225eead7a72b3753db2112740c3c9f6d1fe6de /engines
parent4108f09543afd543fbfab86cc5f3e7f4850150a2 (diff)
downloadscummvm-rg350-749a1beb350d33fb1e48494134bdca70bc8c2ad8.tar.gz
scummvm-rg350-749a1beb350d33fb1e48494134bdca70bc8c2ad8.tar.bz2
scummvm-rg350-749a1beb350d33fb1e48494134bdca70bc8c2ad8.zip
SCUMM: Remove useless allocateArrays call, and make sure all resources are properly killed upon restart
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/resource.cpp4
-rw-r--r--engines/scumm/scumm.cpp7
2 files changed, 4 insertions, 7 deletions
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp
index 8eb41ecdfb..10f28516b3 100644
--- a/engines/scumm/resource.cpp
+++ b/engines/scumm/resource.cpp
@@ -535,6 +535,10 @@ void ResourceManager::allocResTypeData(ResType type, uint32 tag, int num, ResTyp
_types[type]._mode = mode;
_types[type]._tag = tag;
+
+ // If there was data in there, let's clear it out completely. This is important
+ // in case we are restarting the game.
+ _types[type]._resources.clear();
_types[type]._resources.resize(num);
/*
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 3ebacee6a5..6e958462b2 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -2447,13 +2447,6 @@ void ScummEngine::restart() {
for (i = 1; i < _numGlobalObjects; i++)
clearOwnerOf(i);
- // Reallocate arrays
- // FIXME: This should already be called by readIndexFile.
- // FIXME: regardless of that, allocateArrays and allocResTypeData leaks
- // heavily, which should be fixed.
- allocateArrays();
-
- // Reread index (reset objectstate etc)
readIndexFile();
// Reinit scumm variables