New method InSaveFile::skip()

svn-id: r17979
This commit is contained in:
Max Horn 2005-05-08 23:32:31 +00:00
parent 9b8d88a113
commit 5702c16c16
2 changed files with 14 additions and 7 deletions

View File

@ -31,6 +31,7 @@
#include <zlib.h> #include <zlib.h>
#endif #endif
const char *SaveFileManager::getSavePath() const { const char *SaveFileManager::getSavePath() const {
#if defined(__PALM_OS__) #if defined(__PALM_OS__)
@ -85,6 +86,10 @@ public:
uint32 write(const void *dataPtr, uint32 dataSize) { uint32 write(const void *dataPtr, uint32 dataSize) {
return ::fwrite(dataPtr, 1, dataSize, fh); return ::fwrite(dataPtr, 1, dataSize, fh);
} }
void skip(uint32 offset) {
::fseek(fh, offset, SEEK_SET);
}
}; };
@ -128,6 +133,10 @@ public:
_ioError = true; _ioError = true;
return ret; return ret;
} }
void skip(uint32 offset) {
::gzseek(fh, offset, SEEK_SET);
}
}; };
#endif #endif

View File

@ -31,23 +31,21 @@
* A class which allows game engines to load game state data. * A class which allows game engines to load game state data.
* That typically means "save games", but also includes things like the * That typically means "save games", but also includes things like the
* IQ points in Indy3. * 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 { class InSaveFile : public Common::ReadStream {
public: public:
virtual ~InSaveFile() {} 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. * A class which allows game engines to save game state data.
* That typically means "save games", but also includes things like the * That typically means "save games", but also includes things like the
* IQ points in Indy3. * IQ points in Indy3.
*
* @todo Add error checking abilities.
*/ */
class OutSaveFile : public Common::WriteStream { class OutSaveFile : public Common::WriteStream {
public: public: