aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/detection.cpp13
-rw-r--r--engines/fullpipe/gameloader.h3
-rw-r--r--engines/fullpipe/stateloader.cpp4
-rw-r--r--engines/savestate.h1
4 files changed, 9 insertions, 12 deletions
diff --git a/engines/fullpipe/detection.cpp b/engines/fullpipe/detection.cpp
index e22bcd3d50..82c7954ced 100644
--- a/engines/fullpipe/detection.cpp
+++ b/engines/fullpipe/detection.cpp
@@ -180,13 +180,11 @@ SaveStateList FullpipeMetaEngine::listSaves(const char *target) const {
int slotNum = atoi(file->c_str() + file->size() - 2);
if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
- Common::InSaveFile *in = saveFileMan->openForLoading(*file);
+ Common::ScopedPtr<Common::InSaveFile> in(saveFileMan->openForLoading(*file));
if (in) {
Fullpipe::FullpipeSavegameHeader header;
- Fullpipe::readSavegameHeader(in, header);
+ Fullpipe::readSavegameHeader(in.get(), header);
saveList.push_back(SaveStateDescriptor(slotNum, header.saveName));
- delete header.thumbnail;
- delete in;
}
}
}
@@ -201,13 +199,12 @@ void FullpipeMetaEngine::removeSaveState(const char *target, int slot) const {
}
SaveStateDescriptor FullpipeMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
- Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(
- Fullpipe::getSavegameFile(slot));
+ Common::ScopedPtr<Common::InSaveFile> f(g_system->getSavefileManager()->openForLoading(
+ Fullpipe::getSavegameFile(slot)));
if (f) {
Fullpipe::FullpipeSavegameHeader header;
- Fullpipe::readSavegameHeader(f, header);
- delete f;
+ Fullpipe::readSavegameHeader(f.get(), header);
// Create the return descriptor
SaveStateDescriptor desc(slot, header.saveName);
diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h
index 5e4d931409..39ccb7784c 100644
--- a/engines/fullpipe/gameloader.h
+++ b/engines/fullpipe/gameloader.h
@@ -23,6 +23,7 @@
#ifndef FULLPIPE_GAMELOADER_H
#define FULLPIPE_GAMELOADER_H
+#include "common/ptr.h"
#include "engines/savestate.h"
#include "fullpipe/objects.h"
@@ -83,7 +84,7 @@ struct FullpipeSavegameHeader {
uint32 date;
uint16 time;
uint32 playtime;
- Graphics::Surface *thumbnail;
+ Common::SharedPtr<Graphics::Surface> thumbnail;
};
struct SaveHeader {
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index 5a2ad51280..34c2252c79 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -195,8 +195,6 @@ void fillDummyHeader(Fullpipe::FullpipeSavegameHeader &header) {
}
bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header) {
- header.thumbnail = NULL;
-
uint oldPos = in->pos();
in->seek(-4, SEEK_END);
@@ -239,7 +237,7 @@ bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header)
header.saveName = Common::String::format("%s %s", desc.getSaveDate().c_str(), desc.getSaveTime().c_str());
// Get the thumbnail
- header.thumbnail = Graphics::loadThumbnail(*in);
+ header.thumbnail = Common::SharedPtr<Graphics::Surface>(Graphics::loadThumbnail(*in), Graphics::SurfaceDeleter());
in->seek(oldPos, SEEK_SET); // Rewind the file
diff --git a/engines/savestate.h b/engines/savestate.h
index 3244d61fdb..567750c4be 100644
--- a/engines/savestate.h
+++ b/engines/savestate.h
@@ -121,6 +121,7 @@ public:
* Hence the caller must not delete the surface.
*/
void setThumbnail(Graphics::Surface *t);
+ void setThumbnail(Common::SharedPtr<Graphics::Surface> t) { _thumbnail = t; }
/**
* Sets the date the save state was created.