From 90864279f4a0761ff43fc9c412b6c76d98a0a019 Mon Sep 17 00:00:00 2001 From: whiterandrek Date: Sat, 26 May 2018 02:27:15 +0300 Subject: PINK: fixes to save system --- engines/pink/objects/actors/actor.cpp | 4 +--- engines/pink/objects/inventory.cpp | 2 +- engines/pink/objects/pages/game_page.cpp | 7 +++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp index abcb66502e..a1d179b945 100644 --- a/engines/pink/objects/actors/actor.cpp +++ b/engines/pink/objects/actors/actor.cpp @@ -132,9 +132,7 @@ Actor::~Actor() { } void Actor::loadState(Archive &archive) { - Common::String actionName; - actionName = archive.readString(); - _action = findAction(actionName); + _action = findAction(archive.readString()); } void Actor::saveState(Archive &archive) { diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp index 4a7d02d9be..3ae4effd0a 100644 --- a/engines/pink/objects/inventory.cpp +++ b/engines/pink/objects/inventory.cpp @@ -204,7 +204,7 @@ void InventoryMgr::loadState(Archive &archive) { } const Common::String currItemName = archive.readString(); - if (!currItemName.empty()) { + if (currItemName.empty()) { _item = nullptr; _isClickedOnItem = 0; } else { diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp index 883e129670..f6b843fae2 100644 --- a/engines/pink/objects/pages/game_page.cpp +++ b/engines/pink/objects/pages/game_page.cpp @@ -169,7 +169,7 @@ void GamePage::loadState(Archive &archive) { uint size = archive.readDWORD(); _memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES); for (uint i = 0; i < size; ++i) { - _memFile->writeByte(_memFile->readByte()); + _memFile->writeByte(archive.readByte()); } } @@ -177,12 +177,15 @@ void GamePage::saveState(Archive &archive) { if (this == _module->getPage()) { saveStateToMem(); archive.writeDWORD(_memFile->size()); + archive.getWriteStream()->write(_memFile->getData(), _memFile->size()); + delete _memFile; } else { if (_memFile != nullptr) { archive.writeDWORD(_memFile->size()); archive.getWriteStream()->write(_memFile->getData(), _memFile->size()); - } else + } else { archive.writeDWORD(0); + } } } -- cgit v1.2.3