summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-05-17 03:56:13 +0300
committerAndrei Karas <akaras@inbox.ru>2011-05-17 03:56:39 +0300
commited41c67908b8d6289f0e5eb49f101c851d9adc75 (patch)
tree527d3352b2b4d6aca56d89dac5913de36aba6c4b /src/resources
parente9a8a46fc92669236e37dd096f5a849aed74ca6a (diff)
downloadmv-ed41c67908b8d6289f0e5eb49f101c851d9adc75.tar.gz
mv-ed41c67908b8d6289f0e5eb49f101c851d9adc75.tar.bz2
mv-ed41c67908b8d6289f0e5eb49f101c851d9adc75.tar.xz
mv-ed41c67908b8d6289f0e5eb49f101c851d9adc75.zip
Debug option to dump loaded images names.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/mapreader.cpp2
-rw-r--r--src/resources/resource.h19
-rw-r--r--src/resources/resourcemanager.h22
3 files changed, 30 insertions, 13 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 7fa088326..5bec46bdd 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -419,11 +419,9 @@ inline static void setTile(Map *map, MapLayer *layer, int x, int y, int gid)
map->blockTile(x, y, Map::BLOCKTYPE_WALL);
break;
case Map::COLLISION_AIR:
- logger->log("air: %d, %d", x, y);
map->blockTile(x, y, Map::BLOCKTYPE_AIR);
break;
case Map::COLLISION_WATER:
- logger->log("water: %d, %d", x, y);
map->blockTile(x, y, Map::BLOCKTYPE_WATER);
break;
default:
diff --git a/src/resources/resource.h b/src/resources/resource.h
index c4593e7fe..7196fa916 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -23,6 +23,8 @@
#ifndef RESOURCE_H
#define RESOURCE_H
+#include "main.h"
+
#include <ctime>
#include <string>
@@ -38,7 +40,11 @@ class Resource
* Constructor
*/
Resource(): mRefCount(0)
- { }
+ {
+#ifdef DEBUG_DUMP_LEAKS
+ mDumped = false;
+#endif
+ }
/**
* Increments the internal reference count.
@@ -66,6 +72,14 @@ class Resource
unsigned getRefCount() const
{ return mRefCount; }
+#ifdef DEBUG_DUMP_LEAKS
+ bool getDumped()
+ { return mDumped; }
+
+ void setDumped(bool n)
+ { mDumped = n; }
+#endif
+
protected:
/**
* Destructor.
@@ -77,6 +91,9 @@ class Resource
time_t mTimeStamp; /**< Time at which the resource was orphaned. */
unsigned mRefCount; /**< Reference count. */
std::string mName;
+#ifdef DEBUG_DUMP_LEAKS
+ bool mDumped;
+#endif
};
#endif
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 36abf89e9..16ded5ab2 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -23,6 +23,8 @@
#ifndef RESOURCE_MANAGER_H
#define RESOURCE_MANAGER_H
+#include "main.h"
+
#include <ctime>
#include <map>
#include <string>
@@ -232,17 +234,19 @@ class ResourceManager
*/
static void deleteInstance();
-/*
- void selectSkin();
-
- Image *getSkinImage(const std::string &idPath);
+ int size()
+ { return mResources.size(); }
- std::string mapPathToSkin(const std::string &file);
+ typedef std::map<std::string, Resource*> Resources;
+ typedef Resources::iterator ResourceIterator;
- void fillSkinsList(std::vector<std::string> &list) const;
+#ifdef DEBUG_DUMP_LEAKS
+ Resources* getResources()
+ { return &mResources; }
- std::string getSkinName() const { return mSkinName; }
-*/
+ Resources* getOrphanedResources()
+ { return &mOrphanedResources; }
+#endif
private:
/**
@@ -253,8 +257,6 @@ class ResourceManager
void cleanOrphans();
static ResourceManager *instance;
- typedef std::map<std::string, Resource*> Resources;
- typedef Resources::iterator ResourceIterator;
std::set<SDL_Surface*> deletedSurfaces;
Resources mResources;
Resources mOrphanedResources;