]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/packsource.cpp
Remove the loaded flag from PackSource files
[libs/datafile.git] / source / packsource.cpp
index 938a627c05fb9b3685cb25cb53678439e39697f7..1accdb0fc3a384c456f4535db23e164a89efb5b7 100644 (file)
@@ -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<Pack>::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)
        {
@@ -107,9 +112,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<IO::Base> in = file.open();
        Parser parser(*in, file.get_full_name());
@@ -160,8 +162,7 @@ PackSource::File::File(const Pack &p, const string &fn):
        filename(fn),
        offset(0),
        length(0),
-       collection(false),
-       loaded(false)
+       collection(false)
 { }
 
 RefPtr<IO::Seekable> PackSource::File::open() const
@@ -191,11 +192,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<Object>::const_iterator i=objects.begin(); i!=objects.end(); ++i)