X-Git-Url: http://git.tdb.fi/?p=libs%2Fdatafile.git;a=blobdiff_plain;f=source%2Fpacksource.cpp;h=f4c06b5deab36260d50b4736009977b569db6270;hp=938a627c05fb9b3685cb25cb53678439e39697f7;hb=116ea4040cbfa5b6985e95577fd7e029cc2bf30b;hpb=461967af6834fb0fccdd39a8d76192d411223148 diff --git a/source/packsource.cpp b/source/packsource.cpp index 938a627..f4c06b5 100644 --- a/source/packsource.cpp +++ b/source/packsource.cpp @@ -33,11 +33,16 @@ void PackSource::add_pack_io(IO::Seekable &io, const string &fn) add_pack(&io, fn, string()); } +void PackSource::add_pack_io(IO::Seekable &io, const string &fn, const string &filter) +{ + add_pack(&io, fn, filter); +} + void PackSource::add_pack(IO::Seekable *io, const string &fn, const string &filter) { Pack *pack = 0; for(list::iterator i=packs.begin(); (!pack && i!=packs.end()); ++i) - if(i->get_filename()==fn) + if(i->get_filename()==fn || (io && i->get_io()==io)) pack = &*i; if(!pack) { @@ -55,9 +60,11 @@ void PackSource::add_pack(IO::Seekable *io, const string &fn, const string &filt 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) + { + files[i->first] = i->second; i->second->collect_objects(objects); + } } list PackSource::list_files() const @@ -107,9 +114,6 @@ void PackSource::load(Collection &coll, const CollectionItemTypeBase &type, cons return; File &file = i->second->get_file(); - if(file.is_loaded()) - return; - file.set_loaded(); RefPtr in = file.open(); Parser parser(*in, file.get_full_name()); @@ -160,8 +164,7 @@ PackSource::File::File(const Pack &p, const string &fn): filename(fn), offset(0), length(0), - collection(false), - loaded(false) + collection(false) { } RefPtr PackSource::File::open() const @@ -191,11 +194,6 @@ string PackSource::File::get_full_name() const return format("%s/%s", pack.get_filename(), filename); } -void PackSource::File::set_loaded() -{ - loaded = true; -} - void PackSource::File::collect_objects(ObjectMap &objs) const { for(list::const_iterator i=objects.begin(); i!=objects.end(); ++i)