aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2011-06-16 15:13:16 +0200
committerMax Horn2011-06-17 10:38:16 +0200
commit520b18d2ac183c4d671b9bd59935bec2aea0d4c6 (patch)
tree69819d7a493eb140959a741ebd1778d82ea45e5e
parentabf26b0614581f2725f65621d0403255884a9cc2 (diff)
downloadscummvm-rg350-520b18d2ac183c4d671b9bd59935bec2aea0d4c6.tar.gz
scummvm-rg350-520b18d2ac183c4d671b9bd59935bec2aea0d4c6.tar.bz2
scummvm-rg350-520b18d2ac183c4d671b9bd59935bec2aea0d4c6.zip
SCI: Use ScopedPtr to handle temporary resMan instance on the heap
-rw-r--r--engines/sci/detection.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 7bc9699e9b..10c27b2331 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -23,6 +23,7 @@
#include "engines/advancedDetector.h"
#include "base/plugins.h"
#include "common/file.h"
+#include "common/ptr.h"
#include "common/savefile.h"
#include "common/system.h"
#include "graphics/thumbnail.h"
@@ -485,7 +486,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
return 0;
}
- ResourceManager *resMan = new ResourceManager();
+ Common::ScopedPtr<ResourceManager> resMan(new ResourceManager());
assert(resMan);
resMan->addAppropriateSources(fslist);
resMan->init(true);
@@ -495,7 +496,6 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
// Is SCI32 compiled in? If not, and this is a SCI32 game,
// stop here
if (getSciVersion() >= SCI_VERSION_2) {
- delete resMan;
return (const ADGameDescription *)&s_fallbackDesc;
}
#endif
@@ -506,7 +506,6 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
// Can't be SCI (or unsupported SCI views). Pinball Creep by sierra also uses resource.map/resource.000 files
// but doesnt share sci format at all, if we dont return 0 here we will detect this game as SCI
if (gameViews == kViewUnknown) {
- delete resMan;
return 0;
}
@@ -519,7 +518,6 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
// If we don't have a game id, the game is not SCI
if (sierraGameId.empty()) {
- delete resMan;
return 0;
}
@@ -575,8 +573,6 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
if (s_fallbackDesc.flags & ADGF_DEMO)
s_fallbackDesc.extra = (gameId.hasSuffix("sci")) ? "SCI/Demo" : "Demo";
- delete resMan;
-
return (const ADGameDescription *)&s_fallbackDesc;
}