diff options
author | Nicola Mettifogo | 2008-10-26 09:15:57 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2008-10-26 09:15:57 +0000 |
commit | 064b816b08cb27a5c8f4899d447c4b81597df968 (patch) | |
tree | 4d4641a515cb67830e8d0f532ffe8fdff79fa39b | |
parent | e3312288d7e58235cb81acc2469519c470203c0d (diff) | |
download | scummvm-rg350-064b816b08cb27a5c8f4899d447c4b81597df968.tar.gz scummvm-rg350-064b816b08cb27a5c8f4899d447c4b81597df968.tar.bz2 scummvm-rg350-064b816b08cb27a5c8f4899d447c4b81597df968.zip |
Cleaned up disk code after recent updates to Common::SearchSet.
svn-id: r34848
-rw-r--r-- | engines/parallaction/disk.h | 26 | ||||
-rw-r--r-- | engines/parallaction/disk_br.cpp | 41 |
2 files changed, 29 insertions, 38 deletions
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index 0df9ad7b89..11080f4ddd 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -205,13 +205,24 @@ public: class Disk_br : public Disk { + Common::SeekableReadStream *openFile_internal(bool errorOnNotFound, const Common::String &name, const Common::String &ext); + protected: + Parallaction *_vm; Common::SearchSet _sset; + Common::FSDirectory *_baseDir; + + uint16 _language; + Common::String _currentPart; Common::SeekableReadStream *tryOpenFile(const Common::String &name, const Common::String &ext = Common::String::emptyString); Common::SeekableReadStream *openFile(const Common::String &name, const Common::String &ext = Common::String::emptyString); void errorFileNotFound(const Common::String &filename); + +public: + Disk_br(Parallaction *vm); + virtual ~Disk_br(); }; // for the moment DosDisk_br subclasses Disk. When Amiga support will @@ -220,15 +231,6 @@ protected: class DosDisk_br : public Disk_br { protected: - uint16 _language; - - Parallaction *_vm; - - Common::SharedPtr<Common::FSDirectory> _baseDir; - Common::String _currentPart; - - -protected: Font *createFont(const char *name, Common::ReadStream &stream); Sprites* createSprites(Common::ReadStream &stream); void loadBitmap(Common::SeekableReadStream &stream, Graphics::Surface &surf, byte *palette); @@ -236,7 +238,6 @@ protected: public: DosDisk_br(Parallaction *vm); - virtual ~DosDisk_br(); virtual void init(); @@ -263,7 +264,6 @@ class DosDemoDisk_br : public DosDisk_br { public: DosDemoDisk_br(Parallaction *vm); - virtual ~DosDemoDisk_br(); virtual void init(); @@ -273,9 +273,6 @@ public: class AmigaDisk_br : public DosDisk_br { protected: - Common::SharedPtr<Common::FSDirectory> _baseDir; - Common::String _currentPart; - BackgroundInfo _backgroundTemp; Sprites* createSprites(Common::ReadStream &stream); @@ -283,7 +280,6 @@ protected: void loadBackground(BackgroundInfo& info, Common::SeekableReadStream &stream); public: AmigaDisk_br(Parallaction *vm); - virtual ~AmigaDisk_br(); virtual void init(); diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index 20b1370796..cf5aec5285 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -140,23 +140,18 @@ void DosDisk_br::setLanguage(uint16 language) { _language = language; } -DosDisk_br::DosDisk_br(Parallaction* vm) : _vm(vm) { +DosDisk_br::DosDisk_br(Parallaction* vm) : Disk_br(vm) { } void DosDisk_br::init() { // TODO: clarify whether the engine or OSystem should add the base game directory to the search manager. // Right now, I am keeping an internal search set to do the job. - _baseDir = Common::SharedPtr<Common::FSDirectory>(new Common::FSDirectory(ConfMan.get("path"))); - // FIXME: We use this gross hack here since we switched SearchSet to accept plain pointers - _sset.add("base", _baseDir.get(), 5, false); + _baseDir = new Common::FSDirectory(ConfMan.get("path")); + _sset.add("base", _baseDir, 5, false); } -DosDisk_br::~DosDisk_br() { - _sset.clear(); -} - GfxObj* DosDisk_br::loadTalk(const char *name) { debugC(5, kDebugDisk, "DosDisk_br::loadTalk(%s)", name); @@ -391,16 +386,11 @@ DosDemoDisk_br::DosDemoDisk_br(Parallaction *vm) : DosDisk_br(vm) { void DosDemoDisk_br::init() { // TODO: clarify whether the engine or OSystem should add the base game directory to the search manager. // Right now, I am keeping an internal search set to do the job. - _baseDir = Common::SharedPtr<Common::FSDirectory>(new Common::FSDirectory(ConfMan.get("path"), 2)); - // FIXME: We use this gross hack here since we switched SearchSet to accept plain pointers - _sset.add("base", _baseDir.get(), 5, false); + _baseDir = new Common::FSDirectory(ConfMan.get("path"), 2); + _sset.add("base", _baseDir, 5, false); } -DosDemoDisk_br::~DosDemoDisk_br() { - -} - Common::String DosDemoDisk_br::selectArchive(const Common::String& name) { debugC(5, kDebugDisk, "DosDemoDisk_br::selectArchive"); Common::String oldPath = _currentPart; @@ -413,9 +403,8 @@ AmigaDisk_br::AmigaDisk_br(Parallaction *vm) : DosDisk_br(vm) { } void AmigaDisk_br::init() { - _baseDir = Common::SharedPtr<Common::FSDirectory>(new Common::FSDirectory(ConfMan.get("path"))); - // FIXME: We use this gross hack here since we switched SearchSet to accept plain pointers - _sset.add("base", _baseDir.get(), 5, false); + _baseDir = new Common::FSDirectory(ConfMan.get("path")); + _sset.add("base", _baseDir, 5, false); const Common::String subDirNames[3] = { "fonts", "backs", "common" }; const Common::String subDirPrefixes[3] = { "fonts", "backs", Common::String::emptyString }; @@ -423,11 +412,6 @@ void AmigaDisk_br::init() { _sset.add(subDirNames[i], _baseDir->getSubDirectory(subDirPrefixes[i], subDirNames[i], 2), 6); } -AmigaDisk_br::~AmigaDisk_br() { - _sset.clear(); -} - - void AmigaDisk_br::loadBackground(BackgroundInfo& info, Common::SeekableReadStream &stream) { byte *pal; @@ -629,4 +613,15 @@ Common::String AmigaDisk_br::selectArchive(const Common::String& name) { } +Disk_br::Disk_br(Parallaction *vm) : _vm(vm), _baseDir(0) { + +} + +Disk_br::~Disk_br() { + delete _baseDir; + _sset.clear(); +} + + + } // namespace Parallaction |