summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp4
-rw-r--r--src/commands.cpp5
-rw-r--r--src/resources/resourcemanager.cpp7
-rw-r--r--src/resources/resourcemanager.h2
4 files changed, 13 insertions, 5 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 705670277..168dd3df9 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1209,7 +1209,7 @@ int Client::gameExec()
{
BLOCK_START("Client::gameExec STATE_CHOOSE_SERVER")
logger->log1("State: CHOOSE SERVER");
- const ResourceManager *const resman
+ ResourceManager *const resman
= ResourceManager::getInstance();
if (mOptions.dataPath.empty())
{
@@ -1235,6 +1235,8 @@ int Client::gameExec()
+ mUpdatesDir + "/local/");
}
+ resman->clearCache();
+
loginData.clearUpdateHost();
serverVersion = 0;
diff --git a/src/commands.cpp b/src/commands.cpp
index 2421e63f4..ab2558e2c 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -359,10 +359,7 @@ impHandler0(clear)
impHandler0(cleanGraphics)
{
- ResourceManager *const resman = ResourceManager::getInstance();
- resman->cleanProtected();
- while (resman->cleanOrphans(true))
- continue;
+ ResourceManager::getInstance()->clearCache();
if (debugChatTab)
{
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index c8230550a..83beb8e9c 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -1151,3 +1151,10 @@ void ResourceManager::deleteFilesInDirectory(std::string path)
if (dir)
closedir(dir);
}
+
+void ResourceManager::clearCache()
+{
+ cleanProtected();
+ while (cleanOrphans(true))
+ continue;
+}
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index d45a4ba11..d56406bec 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -322,6 +322,8 @@ class ResourceManager final
Resource *getTempResource(const std::string &idPath) A_WARN_UNUSED;
+ void clearCache();
+
static void addDelayedAnimation(AnimationDelayLoad *const animation)
{ mDelayedAnimations.push_back(animation); }