diff options
author | Max Horn | 2009-02-22 21:38:46 +0000 |
---|---|---|
committer | Max Horn | 2009-02-22 21:38:46 +0000 |
commit | 1687a5e8d05284a63105eb9ae48d4d11a76d0a5d (patch) | |
tree | 851fc7c9015a66e713fbc4bb54fff714d24be45e /engines/sci/include | |
parent | 4a6d6e8988da69ea992c7305f91906a8cae363d8 (diff) | |
download | scummvm-rg350-1687a5e8d05284a63105eb9ae48d4d11a76d0a5d.tar.gz scummvm-rg350-1687a5e8d05284a63105eb9ae48d4d11a76d0a5d.tar.bz2 scummvm-rg350-1687a5e8d05284a63105eb9ae48d4d11a76d0a5d.zip |
SCI: Rewrite the way file handles are managed
svn-id: r38794
Diffstat (limited to 'engines/sci/include')
-rw-r--r-- | engines/sci/include/engine.h | 19 | ||||
-rw-r--r-- | engines/sci/include/kernel.h | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/engines/sci/include/engine.h b/engines/sci/include/engine.h index ec1f49b07e..2e29a0682a 100644 --- a/engines/sci/include/engine.h +++ b/engines/sci/include/engine.h @@ -27,6 +27,7 @@ #define _SCI_ENGINE_H #include "common/scummsys.h" +#include "common/array.h" namespace Common { class SeekableReadStream; @@ -79,7 +80,22 @@ struct SavegameMetadata { int savegame_time; }; +class FileHandle { +public: + FILE *_file; + + FileHandle() : _file(0) { + } + + ~FileHandle() { + if (_file) + fclose(_file); + } +}; + struct EngineState { + EngineState(); + int savegame_version; int widget_serial_counter; /* Used for savegames */ @@ -171,8 +187,7 @@ struct EngineState { /* Kernel File IO stuff */ - int file_handles_nr; /* maximum numer of allowed file handles */ - FILE **file_handles; /* Array of file handles. Dynamically increased if required. */ + Common::Array<FileHandle> _fileHandles; /* Array of file handles. Dynamically increased if required. */ DirSeeker *dirseeker; diff --git a/engines/sci/include/kernel.h b/engines/sci/include/kernel.h index c5d6452610..608a2b7b7c 100644 --- a/engines/sci/include/kernel.h +++ b/engines/sci/include/kernel.h @@ -172,7 +172,7 @@ byte *kernel_dereference_bulk_pointer(EngineState *s, reg_t pointer, int entries int kernel_oops(EngineState *s, const char *file, int line, const char *reason); /* Halts script execution and informs the user about an internal kernel error or failed assertion -** Paramters: (EngineState *) s: The state to use +** Parameters: (EngineState *) s: The state to use ** (const char *) file: The file the oops occured in ** (int) line: The line the oops occured in ** (const char *) reason: Reason for the kernel oops |