From 6de4f5612e7e3ed470140d227ce05d0e0e96f9d1 Mon Sep 17 00:00:00 2001 From: "wagic.jeck" Date: Mon, 21 Sep 2009 06:59:28 +0000 Subject: [PATCH] Jeck - Resource manager zipfile fix. * Only attaches when necessary. --- projects/mtg/include/WResourceManager.h | 1 + projects/mtg/src/WResourceManager.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/mtg/include/WResourceManager.h b/projects/mtg/include/WResourceManager.h index 4e5cf17f7..a4fff8463 100644 --- a/projects/mtg/include/WResourceManager.h +++ b/projects/mtg/include/WResourceManager.h @@ -196,6 +196,7 @@ private: vector managedQuads; //Statistics of record. + string attachedZip; unsigned int lastTime; int lastError; }; diff --git a/projects/mtg/src/WResourceManager.cpp b/projects/mtg/src/WResourceManager.cpp index 4042cba44..e08357cb0 100644 --- a/projects/mtg/src/WResourceManager.cpp +++ b/projects/mtg/src/WResourceManager.cpp @@ -620,7 +620,6 @@ string WResourceManager::cardFile(const string filename, const string specific){ JFileSystem* fs = JFileSystem::GetInstance(); char buf[512]; - fs->DetachZipFile(); //Check the specific location, if any. if(specific != ""){ @@ -669,7 +668,12 @@ string WResourceManager::cardFile(const string filename, const string specific){ char zipname[512]; sprintf(zipname, "Res/sets/%s/%s.zip", set.c_str(),set.c_str()); if (fileOK(zipname)){ - fs->AttachZipFile(zipname); + if(attachedZip != zipname) + { + fs->DetachZipFile(); + attachedZip = zipname; + fs->AttachZipFile(zipname); + } return filename.substr(i+1); } }