mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
PINK: inline one line archive functions; remove stream getters
This commit is contained in:
committed by
Eugene Sandulenko
parent
078557a1ad
commit
ccd0ec7ffb
@@ -317,30 +317,6 @@ Common::String Archive::readString() {
|
||||
return Common::String(buffer, len);
|
||||
}
|
||||
|
||||
byte Archive::readByte() {
|
||||
return _readStream->readByte();
|
||||
}
|
||||
|
||||
uint32 Archive::readDWORD() {
|
||||
return _readStream->readUint32LE();
|
||||
}
|
||||
|
||||
uint16 Archive::readWORD() {
|
||||
return _readStream->readUint16LE();
|
||||
}
|
||||
|
||||
void Archive::writeByte(byte val) {
|
||||
return _writeStream->writeByte(val);
|
||||
}
|
||||
|
||||
void Archive::writeDWORD(uint32 val) {
|
||||
_writeStream->writeUint32LE(val);
|
||||
}
|
||||
|
||||
void Archive::writeWORD(uint16 val) {
|
||||
_writeStream->writeUint16LE(val);
|
||||
}
|
||||
|
||||
void Archive::writeString(const Common::String &string) {
|
||||
_writeStream->writeByte(string.size());
|
||||
_writeStream->write(string.c_str(), string.size());
|
||||
|
||||
+10
-10
@@ -42,22 +42,22 @@ public:
|
||||
Archive(Common::SeekableReadStream *stream);
|
||||
Archive(Common::WriteStream *stream);
|
||||
|
||||
Common::SeekableReadStream *getReadStream() { return _readStream; }
|
||||
Common::WriteStream *getWriteStream() { return _writeStream; };
|
||||
|
||||
void mapObject(Object *obj);
|
||||
|
||||
int readCount();
|
||||
byte readByte();
|
||||
uint32 readDWORD();
|
||||
uint16 readWORD();
|
||||
byte readByte() { return _readStream->readByte(); }
|
||||
uint32 readDWORD() { return _readStream->readUint32LE(); }
|
||||
uint16 readWORD() { return _readStream->readUint16LE(); }
|
||||
|
||||
void writeByte(byte val);
|
||||
void writeDWORD(uint32 val);
|
||||
void writeWORD(uint16 val);
|
||||
Common::String readString();
|
||||
|
||||
Object *readObject();
|
||||
Common::String readString();
|
||||
|
||||
void write(const void *dataPtr, uint32 dataSize) { _writeStream->write(dataPtr, dataSize); }
|
||||
void writeByte(byte val) { _writeStream->writeByte(val); }
|
||||
void writeDWORD(uint32 val) { _writeStream->writeUint32LE(val); }
|
||||
void writeWORD(uint16 val) { _writeStream->writeUint16LE(val); }
|
||||
|
||||
void writeString(const Common::String &string);
|
||||
|
||||
private:
|
||||
|
||||
@@ -172,13 +172,13 @@ void GamePage::saveState(Archive &archive) {
|
||||
if (this == _module->getPage()) {
|
||||
saveStateToMem();
|
||||
archive.writeDWORD(_memFile->size());
|
||||
archive.getWriteStream()->write(_memFile->getData(), _memFile->size());
|
||||
archive.write(_memFile->getData(), _memFile->size());
|
||||
delete _memFile;
|
||||
_memFile = nullptr;
|
||||
} else {
|
||||
if (_memFile != nullptr) {
|
||||
archive.writeDWORD(_memFile->size());
|
||||
archive.getWriteStream()->write(_memFile->getData(), _memFile->size());
|
||||
archive.write(_memFile->getData(), _memFile->size());
|
||||
} else {
|
||||
archive.writeDWORD(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user