diff --git a/panda/src/express/multifile.cxx b/panda/src/express/multifile.cxx index 2ec152f1e9..8dd44b7415 100644 --- a/panda/src/express/multifile.cxx +++ b/panda/src/express/multifile.cxx @@ -575,17 +575,18 @@ write(Filename name) { // Advances the start pointer as it writes. //////////////////////////////////////////////////////////////////// bool Multifile:: -write(char *&start, int &size) { +write(char *&start, int &size, const Filename &rel_path) { // Make sure we have a complete header first if (parse_header(start, size) == false) return false; + if (_current_mfile == (Memfile *)0L) + _current_mfile = new Memfile; + while (_num_mfiles > 0) { - if (_current_mfile == (Memfile *)0L) - _current_mfile = new Memfile; - if (_current_mfile->write(start, size) == true) { + if (_current_mfile->write(start, size, rel_path) == true) { _num_mfiles--; - delete _current_mfile; + _current_mfile->reset(); } else return false; } diff --git a/panda/src/express/multifile.h b/panda/src/express/multifile.h index 21b787097c..ac823443c4 100644 --- a/panda/src/express/multifile.h +++ b/panda/src/express/multifile.h @@ -44,7 +44,7 @@ PUBLISHED: bool read(Filename &name); bool write(Filename name); - bool write(char *&start, int &size); + bool write(char *&start, int &size, const Filename &rel_path = ""); bool write_extract(char *&start, int &size, const Filename &rel_path = ""); bool extract(const Filename &name, const Filename &rel_path = ""); void extract_all(const Filename &rel_path = "");