[Scummvm-cvs-logs] scummvm master -> a428835b38fdc6a0672a760a7cbb16b0a936f124

bluegr md5 at scummvm.org
Thu May 5 12:35:29 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a428835b38 SWORD25: Removed the saved game filename from the savegame meta info struct


Commit: a428835b38fdc6a0672a760a7cbb16b0a936f124
    https://github.com/scummvm/scummvm/commit/a428835b38fdc6a0672a760a7cbb16b0a936f124
Author: md5 (md5 at scummvm.org)
Date: 2011-05-05T03:33:39-07:00

Commit Message:
SWORD25: Removed the saved game filename from the savegame meta info struct

Changed paths:
    engines/sword25/kernel/persistenceservice.cpp



diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp
index 1312e1f..8d54c24 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;
 	}
 






More information about the Scummvm-git-logs mailing list