diff options
Diffstat (limited to 'engines/drascula')
-rw-r--r-- | engines/drascula/drascula.h | 5 | ||||
-rw-r--r-- | engines/drascula/resource.cpp | 8 |
2 files changed, 3 insertions, 10 deletions
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 2b6aa0f291..5ec4684723 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -30,6 +30,7 @@ #include "common/file.h" #include "common/hash-str.h" #include "common/keyboard.h" +#include "common/ptr.h" #include "common/random.h" #include "common/savefile.h" #include "common/system.h" @@ -264,15 +265,13 @@ private: }; class TextResourceParser { - Common::SeekableReadStream *_stream; - DisposeAfterUse::Flag _dispose; + Common::DisposablePtr<Common::SeekableReadStream> _stream; int _maxLen; void getLine(char *buf); public: TextResourceParser(Common::SeekableReadStream *stream, DisposeAfterUse::Flag dispose); - ~TextResourceParser(); void parseInt(int &result); void parseString(char *result); diff --git a/engines/drascula/resource.cpp b/engines/drascula/resource.cpp index 61609fb940..95a95e3487 100644 --- a/engines/drascula/resource.cpp +++ b/engines/drascula/resource.cpp @@ -42,7 +42,7 @@ Common::SeekableReadStream *ArchiveMan::open(const Common::String &filename) { } TextResourceParser::TextResourceParser(Common::SeekableReadStream *stream, DisposeAfterUse::Flag dispose) : - _stream(stream), _dispose(dispose) { + _stream(stream, dispose) { // NOTE: strangely enough, the code before this refactoring used the size of // the stream as a fixed maximum length for the parser. Using an updated @@ -50,12 +50,6 @@ TextResourceParser::TextResourceParser(Common::SeekableReadStream *stream, Dispo _maxLen = _stream->size(); } -TextResourceParser::~TextResourceParser() { - if (_dispose == DisposeAfterUse::YES) { - delete _stream; - } -} - void TextResourceParser::getLine(char *buf) { byte c; char *b; |