aboutsummaryrefslogtreecommitdiff
path: root/engines/saga/resource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/saga/resource.cpp')
-rw-r--r--engines/saga/resource.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/engines/saga/resource.cpp b/engines/saga/resource.cpp
index cf7474adc1..646ee1d629 100644
--- a/engines/saga/resource.cpp
+++ b/engines/saga/resource.cpp
@@ -165,18 +165,21 @@ bool ResourceContext::load(SagaEngine *vm, Resource *resource) {
if ((patchDescription->fileType & _fileType) != 0) {
if (patchDescription->resourceId < _table.size()) {
resourceData = &_table[patchDescription->resourceId];
- resourceData->patchData = new PatchData(patchDescription->fileName);
- if (resourceData->patchData->_patchFile->open(patchDescription->fileName)) {
- resourceData->offset = 0;
- resourceData->size = resourceData->patchData->_patchFile->size();
- // ITE uses several patch files which are loaded and then not needed
- // anymore (as they're in memory), so close them here. IHNM uses only
- // 1 patch file, which is reused, so don't close it
- if (vm->getGameId() == GID_ITE)
- resourceData->patchData->_patchFile->close();
- } else {
- delete resourceData->patchData;
- resourceData->patchData = NULL;
+ // Check if we've already found a patch for this resource. One is enough.
+ if (!resourceData->patchData) {
+ resourceData->patchData = new PatchData(patchDescription->fileName);
+ if (resourceData->patchData->_patchFile->open(patchDescription->fileName)) {
+ resourceData->offset = 0;
+ resourceData->size = resourceData->patchData->_patchFile->size();
+ // ITE uses several patch files which are loaded and then not needed
+ // anymore (as they're in memory), so close them here. IHNM uses only
+ // 1 patch file, which is reused, so don't close it
+ if (vm->getGameId() == GID_ITE)
+ resourceData->patchData->_patchFile->close();
+ } else {
+ delete resourceData->patchData;
+ resourceData->patchData = NULL;
+ }
}
}
}