diff options
author | Johannes Schickel | 2008-03-28 06:03:59 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-03-28 06:03:59 +0000 |
commit | e29b4bb0cd4b4c71a3a53646b0eb728e7f156063 (patch) | |
tree | 5322a4a5791066416b84d72bc5c26a8dc01c8732 /engines/kyra | |
parent | dc1a7004e949a5c1b8936f73387905e0f96f7e5c (diff) | |
download | scummvm-rg350-e29b4bb0cd4b4c71a3a53646b0eb728e7f156063.tar.gz scummvm-rg350-e29b4bb0cd4b4c71a3a53646b0eb728e7f156063.tar.bz2 scummvm-rg350-e29b4bb0cd4b4c71a3a53646b0eb728e7f156063.zip |
Committed shared pointer implementation of patch #1895703 "COMMON: Managed List".
Unlike the patch on the tracker this commit includes documentation for SharedPtr.
svn-id: r31287
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/module.mk | 1 | ||||
-rw-r--r-- | engines/kyra/resource.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/resource.h | 9 |
3 files changed, 11 insertions, 9 deletions
diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk index 866cb61280..ce7b5ccd0a 100644 --- a/engines/kyra/module.mk +++ b/engines/kyra/module.mk @@ -5,6 +5,7 @@ MODULE_OBJS := \ animator_v2.o \ debugger.o \ detection.o \ + gui.o \ gui_v1.o \ gui_v2.o \ items_v1.o \ diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 0f7da48495..3cf8336e7f 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -29,7 +29,6 @@ #include "common/file.h" #include "common/fs.h" #include "common/func.h" -#include "common/algorithm.h" #include "gui/message.h" @@ -43,8 +42,6 @@ Resource::Resource(KyraEngine *vm) : _loaders(), _map(), _vm(vm) { Resource::~Resource() { unloadAllPakFiles(); - for (LoaderIterator i = _loaders.begin(); i != _loaders.end(); ++i) - delete (*i); _loaders.clear(); } @@ -666,17 +663,18 @@ Common::SeekableReadStream *ResLoaderIns::loadFileFromArchive(const Common::Stri } void Resource::initializeLoaders() { - _loaders.push_back(new ResLoaderPak()); - _loaders.push_back(new ResLoaderIns()); + _loaders.push_back(LoaderList::value_type(new ResLoaderPak())); + _loaders.push_back(LoaderList::value_type(new ResLoaderIns())); } const ResArchiveLoader *Resource::getLoader(ResFileEntry::kType type) const { for (CLoaderIterator i = _loaders.begin(); i != _loaders.end(); ++i) { if ((*i)->getType() == type) - return *i; + return (*i).get(); } return 0; } } // end of namespace Kyra + diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h index ace8c413f4..2c0d7b9c79 100644 --- a/engines/kyra/resource.h +++ b/engines/kyra/resource.h @@ -34,6 +34,7 @@ #include "common/hash-str.h" #include "common/hashmap.h" #include "common/stream.h" +#include "common/ptr.h" #include "kyra/kyra.h" @@ -113,9 +114,10 @@ protected: void initializeLoaders(); const ResArchiveLoader *getLoader(ResFileEntry::kType type) const; - typedef Common::List<ResArchiveLoader*>::iterator LoaderIterator; - typedef Common::List<ResArchiveLoader*>::const_iterator CLoaderIterator; - Common::List<ResArchiveLoader*> _loaders; + typedef Common::List<Common::SharedPtr<ResArchiveLoader> > LoaderList; + typedef LoaderList::iterator LoaderIterator; + typedef LoaderList::const_iterator CLoaderIterator; + LoaderList _loaders; ResFileMap _map; KyraEngine *_vm; @@ -334,3 +336,4 @@ private: #endif + |