From 010737b64c8d4e7fcf0fe953ed15769eeac4178f Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 10 Nov 2014 19:47:56 +0200 Subject: [PATCH] Add version of add_pack_io with filter --- source/packsource.cpp | 7 ++++++- source/packsource.h | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/source/packsource.cpp b/source/packsource.cpp index 938a627..fe9e67d 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) { diff --git a/source/packsource.h b/source/packsource.h index 440b451..7d61661 100644 --- a/source/packsource.h +++ b/source/packsource.h @@ -130,6 +130,10 @@ public: PackSource. */ void add_pack_io(IO::Seekable &, const std::string & = std::string()); + /** Adds a pack from an I/O object with a regex to filter logical files. + Multiple filters for the same I/O object can be added with repeated calls. */ + void add_pack_io(IO::Seekable &, const std::string &, const std::string &); + private: void add_pack(IO::Seekable *, const std::string &, const std::string &); -- 2.43.0