aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/detection.cpp
diff options
context:
space:
mode:
authorChristoph Mallon2011-08-06 13:08:42 +0200
committerChristoph Mallon2011-08-07 15:19:08 +0200
commit0e6751372a80716cadddd926eeb6965ae6c00a44 (patch)
treed8a7b936dfe41109738db53d4b94199f81d3ff74 /engines/sci/detection.cpp
parentf3afb32ee6039f69f3b3616989cc26fd4a0dca95 (diff)
downloadscummvm-rg350-0e6751372a80716cadddd926eeb6965ae6c00a44.tar.gz
scummvm-rg350-0e6751372a80716cadddd926eeb6965ae6c00a44.tar.bz2
scummvm-rg350-0e6751372a80716cadddd926eeb6965ae6c00a44.zip
SCI: Simplify allocation of ResourceManager.
Diffstat (limited to 'engines/sci/detection.cpp')
-rw-r--r--engines/sci/detection.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index b04c1a69f3..82f762e3db 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -285,7 +285,7 @@ static const OldNewIdTableEntry s_oldNewTable[] = {
* @param[in] gameFlags The game's flags, which are adjusted accordingly for demos
* @return The equivalent ScummVM game id
*/
-Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, ResourceManager *resMan) {
+Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, ResourceManager &resMan) {
// Convert the id to lower case, so that we match all upper/lower case variants.
sierraId.toLowercase();
@@ -301,7 +301,7 @@ Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, R
if (sierraId == "fp" || sierraId == "gk" || sierraId == "pq4")
demoThreshold = 150;
- Common::ScopedPtr<Common::List<ResourceId> > resources(resMan->listResources(kResourceTypeScript, -1));
+ Common::ScopedPtr<Common::List<ResourceId> > resources(resMan.listResources(kResourceTypeScript, -1));
if (resources->size() < demoThreshold) {
*gameFlags |= ADGF_DEMO;
@@ -337,7 +337,7 @@ Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, R
// This could either be qfg1 VGA, qfg3 or qfg4 demo (all SCI1.1),
// or qfg4 full (SCI2)
// qfg1 VGA doesn't have view 1
- if (!resMan->testResource(ResourceId(kResourceTypeView, 1)))
+ if (!resMan.testResource(ResourceId(kResourceTypeView, 1)))
return "qfg1vga";
// qfg4 full is SCI2
@@ -480,10 +480,9 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
return 0;
}
- Common::ScopedPtr<ResourceManager> resMan(new ResourceManager());
- assert(resMan);
- resMan->addAppropriateSources(fslist);
- resMan->init(true);
+ ResourceManager resMan;
+ resMan.addAppropriateSources(fslist);
+ resMan.init(true);
// TODO: Add error handling.
#ifndef ENABLE_SCI32
@@ -494,7 +493,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
}
#endif
- ViewType gameViews = resMan->getViewType();
+ ViewType gameViews = resMan.getViewType();
// Have we identified the game views? If not, stop here
// Can't be SCI (or unsupported SCI views). Pinball Creep by sierra also uses resource.map/resource.000 files
@@ -508,7 +507,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
s_fallbackDesc.platform = Common::kPlatformAmiga;
// Determine the game id
- Common::String sierraGameId = resMan->findSierraGameId();
+ Common::String sierraGameId = resMan.findSierraGameId();
// If we don't have a game id, the game is not SCI
if (sierraGameId.empty()) {
@@ -530,7 +529,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
// As far as we know, these games store the messages of each language in separate
// resources, and it's not possible to detect that easily
// Also look for "%J" which is used in japanese games
- Resource *text = resMan->findResource(ResourceId(kResourceTypeText, 0), 0);
+ Resource *text = resMan.findResource(ResourceId(kResourceTypeText, 0), 0);
uint seeker = 0;
if (text) {
while (seeker < text->size) {