summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actions/actions.cpp4
-rw-r--r--src/particle/imageparticle.cpp2
-rw-r--r--src/particle/particle.cpp2
-rw-r--r--src/particle/particleemitter.cpp2
-rw-r--r--src/render/shaders/shadersmanager.cpp4
-rw-r--r--src/resources/atlas/atlasmanager.cpp6
-rw-r--r--src/resources/atlas/atlasresource.cpp4
-rw-r--r--src/resources/image/image.cpp2
-rw-r--r--src/resources/image/subimage.cpp8
-rw-r--r--src/resources/imageset.cpp2
-rw-r--r--src/resources/loaders/rescaledloader.cpp4
-rw-r--r--src/resources/loaders/subimageloader.cpp4
-rw-r--r--src/resources/loaders/subimagesetloader.cpp2
-rw-r--r--src/resources/resource.h43
-rw-r--r--src/resources/resourcemanager/resourcemanager.cpp72
-rw-r--r--src/resources/resourcemanager/resourcemanager_unittest.cc142
-rw-r--r--src/resources/sprite/animatedsprite.cpp2
-rw-r--r--src/resources/sprite/spritedef.cpp8
18 files changed, 136 insertions, 177 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index c6d48a1d9..844c91272 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -1240,7 +1240,7 @@ static void showRes(std::string str, ResourceManager::Resources *res)
const ResourceManager::ResourceIterator iter_end = res->end();
while (iter != iter_end)
{
- if (iter->second && iter->second->getRefCount())
+ if (iter->second && iter->second->mRefCount)
{
char type = ' ';
char isNew = 'N';
@@ -1261,7 +1261,7 @@ static void showRes(std::string str, ResourceManager::Resources *res)
id = image->getGLImage();
logger->log("Resource %c%c: %s (%d) id=%d", type,
isNew, iter->second->getIdPath().c_str(),
- iter->second->getRefCount(), id);
+ iter->second->mRefCount, id);
}
++ iter;
}
diff --git a/src/particle/imageparticle.cpp b/src/particle/imageparticle.cpp
index 796d0cd72..a8b5cd1ae 100644
--- a/src/particle/imageparticle.cpp
+++ b/src/particle/imageparticle.cpp
@@ -39,7 +39,7 @@ ImageParticle::ImageParticle(Image *restrict const image) :
{
mImage->incRef();
- const std::string &restrict name = mImage->getIdPath();
+ const std::string &restrict name = mImage->mIdPath;
StringIntMapIter it
= ImageParticle::imageParticleCountByName.find(name);
if (it == ImageParticle::imageParticleCountByName.end())
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index d518a15a3..6bd07d1fb 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -101,7 +101,7 @@ Particle::~Particle()
{
if (mType == ParticleType::Image)
{
- const std::string &restrict name = mImage->getIdPath();
+ const std::string &restrict name = mImage->mIdPath;
StringIntMapIter it
= ImageParticle::imageParticleCountByName.find(name);
if (it != ImageParticle::imageParticleCountByName.end())
diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp
index 09008b363..1c9293063 100644
--- a/src/particle/particleemitter.cpp
+++ b/src/particle/particleemitter.cpp
@@ -527,7 +527,7 @@ void ParticleEmitter::createParticles(const int tick,
Particle *newParticle = nullptr;
if (mParticleImage)
{
- const std::string &name = mParticleImage->getIdPath();
+ const std::string &name = mParticleImage->mIdPath;
if (ImageParticle::imageParticleCountByName.find(name) ==
ImageParticle::imageParticleCountByName.end())
{
diff --git a/src/render/shaders/shadersmanager.cpp b/src/render/shaders/shadersmanager.cpp
index 90ee9c3e6..8b0d89269 100644
--- a/src/render/shaders/shadersmanager.cpp
+++ b/src/render/shaders/shadersmanager.cpp
@@ -117,8 +117,8 @@ ShaderProgram *ShadersManager::createProgram(const std::string &vertex,
mglGetProgramInfoLog(programId, len, &len, buf);
buf[len] = 0;
logger->log("Program '%s, %s' compilation error: %s",
- vertexShader->getIdPath().c_str(),
- fragmentShader->getIdPath().c_str(),
+ vertexShader->mIdPath.c_str(),
+ fragmentShader->mIdPath.c_str(),
buf);
delete [] buf;
mglDeleteProgram(programId);
diff --git a/src/resources/atlas/atlasmanager.cpp b/src/resources/atlas/atlasmanager.cpp
index 91749e597..4f38439ad 100644
--- a/src/resources/atlas/atlasmanager.cpp
+++ b/src/resources/atlas/atlasmanager.cpp
@@ -216,7 +216,7 @@ void AtlasManager::simpleSort(const std::string &restrict name,
if (img)
{
atlas->name = std::string("atlas_").append(name).append(
- "_").append(img->getIdPath());
+ "_").append(img->mIdPath);
break;
}
}
@@ -227,7 +227,7 @@ void AtlasManager::simpleSort(const std::string &restrict name,
if (img)
{
AtlasItem *const item = new AtlasItem(img);
- item->name = img->getIdPath();
+ item->name = img->mIdPath;
// start next line
if (x + img->mBounds.w > size)
{
@@ -244,7 +244,7 @@ void AtlasManager::simpleSort(const std::string &restrict name,
atlases.push_back(atlas);
atlas = new TextureAtlas;
atlas->name = std::string("atlas_").append(name).append(
- "_").append(img->getIdPath());
+ "_").append(img->mIdPath);
}
if (img->mBounds.h > tempHeight)
diff --git a/src/resources/atlas/atlasresource.cpp b/src/resources/atlas/atlasresource.cpp
index 06ae62542..eab7c660e 100644
--- a/src/resources/atlas/atlasresource.cpp
+++ b/src/resources/atlas/atlasresource.cpp
@@ -58,7 +58,7 @@ AtlasResource::~AtlasResource()
void AtlasResource::incRef()
{
- if (!getRefCount())
+ if (!mRefCount)
AtlasManager::injectToResources(this);
Resource::incRef();
}
@@ -66,7 +66,7 @@ void AtlasResource::incRef()
void AtlasResource::decRef()
{
Resource::decRef();
- if (!getRefCount())
+ if (!mRefCount)
AtlasManager::moveToDeleted(this);
}
diff --git a/src/resources/image/image.cpp b/src/resources/image/image.cpp
index f295be9cb..7d96cb0af 100644
--- a/src/resources/image/image.cpp
+++ b/src/resources/image/image.cpp
@@ -519,7 +519,7 @@ int Image::calcMemoryLocal() const
#ifdef USE_OPENGL
void Image::decRef()
{
- if (mGLImage && getRefCount() <= 1)
+ if (mGLImage && mRefCount <= 1)
OpenGLImageHelper::invalidate(mGLImage);
Resource::decRef();
}
diff --git a/src/resources/image/subimage.cpp b/src/resources/image/subimage.cpp
index 32e781af7..20ed676d7 100644
--- a/src/resources/image/subimage.cpp
+++ b/src/resources/image/subimage.cpp
@@ -97,13 +97,13 @@ SubImage::SubImage(Image *const parent,
mHasAlphaChannel = mParent->hasAlphaChannel();
mIsAlphaVisible = mHasAlphaChannel;
mAlphaChannel = mParent->SDLgetAlphaChannel();
- mSource = parent->getIdPath();
+ mSource = parent->mIdPath;
#ifdef DEBUG_IMAGES
logger->log("set name2 %p, %s", static_cast<void*>(this),
mSource.c_str());
#endif // DEBUG_IMAGES
#ifdef DEBUG_BIND_TEXTURE
- mIdPath = parent->getIdPath();
+ mIdPath = parent->mIdPath;
#endif // DEBUG_BIND_TEXTURE
}
else
@@ -159,13 +159,13 @@ SubImage::SubImage(Image *const parent,
mInternalBounds.y = mParent->mBounds.y;
mInternalBounds.w = mParent->mBounds.w;
mInternalBounds.h = mParent->mBounds.h;
- mSource = parent->getIdPath();
+ mSource = parent->mIdPath;
#ifdef DEBUG_IMAGES
logger->log("set name2 %p, %s", static_cast<void*>(this),
mSource.c_str());
#endif // DEBUG_IMAGES
#ifdef DEBUG_BIND_TEXTURE
- mIdPath = parent->getIdPath();
+ mIdPath = parent->mIdPath;
#endif // DEBUG_BIND_TEXTURE
}
else
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp
index 068972c70..c2f1e532e 100644
--- a/src/resources/imageset.cpp
+++ b/src/resources/imageset.cpp
@@ -50,7 +50,7 @@ ImageSet::ImageSet(Image *const img, const int width, const int height,
x += wAdd)
{
Image *const image = img->getSubImage(x, y, width, height);
- image->setNotCount(true);
+ image->mNotCount = true;
mImages.push_back(image);
}
}
diff --git a/src/resources/loaders/rescaledloader.cpp b/src/resources/loaders/rescaledloader.cpp
index e4a9112f1..8f77103ff 100644
--- a/src/resources/loaders/rescaledloader.cpp
+++ b/src/resources/loaders/rescaledloader.cpp
@@ -53,7 +53,7 @@ namespace
if (!rescaled)
{
reportAlways("Rescale image failed: %s",
- rl->image->getIdPath().c_str());
+ rl->image->mIdPath.c_str());
return nullptr;
}
return rescaled;
@@ -68,7 +68,7 @@ Image *Loader::getRescaled(const Image *const image,
if (!image)
return nullptr;
- const std::string idPath = image->getIdPath() + strprintf(
+ const std::string idPath = image->mIdPath + strprintf(
"_rescaled%dx%d", width, height);
const RescaledLoader rl = { image, width, height };
Image *const img = static_cast<Image *const>(
diff --git a/src/resources/loaders/subimageloader.cpp b/src/resources/loaders/subimageloader.cpp
index 804e957a5..c63bf74d6 100644
--- a/src/resources/loaders/subimageloader.cpp
+++ b/src/resources/loaders/subimageloader.cpp
@@ -57,7 +57,7 @@ namespace
if (!res)
{
reportAlways("SubImage loading error: %s",
- rl->parent->getSource().c_str());
+ rl->parent->mSource.c_str());
}
return res;
}
@@ -75,7 +75,7 @@ Image *Loader::getSubImage(Image *const parent,
const SubImageLoader rl = { parent, x, y, width, height};
- const std::string str = std::string(parent->getIdPath()).append(
+ const std::string str = std::string(parent->mIdPath).append(
",[").append(
toString(x)).append(
",").append(
diff --git a/src/resources/loaders/subimagesetloader.cpp b/src/resources/loaders/subimagesetloader.cpp
index 6ca43cb32..f721b1c2b 100644
--- a/src/resources/loaders/subimagesetloader.cpp
+++ b/src/resources/loaders/subimagesetloader.cpp
@@ -67,7 +67,7 @@ ImageSet *Loader::getSubImageSet(Image *const parent,
const SubImageSetLoader rl = { parent, width, height };
std::string str = std::string(
- parent->getIdPath()).append(
+ parent->mIdPath).append(
", set[").append(toString(
width)).append(
"x").append(toString(
diff --git a/src/resources/resource.h b/src/resources/resource.h
index 4b2f57229..a434606a0 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -73,61 +73,20 @@ class Resource notfinal : public MemoryCounter
*/
virtual void decRef();
- /**
- * Return the path identifying this resource.
- */
- const std::string &getIdPath() const noexcept2 A_WARN_UNUSED
- { return mIdPath; }
-
- void setIdPath(const std::string &path)
- { mIdPath = path; }
-
- /**
- * Return refCount for this resource.
- */
- unsigned getRefCount() const noexcept2 A_WARN_UNUSED
- { return mRefCount; }
-
- void setSource(const std::string &str) noexcept2
- { mSource = str; }
-
- std::string getSource() const noexcept2 A_WARN_UNUSED
- { return mSource; }
-
- void setProtected(const bool b) noexcept2
- { mProtected = b; }
-
- bool isProtected() const noexcept2
- { return mProtected; }
-
- void setNotCount(const bool b) noexcept2
- { mNotCount = b; }
-
int calcMemoryLocal() const override;
std::string getCounterName() const override
{ return mIdPath + "-" + mSource; }
-#ifdef DEBUG_DUMP_LEAKS
- bool getDumped() const noexcept2 A_WARN_UNUSED
- { return mDumped; }
-
- void setDumped(const bool n) noexcept2
- { mDumped = n; }
-#endif // DEBUG_DUMP_LEAKS
-
time_t mTimeStamp; /**< Time at which the resource was orphaned. */
-#ifndef UNITTESTS
- protected:
-#endif // UNITTESTS
std::string mIdPath; /**< Path identifying this resource. */
std::string mSource;
- private:
unsigned int mRefCount; /**< Reference count. */
bool mProtected;
bool mNotCount;
+
#ifdef DEBUG_DUMP_LEAKS
bool mDumped;
#endif // DEBUG_DUMP_LEAKS
diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp
index a5e5ebac5..5ddf08c97 100644
--- a/src/resources/resourcemanager/resourcemanager.cpp
+++ b/src/resources/resourcemanager/resourcemanager.cpp
@@ -73,11 +73,11 @@ void deleteResourceManager()
{
if (iter->second)
{
- if (iter->second->getRefCount())
+ if (iter->second->mRefCount)
{
logger->log(std::string("ResourceLeak: ").append(
- iter->second->getIdPath()).append(" (").append(
- toString(iter->second->getRefCount())).append(")"));
+ iter->second->mIdPath).append(" (").append(
+ toString(iter->second->mRefCount)).append(")"));
#ifdef UNITTESTS
status = true;
#endif // UNITTESTS
@@ -97,7 +97,7 @@ void deleteResourceManager()
while (iter != mResources.end())
{
#ifdef DEBUG_LEAKS
- if (iter->second && iter->second->getRefCount())
+ if (iter->second && iter->second->mRefCount)
{
++iter;
continue;
@@ -122,7 +122,7 @@ void deleteResourceManager()
while (iter != mResources.end())
{
#ifdef DEBUG_LEAKS
- if (iter->second && iter->second->getRefCount())
+ if (iter->second && iter->second->mRefCount)
{
++iter;
continue;
@@ -147,7 +147,7 @@ void deleteResourceManager()
while (iter != mResources.end())
{
#ifdef DEBUG_LEAKS
- if (iter->second && iter->second->getRefCount())
+ if (iter->second && iter->second->mRefCount)
{
++iter;
continue;
@@ -176,14 +176,14 @@ void cleanUp(Resource *const res)
if (!res)
return;
- const unsigned refCount = res->getRefCount();
+ const unsigned refCount = res->mRefCount;
if (refCount > 0)
{
logger->log("ResourceManager::~ResourceManager() cleaning up %u "
"reference%s to %s",
refCount,
(refCount == 1) ? "" : "s",
- res->getIdPath().c_str());
+ res->mIdPath.c_str());
}
delete res;
@@ -203,9 +203,9 @@ void cleanProtected()
++ iter;
continue;
}
- if (res->isProtected())
+ if (res->mProtected)
{
- res->setProtected(false);
+ res->mProtected = false;
res->decRef();
iter = mResources.begin();
continue;
@@ -267,24 +267,24 @@ void logResource(const Resource *const res)
const Image *const image = dynamic_cast<const Image *const>(res);
if (image)
{
- std::string src = image->getSource();
- const int count = image->getRefCount();
+ std::string src = image->mSource;
+ const int count = image->mRefCount;
if (count)
src.append(" ").append(toString(count));
- logger->log("resource(%s, %u) %s", res->getIdPath().c_str(),
+ logger->log("resource(%s, %u) %s", res->mIdPath.c_str(),
image->getGLImage(), src.c_str());
}
else
{
- std::string src = res->getSource();
- const int count = res->getRefCount();
+ std::string src = res->mSource;
+ const int count = res->mRefCount;
if (count > 0)
src.append(" ").append(toString(count));
- logger->log("resource(%s) %s", res->getIdPath().c_str(), src.c_str());
+ logger->log("resource(%s) %s", res->mIdPath.c_str(), src.c_str());
}
#else // USE_OPENGL
- logger->log("resource(%s)", res->getIdPath().c_str());
+ logger->log("resource(%s)", res->mIdPath.c_str());
#endif // USE_OPENGL
}
@@ -319,7 +319,7 @@ void clearDeleted(const bool full)
std::set<Resource*>::iterator resDelIter = mDeletedResources.begin();
while (resDelIter != mDeletedResources.end())
{
- if (!(*resDelIter)->getRefCount())
+ if (!(*resDelIter)->mRefCount)
{
status = true;
Resource *res = *resDelIter;
@@ -354,10 +354,10 @@ bool addResource(const std::string &idPath,
if (resource)
{
resource->incRef();
- resource->setIdPath(idPath);
+ resource->mIdPath = idPath;
#ifdef DEBUG_IMAGES
logger->log("set name %p, %s", static_cast<void*>(resource),
- resource->getIdPath().c_str());
+ resource->mIdPath.c_str());
#endif // DEBUG_IMAGES
mResources[idPath] = resource;
@@ -429,10 +429,10 @@ Resource *get(const std::string &idPath,
if (resource)
{
resource->incRef();
- resource->setIdPath(idPath);
+ resource->mIdPath = idPath;
#ifdef DEBUG_IMAGES
logger->log("set name %p, %s", static_cast<void*>(resource),
- resource->getIdPath().c_str());
+ resource->mIdPath.c_str());
#endif // DEBUG_IMAGES
mResources[idPath] = resource;
@@ -448,10 +448,10 @@ Resource *get(const std::string &idPath,
if (resource)
{
resource->incRef();
- resource->setIdPath(idPath);
+ resource->mIdPath = idPath;
#ifdef DEBUG_IMAGES
logger->log("set name %p, %s", static_cast<void*>(resource),
- resource->getIdPath().c_str());
+ resource->mIdPath.c_str());
#endif // DEBUG_IMAGES
}
else
@@ -479,19 +479,19 @@ void release(Resource *const res)
return;
}
- ResourceIterator resIter = mResources.find(res->getIdPath());
+ ResourceIterator resIter = mResources.find(res->mIdPath);
if (resIter == mResources.end())
{
reportAlways("no resource in cache: %s",
- res->getIdPath().c_str());
+ res->mIdPath.c_str());
delete res;
return;
}
if (resIter->second != res)
{
reportAlways("in cache other image: %s",
- res->getIdPath().c_str());
+ res->mIdPath.c_str());
delete res;
return;
}
@@ -518,11 +518,11 @@ void moveToDeleted(Resource *const res)
return;
bool found(false);
- const int count = res->getRefCount();
+ const int count = res->mRefCount;
if (count == 1)
logResource(res);
res->decRef();
- ResourceIterator resIter = mResources.find(res->getIdPath());
+ ResourceIterator resIter = mResources.find(res->mIdPath);
if (resIter != mResources.end() && resIter->second == res)
{
mResources.erase(resIter);
@@ -530,7 +530,7 @@ void moveToDeleted(Resource *const res)
}
else
{
- resIter = mOrphanedResources.find(res->getIdPath());
+ resIter = mOrphanedResources.find(res->mIdPath);
if (resIter != mOrphanedResources.end() && resIter->second == res)
{
mOrphanedResources.erase(resIter);
@@ -551,19 +551,19 @@ void decRefDelete(Resource *const res)
if (!res)
return;
- const int count = res->getRefCount();
+ const int count = res->mRefCount;
if (count == 1)
{
logResource(res);
- ResourceIterator resIter = mResources.find(res->getIdPath());
+ ResourceIterator resIter = mResources.find(res->mIdPath);
if (resIter != mResources.end() && resIter->second == res)
{
mResources.erase(resIter);
}
else
{
- resIter = mOrphanedResources.find(res->getIdPath());
+ resIter = mOrphanedResources.find(res->mIdPath);
if (resIter != mOrphanedResources.end() && resIter->second == res)
mOrphanedResources.erase(resIter);
}
@@ -595,11 +595,11 @@ void deleteInstance()
const Resource *const res = iter->second;
if (res)
{
- if (res->getRefCount())
+ if (res->mRefCount)
{
logger->log(std::string("ResourceLeak: ").append(
- res->getIdPath()).append(" (").append(toString(
- res->getRefCount())).append(")"));
+ res->mIdPath).append(" (").append(toString(
+ res->mRefCount)).append(")"));
#ifdef UNITTESTS
status = true;
#endif // UNITTESTS
diff --git a/src/resources/resourcemanager/resourcemanager_unittest.cc b/src/resources/resourcemanager/resourcemanager_unittest.cc
index 8c8d72868..08d36da9c 100644
--- a/src/resources/resourcemanager/resourcemanager_unittest.cc
+++ b/src/resources/resourcemanager/resourcemanager_unittest.cc
@@ -149,13 +149,13 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(testResouceCounter == 1);
REQUIRE(res != nullptr);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
res->decRef();
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
}
SECTION("resourcemanager get 2")
@@ -165,9 +165,9 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
- res->setSource("source 1");
- REQUIRE(res->getSource() == "source 1");
+ REQUIRE(res->mRefCount == 1);
+ res->mSource = "source 1";
+ REQUIRE(res->mSource == "source 1");
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
@@ -176,17 +176,17 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res2 != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 2);
- REQUIRE(res2->getRefCount() == 2);
- REQUIRE(res->getIdPath() == res2->getIdPath());
- REQUIRE(res2->getSource() == "source 1");
+ REQUIRE(res->mRefCount == 2);
+ REQUIRE(res2->mRefCount == 2);
+ REQUIRE(res->mIdPath == res2->mIdPath);
+ REQUIRE(res2->mSource == "source 1");
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res2);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
res->decRef();
res2->decRef();
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
}
SECTION("resourcemanager get 3")
@@ -196,17 +196,17 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
- res->setSource("source 1");
+ res->mSource = "source 1";
res->decRef();
REQUIRE(ResourceManager::getResources().size() == 0 + resSize);
REQUIRE(ResourceManager::getOrphanedResources()["test1"] == res);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
}
SECTION("resourcemanager get 4")
@@ -216,14 +216,14 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
- res->setSource("source 1");
+ res->mSource = "source 1";
res->decRef();
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
REQUIRE(ResourceManager::getResources().size() == 0 + resSize);
REQUIRE(ResourceManager::getOrphanedResources()["test1"] == res);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
@@ -232,15 +232,15 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res2 != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res2->getRefCount() == 1);
- REQUIRE(res->getIdPath() == res2->getIdPath());
- REQUIRE(res2->getSource() == "source 1");
+ REQUIRE(res2->mRefCount == 1);
+ REQUIRE(res->mIdPath == res2->mIdPath);
+ REQUIRE(res2->mSource == "source 1");
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res2);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
res2->decRef();
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
}
SECTION("resourcemanager get 5")
@@ -251,14 +251,14 @@ TEST_CASE("resourcemanager", "resourcemanager")
REQUIRE(ResourceManager::isInCache("test1") == true);
REQUIRE(res != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
- res->setSource("source 1");
+ res->mSource = "source 1";
res->decRef();
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
REQUIRE(ResourceManager::getResources().size() == 0 + resSize);
REQUIRE(ResourceManager::getOrphanedResources().size() == 1);
REQUIRE(ResourceManager::getOrphanedResources()["test1"] == res);
@@ -277,14 +277,14 @@ TEST_CASE("resourcemanager", "resourcemanager")
REQUIRE(ResourceManager::isInCache("test1") == true);
REQUIRE(res2 != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res2->getRefCount() == 1);
- REQUIRE(res2->getSource() == "");
+ REQUIRE(res2->mRefCount == 1);
+ REQUIRE(res2->mSource == "");
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res2);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
res2->decRef();
- REQUIRE(res2->getRefCount() == 0);
+ REQUIRE(res2->mRefCount == 0);
}
SECTION("resourcemanager get 6")
@@ -294,8 +294,8 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
- res->setSource("source 1");
+ REQUIRE(res->mRefCount == 1);
+ res->mSource = "source 1";
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
@@ -305,8 +305,8 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res2 != nullptr);
REQUIRE(testResouceCounter == 2);
- REQUIRE(res2->getRefCount() == 1);
- REQUIRE(res2->getSource() == "");
+ REQUIRE(res2->mRefCount == 1);
+ REQUIRE(res2->mSource == "");
REQUIRE(ResourceManager::getResources().size() == 2 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getResources()["test2"] == res2);
@@ -314,8 +314,8 @@ TEST_CASE("resourcemanager", "resourcemanager")
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
res->decRef();
res2->decRef();
- REQUIRE(res->getRefCount() == 0);
- REQUIRE(res2->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
+ REQUIRE(res2->mRefCount == 0);
}
SECTION("resourcemanager getFromCache 1")
@@ -325,7 +325,7 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
@@ -333,16 +333,16 @@ TEST_CASE("resourcemanager", "resourcemanager")
Resource *const res2 = ResourceManager::getFromCache("test1");
REQUIRE(res2 != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res2->getRefCount() == 2);
+ REQUIRE(res2->mRefCount == 2);
REQUIRE(res == res2);
- REQUIRE(res2->getSource() == "");
+ REQUIRE(res2->mSource == "");
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res2);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
res->decRef();
res->decRef();
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
}
SECTION("resourcemanager getFromCache 2")
@@ -352,25 +352,25 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
res->decRef();
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
Resource *const res2 = ResourceManager::getFromCache("test1");
REQUIRE(res2 != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res2->getRefCount() == 1);
+ REQUIRE(res2->mRefCount == 1);
REQUIRE(res == res2);
- REQUIRE(res2->getSource() == "");
+ REQUIRE(res2->mSource == "");
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res2);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
res->decRef();
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
}
SECTION("resourcemanager getFromCache 3")
@@ -380,8 +380,8 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
- res->setSource("source 1");
+ REQUIRE(res->mRefCount == 1);
+ res->mSource = "source 1";
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
@@ -391,8 +391,8 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res2 != nullptr);
REQUIRE(testResouceCounter == 2);
- REQUIRE(res2->getRefCount() == 1);
- REQUIRE(res2->getSource() == "");
+ REQUIRE(res2->mRefCount == 1);
+ REQUIRE(res2->mSource == "");
REQUIRE(ResourceManager::getResources().size() == 2 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getResources()["test2"] == res2);
@@ -406,8 +406,8 @@ TEST_CASE("resourcemanager", "resourcemanager")
REQUIRE(testResouceCounter == 2);
REQUIRE(res == resC);
REQUIRE(res2 == res2C);
- REQUIRE(resC->getRefCount() == 2);
- REQUIRE(res2C->getRefCount() == 2);
+ REQUIRE(resC->mRefCount == 2);
+ REQUIRE(res2C->mRefCount == 2);
REQUIRE(ResourceManager::getResources().size() == 2 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == resC);
REQUIRE(ResourceManager::getResources()["test2"] == res2C);
@@ -418,8 +418,8 @@ TEST_CASE("resourcemanager", "resourcemanager")
res->decRef();
res2->decRef();
res2->decRef();
- REQUIRE(res->getRefCount() == 0);
- REQUIRE(res2->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
+ REQUIRE(res2->mRefCount == 0);
}
SECTION("resourcemanager addResource 1")
@@ -429,13 +429,13 @@ TEST_CASE("resourcemanager", "resourcemanager")
REQUIRE(testResouceCounter == 1);
ResourceManager::addResource("test1", res);
REQUIRE(res != nullptr);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
res->decRef();
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
}
SECTION("resourcemanager isInCache 1")
@@ -449,13 +449,13 @@ TEST_CASE("resourcemanager", "resourcemanager")
REQUIRE(ResourceManager::isInCache("test2") == false);
REQUIRE(testResouceCounter == 1);
REQUIRE(res != nullptr);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
res->decRef();
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
}
SECTION("resourcemanager getTempResource 1")
@@ -466,7 +466,7 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(res != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
@@ -475,15 +475,15 @@ TEST_CASE("resourcemanager", "resourcemanager")
REQUIRE(ResourceManager::getTempResource("test2") == nullptr);
REQUIRE(res2 != nullptr);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res2->getRefCount() == 1);
+ REQUIRE(res2->mRefCount == 1);
REQUIRE(res == res2);
- REQUIRE(res2->getSource() == "");
+ REQUIRE(res2->mSource == "");
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res2);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
res->decRef();
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
}
SECTION("resourcemanager moveToDeleted 1")
@@ -494,7 +494,7 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(testResouceCounter == 1);
REQUIRE(res != nullptr);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
@@ -515,14 +515,14 @@ TEST_CASE("resourcemanager", "resourcemanager")
res->incRef();
REQUIRE(testResouceCounter == 1);
REQUIRE(res != nullptr);
- REQUIRE(res->getRefCount() == 2);
+ REQUIRE(res->mRefCount == 2);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
ResourceManager::moveToDeleted(res);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 0 + resSize);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().size() == 1);
@@ -537,7 +537,7 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(testResouceCounter == 1);
REQUIRE(res != nullptr);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
@@ -545,7 +545,7 @@ TEST_CASE("resourcemanager", "resourcemanager")
res->decRef();
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 0);
+ REQUIRE(res->mRefCount == 0);
REQUIRE(ResourceManager::getResources().size() == 0 + resSize);
REQUIRE(ResourceManager::getOrphanedResources().size() == 1);
REQUIRE(ResourceManager::getOrphanedResources()["test1"] == res);
@@ -566,7 +566,7 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(testResouceCounter == 1);
REQUIRE(res != nullptr);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
@@ -587,7 +587,7 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(testResouceCounter == 1);
REQUIRE(res != nullptr);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
@@ -610,12 +610,12 @@ TEST_CASE("resourcemanager", "resourcemanager")
TestLoader::load, &rl);
REQUIRE(testResouceCounter == 1);
REQUIRE(res != nullptr);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
- res->setProtected(true);
+ res->mProtected = true;
ResourceManager::cleanProtected();
REQUIRE(testResouceCounter == 1);
@@ -635,21 +635,21 @@ TEST_CASE("resourcemanager", "resourcemanager")
res->incRef();
REQUIRE(testResouceCounter == 1);
REQUIRE(res != nullptr);
- REQUIRE(res->getRefCount() == 2);
+ REQUIRE(res->mRefCount == 2);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
ResourceManager::moveToDeleted(res);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 0 + resSize);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().size() == 1);
ResourceManager::clearDeleted();
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 0 + resSize);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().size() == 1);
@@ -665,14 +665,14 @@ TEST_CASE("resourcemanager", "resourcemanager")
res->incRef();
REQUIRE(testResouceCounter == 1);
REQUIRE(res != nullptr);
- REQUIRE(res->getRefCount() == 2);
+ REQUIRE(res->mRefCount == 2);
REQUIRE(ResourceManager::getResources().size() == 1 + resSize);
REQUIRE(ResourceManager::getResources()["test1"] == res);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().empty() == true);
ResourceManager::moveToDeleted(res);
REQUIRE(testResouceCounter == 1);
- REQUIRE(res->getRefCount() == 1);
+ REQUIRE(res->mRefCount == 1);
REQUIRE(ResourceManager::getResources().size() == 0 + resSize);
REQUIRE(ResourceManager::getOrphanedResources().empty() == true);
REQUIRE(ResourceManager::getDeletedResources().size() == 1);
diff --git a/src/resources/sprite/animatedsprite.cpp b/src/resources/sprite/animatedsprite.cpp
index 3e9250e13..7b6900510 100644
--- a/src/resources/sprite/animatedsprite.cpp
+++ b/src/resources/sprite/animatedsprite.cpp
@@ -405,7 +405,7 @@ std::string AnimatedSprite::getIdPath() const restrict2
{
if (!mSprite)
return "";
- return mSprite->getIdPath();
+ return mSprite->mIdPath;
}
const Image* AnimatedSprite::getImage() const restrict2 noexcept2
diff --git a/src/resources/sprite/spritedef.cpp b/src/resources/sprite/spritedef.cpp
index 2b79c3806..263caebe2 100644
--- a/src/resources/sprite/spritedef.cpp
+++ b/src/resources/sprite/spritedef.cpp
@@ -125,7 +125,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile,
if (prot)
{
def->incRef();
- def->setProtected(true);
+ def->mProtected = true;
}
doc->decRef();
BLOCK_END("SpriteDef::load")
@@ -269,7 +269,7 @@ const ImageSet *SpriteDef::getImageSet(const std::string &imageSetName) const
reportAlways("%s: Imageset \"%s\" not defined in %s",
mSource.c_str(),
imageSetName.c_str(),
- getIdPath().c_str());
+ mIdPath.c_str());
return nullptr;
}
return si->second;
@@ -291,7 +291,7 @@ void SpriteDef::loadAction(XmlNodeConstPtr node,
reportAlways("%s: Unknown action \"%s\" defined in %s",
mSource.c_str(),
actionName.c_str(),
- getIdPath().c_str());
+ mIdPath.c_str());
return;
}
Action *const action = new Action(actionName);
@@ -333,7 +333,7 @@ void SpriteDef::loadAnimation(XmlNodeConstPtr animationNode,
reportAlways("%s: Unknown direction \"%s\" used in %s",
mSource.c_str(),
directionName.c_str(),
- getIdPath().c_str());
+ mIdPath.c_str());
return;
}