aboutsummaryrefslogtreecommitdiff
path: root/engines/tony/gfxengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tony/gfxengine.cpp')
-rw-r--r--engines/tony/gfxengine.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp
index cb27e20ab1..7bb25f59b9 100644
--- a/engines/tony/gfxengine.cpp
+++ b/engines/tony/gfxengine.cpp
@@ -530,7 +530,10 @@ void RMGfxEngine::disableMouse() {
#define TONY_SAVEGAME_VERSION 8
void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Common::String &name) {
- Common::OutSaveFile *f;
+ Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(fn);
+ if (f == NULL)
+ return;
+
byte *state;
char buf[4];
RMPoint tp = _tony.position();
@@ -549,10 +552,6 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm
buf[2] = 'S';
buf[3] = TONY_SAVEGAME_VERSION;
- f = g_system->getSavefileManager()->openForSaving(fn);
- if (f == NULL)
- return;
-
f->write(buf, 4);
f->writeUint32LE(thumbsize);
f->write(curThumb, thumbsize);