aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormd52011-05-05 13:33:39 +0300
committermd52011-05-05 13:33:39 +0300
commita428835b38fdc6a0672a760a7cbb16b0a936f124 (patch)
tree0ca8ce1047de6bb6d630aa682b9a1b1fd5f7343a
parent68118bdf7a02b95d83d673db4897ab2dd758b0d1 (diff)
downloadscummvm-rg350-a428835b38fdc6a0672a760a7cbb16b0a936f124.tar.gz
scummvm-rg350-a428835b38fdc6a0672a760a7cbb16b0a936f124.tar.bz2
scummvm-rg350-a428835b38fdc6a0672a760a7cbb16b0a936f124.zip
SWORD25: Removed the saved game filename from the savegame meta info struct
-rw-r--r--engines/sword25/kernel/persistenceservice.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp
index 1312e1f1f6..8d54c24918 100644
--- a/engines/sword25/kernel/persistenceservice.cpp
+++ b/engines/sword25/kernel/persistenceservice.cpp
@@ -105,7 +105,6 @@ struct SavegameInformation {
bool isOccupied;
bool isCompatible;
Common::String description;
- Common::String filename;
uint gamedataLength;
uint gamedataOffset;
uint gamedataUncompressedLength;
@@ -118,7 +117,6 @@ struct SavegameInformation {
isOccupied = false;
isCompatible = false;
description = "";
- filename = "";
gamedataLength = 0;
gamedataOffset = 0;
gamedataUncompressedLength = 0;
@@ -175,8 +173,6 @@ struct PersistenceService::Impl {
curSavegameInfo.isOccupied = true;
// Check if the saved game is compatible with the current engine version.
curSavegameInfo.isCompatible = (storedVersionID == Common::String(VERSIONID));
- // Store the save game name - FIXME: Why is this needed?
- curSavegameInfo.filename = filename;
// Load the save game description.
curSavegameInfo.description = gameDescription;
// The offset to the stored save game data within the file.
@@ -253,10 +249,11 @@ Common::String &PersistenceService::getSavegameDescription(uint slotID) {
}
Common::String &PersistenceService::getSavegameFilename(uint slotID) {
- static Common::String emptyString;
+ static Common::String result;
if (!checkslotID(slotID))
- return emptyString;
- return _impl->_savegameInformations[slotID].filename;
+ return result;
+ result = generateSavegameFilename(slotID);
+ return result;
}
bool PersistenceService::saveGame(uint slotID, const Common::String &screenshotFilename) {
@@ -381,13 +378,13 @@ bool PersistenceService::loadGame(uint slotID) {
byte *compressedDataBuffer = new byte[curSavegameInfo.gamedataLength];
byte *uncompressedDataBuffer = new Bytef[curSavegameInfo.gamedataUncompressedLength];
-
- file = sfm->openForLoading(generateSavegameFilename(slotID));
+ Common::String filename = generateSavegameFilename(slotID);
+ file = sfm->openForLoading(filename);
file->seek(curSavegameInfo.gamedataOffset);
file->read(reinterpret_cast<char *>(&compressedDataBuffer[0]), curSavegameInfo.gamedataLength);
if (file->err()) {
- error("Unable to load the gamedata from the savegame file \"%s\".", curSavegameInfo.filename.c_str());
+ error("Unable to load the gamedata from the savegame file \"%s\".", filename.c_str());
delete[] compressedDataBuffer;
delete[] uncompressedDataBuffer;
return false;
@@ -397,7 +394,7 @@ bool PersistenceService::loadGame(uint slotID) {
uLongf uncompressedBufferSize = curSavegameInfo.gamedataUncompressedLength;
if (uncompress(reinterpret_cast<Bytef *>(&uncompressedDataBuffer[0]), &uncompressedBufferSize,
reinterpret_cast<Bytef *>(&compressedDataBuffer[0]), curSavegameInfo.gamedataLength) != Z_OK) {
- error("Unable to decompress the gamedata from savegame file \"%s\".", curSavegameInfo.filename.c_str());
+ error("Unable to decompress the gamedata from savegame file \"%s\".", filename.c_str());
delete[] uncompressedDataBuffer;
delete[] compressedDataBuffer;
delete file;
@@ -420,7 +417,7 @@ bool PersistenceService::loadGame(uint slotID) {
delete file;
if (!success) {
- error("Unable to unpersist the gamedata from savegame file \"%s\".", curSavegameInfo.filename.c_str());
+ error("Unable to unpersist the gamedata from savegame file \"%s\".", filename.c_str());
return false;
}