[Scummvm-cvs-logs] scummvm master -> 998323129420ebde730074585d7aab9f093368a8
fuzzie
fuzzie at fuzzie.org
Mon May 23 11:58:26 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:
9983231294 SWORD25: De-hardcode target name in thumbnail code
Commit: 998323129420ebde730074585d7aab9f093368a8
https://github.com/scummvm/scummvm/commit/998323129420ebde730074585d7aab9f093368a8
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-05-23T02:55:34-07:00
Commit Message:
SWORD25: De-hardcode target name in thumbnail code
This just uses the provided filename rather than trying to recreate
it with a hard-coded target (causing crashes with other targets).
(Also, add an error check rather then crashing there, just in case.)
Changed paths:
engines/sword25/gfx/image/renderedimage.cpp
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp
index 23bf262..395d29d 100644
--- a/engines/sword25/gfx/image/renderedimage.cpp
+++ b/engines/sword25/gfx/image/renderedimage.cpp
@@ -42,14 +42,6 @@
namespace Sword25 {
-// Duplicated from kernel/persistenceservice.cpp
-static Common::String generateSavegameFilename(uint slotID) {
- char buffer[100];
- // NOTE: This is hardcoded to sword25
- snprintf(buffer, 100, "%s.%.3d", "sword25", slotID);
- return Common::String(buffer);
-}
-
// -----------------------------------------------------------------------------
// CONSTRUCTION / DESTRUCTION
// -----------------------------------------------------------------------------
@@ -74,8 +66,9 @@ static Common::String loadString(Common::SeekableReadStream &in, uint maxSize =
static byte *readSavegameThumbnail(const Common::String &filename, uint &fileSize, bool &isPNG) {
byte *pFileData;
Common::SaveFileManager *sfm = g_system->getSavefileManager();
- int slotNum = atoi(filename.c_str() + filename.size() - 3);
- Common::InSaveFile *file = sfm->openForLoading(generateSavegameFilename(slotNum));
+ Common::InSaveFile *file = sfm->openForLoading(lastPathComponent(filename, '/'));
+ if (!file)
+ error("Save file \"%s\" could not be loaded.", filename.c_str());
// Seek to the actual PNG image
loadString(*file); // Marker (BS25SAVEGAME)
More information about the Scummvm-git-logs
mailing list