diff options
Diffstat (limited to 'engines/tsage/saveload.cpp')
-rw-r--r-- | engines/tsage/saveload.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp index dbc122e6e4..9954b929b2 100644 --- a/engines/tsage/saveload.cpp +++ b/engines/tsage/saveload.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -47,6 +47,8 @@ SavedObject::~SavedObject() { Saver::Saver() { _macroSaveFlag = false; _macroRestoreFlag = false; + + _factoryPtr = nullptr; } Saver::~Saver() { @@ -127,7 +129,6 @@ Common::Error Saver::save(int slot, const Common::String &saveName) { // Set fields _macroSaveFlag = true; - _saveSlot = slot; // Try and create the save file Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(g_vm->generateSaveName(slot)); @@ -140,8 +141,8 @@ Common::Error Saver::save(int slot, const Common::String &saveName) { // Write out the savegame header tSageSavegameHeader header; - header.saveName = saveName; - header.version = TSAGE_SAVEGAME_VERSION; + header._saveName = saveName; + header._version = TSAGE_SAVEGAME_VERSION; writeSavegameHeader(saveFile, header); // Save out objects that need to come at the start of the savegame @@ -177,7 +178,6 @@ Common::Error Saver::restore(int slot) { // Set fields _macroRestoreFlag = true; - _saveSlot = slot; _unresolvedPtrs.clear(); // Set up the serializer @@ -190,11 +190,11 @@ Common::Error Saver::restore(int slot) { // Read in the savegame header tSageSavegameHeader header; readSavegameHeader(saveFile, header); - if (header.thumbnail) - header.thumbnail->free(); - delete header.thumbnail; + if (header._thumbnail) + header._thumbnail->free(); + delete header._thumbnail; - serializer.setSaveVersion(header.version); + serializer.setSaveVersion(header._version); // Load in data for objects that need to come at the start of the savegame for (Common::List<SaveListener *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) { @@ -242,34 +242,34 @@ const char *SAVEGAME_STR = "SCUMMVM_TSAGE"; bool Saver::readSavegameHeader(Common::InSaveFile *in, tSageSavegameHeader &header) { char saveIdentBuffer[SAVEGAME_STR_SIZE + 1]; - header.thumbnail = NULL; + header._thumbnail = NULL; // Validate the header Id in->read(saveIdentBuffer, SAVEGAME_STR_SIZE + 1); if (strncmp(saveIdentBuffer, SAVEGAME_STR, SAVEGAME_STR_SIZE)) return false; - header.version = in->readByte(); - if (header.version > TSAGE_SAVEGAME_VERSION) + header._version = in->readByte(); + if (header._version > TSAGE_SAVEGAME_VERSION) return false; // Read in the string - header.saveName.clear(); + header._saveName.clear(); char ch; - while ((ch = (char)in->readByte()) != '\0') header.saveName += ch; + while ((ch = (char)in->readByte()) != '\0') header._saveName += ch; // Get the thumbnail - header.thumbnail = Graphics::loadThumbnail(*in); - if (!header.thumbnail) + header._thumbnail = Graphics::loadThumbnail(*in); + if (!header._thumbnail) return false; // Read in save date/time - header.saveYear = in->readSint16LE(); - header.saveMonth = in->readSint16LE(); - header.saveDay = in->readSint16LE(); - header.saveHour = in->readSint16LE(); - header.saveMinutes = in->readSint16LE(); - header.totalFrames = in->readUint32LE(); + header._saveYear = in->readSint16LE(); + header._saveMonth = in->readSint16LE(); + header._saveDay = in->readSint16LE(); + header._saveHour = in->readSint16LE(); + header._saveMinutes = in->readSint16LE(); + header._totalFrames = in->readUint32LE(); return true; } @@ -281,7 +281,7 @@ void Saver::writeSavegameHeader(Common::OutSaveFile *out, tSageSavegameHeader &h out->writeByte(TSAGE_SAVEGAME_VERSION); // Write savegame name - out->write(header.saveName.c_str(), header.saveName.size() + 1); + out->write(header._saveName.c_str(), header._saveName.size() + 1); // Get the active palette uint8 thumbPalette[256 * 3]; |