diff options
author | Max Horn | 2008-09-30 09:09:39 +0000 |
---|---|---|
committer | Max Horn | 2008-09-30 09:09:39 +0000 |
commit | 96faab42711cb582607b61a7d031217609e86d11 (patch) | |
tree | 1312023b8ac65c8bfca7552aba15e435429b49a3 /engines/scumm/he | |
parent | 82f7b3e6e4044fa0f6e43dc07a7ed36ee14a111d (diff) | |
download | scummvm-rg350-96faab42711cb582607b61a7d031217609e86d11.tar.gz scummvm-rg350-96faab42711cb582607b61a7d031217609e86d11.tar.bz2 scummvm-rg350-96faab42711cb582607b61a7d031217609e86d11.zip |
SCUMM HE: Use FilesystemNode::openForReading() instead of 'new Common::File' (didn't cover all instances, though)
svn-id: r34694
Diffstat (limited to 'engines/scumm/he')
-rw-r--r-- | engines/scumm/he/resource_he.cpp | 15 | ||||
-rw-r--r-- | engines/scumm/he/resource_he.h | 2 | ||||
-rw-r--r-- | engines/scumm/he/script_v60he.cpp | 8 |
3 files changed, 9 insertions, 16 deletions
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 4f74a74b89..ece2b9d7f3 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -159,15 +159,16 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte /* initiate stuff */ fi.memory = NULL; - fi.file = new Common::File; + fi.file = NULL; if (_fileName.empty()) { // We are running for the first time _fileName = _vm->generateFilename(-3); } /* get file size */ - fi.file->open(_fileName); - if (!fi.file->isOpen()) { + Common::FilesystemNode node(_fileName); + fi.file = node.openForReading(); + if (!fi.file) { error("Cannot open file %s", _fileName.c_str()); } @@ -199,12 +200,8 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte /* free stuff and close file */ cleanup: - if (fi.file != NULL) { - fi.file->close(); - delete fi.file; - } - if (fi.memory != NULL) - free(fi.memory); + delete fi.file; + free(fi.memory); return ressize; } diff --git a/engines/scumm/he/resource_he.h b/engines/scumm/he/resource_he.h index 9f4b423d3d..cbe19a4fdf 100644 --- a/engines/scumm/he/resource_he.h +++ b/engines/scumm/he/resource_he.h @@ -168,7 +168,7 @@ class Win32ResExtractor : public ResExtractor { #include "common/pack-start.h" // START STRUCT PACKING struct WinLibrary { - Common::File *file; + Common::SeekableReadStream *file; byte *memory; byte *first_resource; int total_size; diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index 7f36d53791..4af2138cad 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -1010,12 +1010,8 @@ void ScummEngine_v60he::o60_openFile() { // TODO / FIXME: Consider using listSavefiles to avoid unneccessary openForLoading calls _hInFileTable[slot] = _saveFileMan->openForLoading(filename); if (_hInFileTable[slot] == 0) { - Common::File *f = new Common::File(); - f->open(filename); - if (!f->isOpen()) - delete f; - else - _hInFileTable[slot] = f; + Common::FilesystemNode node(filename); + _hInFileTable[slot] = node.openForReading(); } break; case 2: |