Răsfoiți Sursa

*** empty log message ***

Mike Goslin 25 ani în urmă
părinte
comite
26d7cb8ccb
2 a modificat fișierele cu 7 adăugiri și 6 ștergeri
  1. 6 5
      panda/src/express/multifile.cxx
  2. 1 1
      panda/src/express/multifile.h

+ 6 - 5
panda/src/express/multifile.cxx

@@ -575,17 +575,18 @@ write(Filename name) {
 //		 Advances the start pointer as it writes.
 //		 Advances the start pointer as it writes.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 bool Multifile::
 bool Multifile::
-write(char *&start, int &size) {
+write(char *&start, int &size, const Filename &rel_path) {
   // Make sure we have a complete header first
   // Make sure we have a complete header first
   if (parse_header(start, size) == false)
   if (parse_header(start, size) == false)
     return false;
     return false;
 
 
+  if (_current_mfile == (Memfile *)0L)
+    _current_mfile = new Memfile;
+
   while (_num_mfiles > 0) {
   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--;
       _num_mfiles--;
-      delete _current_mfile;
+      _current_mfile->reset();
     } else
     } else
       return false;
       return false;
   }
   }

+ 1 - 1
panda/src/express/multifile.h

@@ -44,7 +44,7 @@ PUBLISHED:
 
 
   bool read(Filename &name);
   bool read(Filename &name);
   bool write(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 write_extract(char *&start, int &size, const Filename &rel_path = "");
   bool extract(const Filename &name, const Filename &rel_path = "");
   bool extract(const Filename &name, const Filename &rel_path = "");
   void extract_all(const Filename &rel_path = "");
   void extract_all(const Filename &rel_path = "");