From 1689edc69ba476ff8a08e3ad2d45674051bf0562 Mon Sep 17 00:00:00 2001 From: "wagic.jeck" Date: Sun, 20 Sep 2009 00:05:23 +0000 Subject: [PATCH] Jeck - Cleanup some debug messages, cache now clears unlocked items between states. --- projects/mtg/include/WCachedResource.h | 3 --- projects/mtg/src/WCachedResource.cpp | 14 -------------- projects/mtg/src/WResourceManager.cpp | 4 ++-- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/projects/mtg/include/WCachedResource.h b/projects/mtg/include/WCachedResource.h index 39bce3ae3..e0a4eb07c 100644 --- a/projects/mtg/include/WCachedResource.h +++ b/projects/mtg/include/WCachedResource.h @@ -57,9 +57,6 @@ public: string resname; JQuad * quad; -#ifdef DEBUG_CACHE - static int totalTracked; -#endif }; class WCachedTexture: public WCachedResource{ diff --git a/projects/mtg/src/WCachedResource.cpp b/projects/mtg/src/WCachedResource.cpp index cfa42b266..508ee82c1 100644 --- a/projects/mtg/src/WCachedResource.cpp +++ b/projects/mtg/src/WCachedResource.cpp @@ -477,10 +477,6 @@ void WTrackedQuad::Trash(){ SAFE_DELETE(quad); } -#if defined DEBUG_CACHE -int WTrackedQuad::totalTracked = 0; -#endif - unsigned long WTrackedQuad::size() { return sizeof(JQuad); } @@ -488,18 +484,8 @@ bool WTrackedQuad::isGood(){ return (quad != NULL); } WTrackedQuad::WTrackedQuad(string _resname) { -#if defined DEBUG_CACHE - OutputDebugString("WTrackedQuad().\n"); - totalTracked++; -#endif quad = NULL; resname = _resname; } WTrackedQuad::~WTrackedQuad() { -#if defined DEBUG_CACHE - char buf[512]; - totalTracked--; - sprintf(buf,"~WTrackedQuad() {%d}. %d left.\n", (int) quad,totalTracked); - OutputDebugString(buf); -#endif if(quad) SAFE_DELETE(quad); } \ No newline at end of file diff --git a/projects/mtg/src/WResourceManager.cpp b/projects/mtg/src/WResourceManager.cpp index c37554e90..80a9060a5 100644 --- a/projects/mtg/src/WResourceManager.cpp +++ b/projects/mtg/src/WResourceManager.cpp @@ -818,13 +818,13 @@ void WResourceManager::CacheForState(int state){ case GAME_STATE_DUEL: textureWCache.Resize(SMALL_CACHE_LIMIT,SMALL_CACHE_ITEMS); sampleWCache.Resize(SMALL_CACHE_LIMIT,MAX_CACHED_SAMPLES); - Cleanup(); + ClearUnlocked(); break; //Deck editor and shop are entirely cache safe, so give it near infinite resources. case GAME_STATE_SHOP: case GAME_STATE_DECK_VIEWER: textureWCache.Resize(HUGE_CACHE_LIMIT,HUGE_CACHE_ITEMS); - Cleanup(); + ClearUnlocked(); break; //Anything unknown, use large cache. default: