diff options
author | James Brown | 2004-10-15 10:32:17 +0000 |
---|---|---|
committer | James Brown | 2004-10-15 10:32:17 +0000 |
commit | a5e188b9d826e6f1c088ab716c82079a7342260e (patch) | |
tree | 779accd7d85cf3e911ced17ea85780424b752b14 | |
parent | 8f65711a28b0cdedca29cdd1787b40546d448575 (diff) | |
download | scummvm-rg350-a5e188b9d826e6f1c088ab716c82079a7342260e.tar.gz scummvm-rg350-a5e188b9d826e6f1c088ab716c82079a7342260e.tar.bz2 scummvm-rg350-a5e188b9d826e6f1c088ab716c82079a7342260e.zip |
Fix a few things
svn-id: r15555
-rw-r--r-- | kyra/resource.cpp | 9 | ||||
-rw-r--r-- | kyra/resource.h | 7 | ||||
-rw-r--r-- | kyra/script.cpp | 3 |
3 files changed, 12 insertions, 7 deletions
diff --git a/kyra/resource.cpp b/kyra/resource.cpp index 6e56ff3a08..d5d1809162 100644 --- a/kyra/resource.cpp +++ b/kyra/resource.cpp @@ -29,6 +29,7 @@ namespace Kyra { Resourcemanager::Resourcemanager(KyraEngine* engine, const char* gamedir) { _gameDir = gamedir; + _engine = engine; // prefetches all PAK Files @@ -41,12 +42,11 @@ namespace Kyra { }; for (uint32 tmp = 0; kyraFilelist[tmp]; ++tmp) { - // prefetch file PAKFile* file = new PAKFile(getPath() + kyraFilelist[tmp]); assert(file); - if (file->isValid()) + if (file->isOpen() && file->isValid()) _pakfiles.push_back(file); else warning("couldn't load file '%s' correctly", kyraFilelist[tmp]); @@ -179,9 +179,10 @@ namespace Kyra { /////////////////////////////////////////// // Pak file manager #define PAKFile_Iterate Common::List<PakChunk*>::iterator start=_files.begin();start != _files.end(); ++start - PAKFile::PAKFile(const Common::String& file) { File pakfile; + _buffer = 0; + _open = false; if (!pakfile.open(file.c_str())) { warning("PAKFile couldn't open: '%s'", file.c_str()); @@ -221,11 +222,13 @@ namespace Kyra { _files.push_back(chunk); } + _open = true; } PAKFile::~PAKFile() { delete [] _buffer; _buffer = 0; + _open = false; for (PAKFile_Iterate) { delete *start; diff --git a/kyra/resource.h b/kyra/resource.h index b0a73beaa5..e867bdcf21 100644 --- a/kyra/resource.h +++ b/kyra/resource.h @@ -34,7 +34,6 @@ namespace Kyra { // standard Package format for Kyrandia games class PAKFile { - struct PakChunk { const char* _name; const uint8* _data; @@ -49,10 +48,10 @@ namespace Kyra { const uint8* getFile(const char* file); uint32 getFileSize(const char* file); - bool isValid(void) { return (_buffer != 0); } - + bool isValid(void) {return (_buffer != 0);} + bool isOpen(void) {return _open;} private: - + bool _open; uint8* _buffer; // the whole file Common::List<PakChunk*> _files; // the entries diff --git a/kyra/script.cpp b/kyra/script.cpp index 8b5e18287a..c40ab826b4 100644 --- a/kyra/script.cpp +++ b/kyra/script.cpp @@ -345,6 +345,9 @@ namespace Kyra { { 0, 0 } }; + _commands = commandProcs; +// _opcodes = opcodeProcs; + _scriptFile = NULL; _scriptFileSize = 0; } |