- Pack *pack = 0;
- for(list<Pack>::iterator i=packs.begin(); (!pack && i!=packs.end()); ++i)
- if(i->get_filename()==fn)
- pack = &*i;
- if(!pack)
+ add_pack(nullptr, fn, filter);
+}
+
+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)
+{
+ auto i = find_if(packs, [io, &fn](const Pack &p){ return p.get_filename()==fn || (io && p.get_io()==io); });
+ if(i==packs.end())