aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorMax Horn2005-04-13 18:36:55 +0000
committerMax Horn2005-04-13 18:36:55 +0000
commit839c8add38ba710654cbe304493521584e663dd7 (patch)
treeb9e5975f1ec1911e14045e0c197fe13e5880464b /simon
parenta5993b21129b133bdbd570a3f540caf44c0c3958 (diff)
downloadscummvm-rg350-839c8add38ba710654cbe304493521584e663dd7.tar.gz
scummvm-rg350-839c8add38ba710654cbe304493521584e663dd7.tar.bz2
scummvm-rg350-839c8add38ba710654cbe304493521584e663dd7.zip
Get rid of errno; add some (optional) error checking facilities to SaveFile classes (they are ugly, and to simple, but better than nothing)
svn-id: r17589
Diffstat (limited to 'simon')
-rw-r--r--simon/saveload.cpp26
1 files changed, 4 insertions, 22 deletions
diff --git a/simon/saveload.cpp b/simon/saveload.cpp
index cebc5add06..7892da4f46 100644
--- a/simon/saveload.cpp
+++ b/simon/saveload.cpp
@@ -21,13 +21,6 @@
#include "stdafx.h"
-#ifndef _WIN32_WCE
-// FIXME TODO FIXME: Using errno is not really portable!
-// We should get rid of this, possibly by adding (clear)ioFailed methods
-// to the SaveFile class.
-#include <errno.h>
-#endif
-
#include "gui/about.h"
#include "gui/message.h"
@@ -413,11 +406,6 @@ bool SimonEngine::save_game(uint slot, char *caption) {
_lock_word |= 0x100;
-#ifndef _WIN32_WCE
- errno = 0;
-#endif
-
-
f = _saveFileMan->openForSaving(gen_savename(slot));
if (f == NULL) {
_lock_word &= ~0x100;
@@ -514,11 +502,6 @@ bool SimonEngine::load_game(uint slot) {
_lock_word |= 0x100;
-#ifndef _WIN32_WCE
- errno = 0;
-#endif
-
-
f = _saveFileMan->openForLoading(gen_savename(slot));
if (f == NULL) {
_lock_word &= ~0x100;
@@ -606,6 +589,10 @@ bool SimonEngine::load_game(uint slot) {
// Write the bits in array 1 & 2
for (i = 0; i != 32; i++)
_bit_array[i] = f->readUint16BE();
+
+ if (f->readingFailed()) {
+ error("load failed");
+ }
delete f;
@@ -613,11 +600,6 @@ bool SimonEngine::load_game(uint slot) {
_lock_word &= ~0x100;
-#ifndef _WIN32_WCE
- if (errno != 0)
- error("load failed");
-#endif
-
return true;
}