summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-03 01:17:50 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-03 01:17:50 +0300
commit5334fecf60a7cbad1ada8268b122bbce4af9b0d5 (patch)
tree5a27b7e8fe972bc7fe1fd0916fe9f7fd32e253e3
parent60cce948bc8419c15a7fe8ab9669f4ae87c5ef76 (diff)
downloadmv-5334fecf60a7cbad1ada8268b122bbce4af9b0d5.tar.gz
mv-5334fecf60a7cbad1ada8268b122bbce4af9b0d5.tar.bz2
mv-5334fecf60a7cbad1ada8268b122bbce4af9b0d5.tar.xz
mv-5334fecf60a7cbad1ada8268b122bbce4af9b0d5.zip
Add chat command to clean graphics cache.
New chat command: /cleangraphics This command can be usefull for item or monster development.
-rw-r--r--src/commands.cpp12
-rw-r--r--src/commands.h2
-rw-r--r--src/gui/chatwindow.cpp1
3 files changed, 14 insertions, 1 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index c86497f15..0850ba909 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -59,10 +59,11 @@
#ifdef DEBUG_DUMP_LEAKS1
#include "resources/image.h"
#include "resources/resource.h"
-#include "resources/resourcemanager.h"
#include "resources/subimage.h"
#endif
+#include "resources/resourcemanager.h"
+
#include "utils/gettext.h"
#include "utils/process.h"
@@ -344,6 +345,15 @@ impHandler0(clear)
chatWindow->clearTab();
}
+impHandler0(cleanGraphics)
+{
+ ResourceManager *const resman = ResourceManager::getInstance();
+ while(resman->cleanOrphans(true));
+
+ if (debugChatTab)
+ debugChatTab->chatLog("cache cleaned");
+}
+
impHandler(join)
{
if (!tab)
diff --git a/src/commands.h b/src/commands.h
index 0b413561f..fbd2929ec 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -55,6 +55,7 @@ namespace Commands
decHandler(join);
decHandler(listChannels);
decHandler(clear);
+ decHandler(cleanGraphics);
decHandler(createParty);
decHandler(createGuild);
decHandler(party);
@@ -140,6 +141,7 @@ static const CommandInfo commands[] =
{"join", &Commands::join},
{"list", &Commands::listChannels},
{"clear", &Commands::clear},
+ {"cleangraphics", &Commands::cleanGraphics},
{"createparty", &Commands::createParty},
{"createguild", &Commands::createGuild},
{"party", &Commands::party},
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 12b4ee17b..c900da9e8 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -289,6 +289,7 @@ void ChatWindow::fillCommands()
mCommands.push_back("/away ");
mCommands.push_back("/closeall");
mCommands.push_back("/clear");
+ mCommands.push_back("/cleangraphics");
mCommands.push_back("/create ");
mCommands.push_back("/close");
mCommands.push_back("/cacheinfo");