From 5702c16c16dcf8c4971e9c4f0232340366dc1916 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 8 May 2005 23:32:31 +0000 Subject: [PATCH] New method InSaveFile::skip() svn-id: r17979 --- common/savefile.cpp | 9 +++++++++ common/savefile.h | 12 +++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/common/savefile.cpp b/common/savefile.cpp index 2210f3d05a2..5a8158799d9 100644 --- a/common/savefile.cpp +++ b/common/savefile.cpp @@ -31,6 +31,7 @@ #include #endif + const char *SaveFileManager::getSavePath() const { #if defined(__PALM_OS__) @@ -85,6 +86,10 @@ public: uint32 write(const void *dataPtr, uint32 dataSize) { return ::fwrite(dataPtr, 1, dataSize, fh); } + + void skip(uint32 offset) { + ::fseek(fh, offset, SEEK_SET); + } }; @@ -128,6 +133,10 @@ public: _ioError = true; return ret; } + + void skip(uint32 offset) { + ::gzseek(fh, offset, SEEK_SET); + } }; #endif diff --git a/common/savefile.h b/common/savefile.h index 4b4771daa93..e8496a8a4cf 100644 --- a/common/savefile.h +++ b/common/savefile.h @@ -31,23 +31,21 @@ * A class which allows game engines to load game state data. * That typically means "save games", but also includes things like the * IQ points in Indy3. - * - * @todo Add error checking abilities. - * @todo Change base class to SeekableReadStream; or alternatively, - * add a simple 'skip()' method which would allow skipping - * a number of bytes in the savefile. */ class InSaveFile : public Common::ReadStream { public: virtual ~InSaveFile() {} + + /** + * Skip over the specified (positive) amount of bytes in the input stream. + */ + virtual void skip(uint32 offset) = 0; }; /** * A class which allows game engines to save game state data. * That typically means "save games", but also includes things like the * IQ points in Indy3. - * - * @todo Add error checking abilities. */ class OutSaveFile : public Common::WriteStream { public: