From 78f8ff98bb766d0f98e57ee2f521bcb6c13df286 Mon Sep 17 00:00:00 2001 From: "wrenczes@gmail.com" Date: Wed, 6 Oct 2010 11:46:10 +0000 Subject: [PATCH] more OutputDebugString() conversions, and removed a useless trace in the base WResource destructor - instead, moved it up to WCachedResource so that we can output the filename of the resource that is being destroyed. --- projects/mtg/include/WCachedResource.h | 2 +- projects/mtg/src/WCachedResource.cpp | 9 +++++++-- projects/mtg/src/WResourceManager.cpp | 10 +++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/projects/mtg/include/WCachedResource.h b/projects/mtg/include/WCachedResource.h index fd256a8ce..9b8e431da 100644 --- a/projects/mtg/include/WCachedResource.h +++ b/projects/mtg/include/WCachedResource.h @@ -38,7 +38,7 @@ public: friend class WResourceManager; template friend class WCache; - virtual ~WCachedResource() {}; + virtual ~WCachedResource(); string mFilename; virtual void Refresh()=0; //Basically calls Attempt(filename) and remaps in situ. diff --git a/projects/mtg/src/WCachedResource.cpp b/projects/mtg/src/WCachedResource.cpp index 46da714a7..db4fecd09 100644 --- a/projects/mtg/src/WCachedResource.cpp +++ b/projects/mtg/src/WCachedResource.cpp @@ -1,4 +1,5 @@ #include "../include/config.h" +#include "../include/DebugRoutines.h" #include "../include/utils.h" #include #include @@ -14,8 +15,6 @@ //WResource WResource::~WResource(){ - OutputDebugString("~WResource()\n"); - return; } WResource::WResource(){ locks = WRES_UNLOCKED; @@ -60,6 +59,12 @@ void WResource::unlock(bool force){ void WResource::hit(){ lastTime = resources.nowTime(); } + +WCachedResource::~WCachedResource() +{ + DebugTrace("Destroying WCachedResource: " << mFilename); +} + //WCachedTexture WCachedTexture::WCachedTexture(){ texture = NULL; diff --git a/projects/mtg/src/WResourceManager.cpp b/projects/mtg/src/WResourceManager.cpp index 8c247f082..749ad88ce 100644 --- a/projects/mtg/src/WResourceManager.cpp +++ b/projects/mtg/src/WResourceManager.cpp @@ -1,4 +1,5 @@ #include "../include/config.h" +#include "../include/DebugRoutines.h" #include "../include/utils.h" #include "../include/GameOptions.h" #include @@ -160,12 +161,7 @@ void WResourceManager::FlattenTimes(){ } WResourceManager::WResourceManager(){ - - #ifdef WIN32 - char buf [4096]; - sprintf(buf, " Init WResourceManager : %p\n", this); - OutputDebugString(buf); - #endif + DebugTrace("Init WResourceManager : " << addressof(this)); #ifdef DEBUG_CACHE menuCached = 0; #endif @@ -1459,7 +1455,7 @@ bool WCache::Delete(cacheItem * item){ cacheSize -= isize; #ifdef DEBUG_CACHE if(cacheItems == 0) - OutputDebugString("cacheItems out of sync.\n"); + DebugTrace("cacheItems out of sync."); #endif cacheItems--;