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 /kyra/resource.cpp | |
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
Diffstat (limited to 'kyra/resource.cpp')
-rw-r--r-- | kyra/resource.cpp | 9 |
1 files changed, 6 insertions, 3 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; |