X-Git-Url: http://git.tdb.fi/?p=libs%2Fdatafile.git;a=blobdiff_plain;f=source%2Fpacksource.cpp;h=c8968665d41d23c936ef8efbc87fa1b5dca5bd7a;hp=d22c7dc4235990591fffbf7c9d2dafba0eca3aaa;hb=9b1656018f783eb4aad2fbdc1de1404691e89bb1;hpb=e44432ecb5d2c0a288652ac6ed9d06f51a68d395 diff --git a/source/packsource.cpp b/source/packsource.cpp index d22c7dc..c896866 100644 --- a/source/packsource.cpp +++ b/source/packsource.cpp @@ -38,6 +38,7 @@ void PackSource::add_pack_file(const string &fn, const string &filter) FileMap pack_files; pack->collect_files(pack_files, filter); + files.insert(pack_files.begin(), pack_files.end()); for(FileMap::const_iterator i=pack_files.begin(); i!=pack_files.end(); ++i) i->second->collect_objects(objects); } @@ -96,6 +97,15 @@ void PackSource::load(Collection &coll, const CollectionItemTypeBase &type, cons type.load_item(coll, parser, name); } +IO::Seekable *PackSource::open(const string &fn) const +{ + FileMap::const_iterator i = files.find(fn); + if(i!=files.end()) + return i->second->open().release(); + + return 0; +} + PackSource::Pack::Pack(const string &fn): filename(fn), @@ -128,7 +138,7 @@ PackSource::File::File(const Pack &p, const string &fn): loaded(false) { } -RefPtr PackSource::File::open() const +RefPtr PackSource::File::open() const { IO::BufferedFile *io_file = new IO::BufferedFile(pack.get_filename()); IO::Slice *io_slice = new IO::Slice(*io_file, pack.get_base_offset()+offset, length);