diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-26 18:33:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-26 18:33:37 +0300 |
commit | 2f345a6bf8385bf0874b976d0da9790faa4ee0ff (patch) | |
tree | 741ea8e5a165dbe8adb8437ed876fe82ae77d9fe | |
parent | 662ea582cd57827475062fb6b728da6c21c14181 (diff) | |
download | manaplus-2f345a6bf8385bf0874b976d0da9790faa4ee0ff.tar.gz manaplus-2f345a6bf8385bf0874b976d0da9790faa4ee0ff.tar.bz2 manaplus-2f345a6bf8385bf0874b976d0da9790faa4ee0ff.tar.xz manaplus-2f345a6bf8385bf0874b976d0da9790faa4ee0ff.zip |
Move chat command /cacheinfo into actions.
-rw-r--r-- | src/actions/actions.cpp | 39 | ||||
-rw-r--r-- | src/actions/actions.h | 1 | ||||
-rw-r--r-- | src/commands.cpp | 39 | ||||
-rw-r--r-- | src/commands.h | 5 | ||||
-rw-r--r-- | src/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 9 | ||||
-rw-r--r-- | src/input/pages/other.cpp | 6 |
7 files changed, 57 insertions, 43 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 97c792470..dba8da43f 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -635,4 +635,43 @@ impHandler0(priceSave) return false; } +impHandler0(cacheInfo) +{ + if (!chatWindow || !debugChatTab) + return false; + +/* + Font *const font = chatWindow->getFont(); + if (!font) + return; + + const TextChunkList *const cache = font->getCache(); + if (!cache) + return; + + unsigned int all = 0; + debugChatTab->chatLog(_("font cache size")); + std::string str; + for (int f = 0; f < 256; f ++) + { + if (!cache[f].size) + { + const unsigned int sz = static_cast<int>(cache[f].size); + all += sz; + str.append(strprintf("%d: %u, ", f, sz)); + } + } + debugChatTab->chatLog(str); + debugChatTab->chatLog(strprintf("%s %d", _("Cache size:"), all)); +#ifdef DEBUG_FONT_COUNTERS + debugChatTab->chatLog(""); + debugChatTab->chatLog(strprintf("%s %d", + _("Created:"), font->getCreateCounter())); + debugChatTab->chatLog(strprintf("%s %d", + _("Deleted:"), font->getDeleteCounter())); +#endif +*/ + return true; +} + } // namespace Actions diff --git a/src/actions/actions.h b/src/actions/actions.h index 4e0155556..691892bd8 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -63,6 +63,7 @@ namespace Actions decHandler(trade); decHandler(priceLoad); decHandler(priceSave); + decHandler(cacheInfo); } // namespace Actions #undef decHandler diff --git a/src/commands.cpp b/src/commands.cpp index f70564822..859eff8e4 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -358,45 +358,6 @@ impHandler(addIgnoreAttack) return true; } -impHandler0(cacheInfo) -{ - if (!chatWindow || !debugChatTab) - return false; - -/* - Font *const font = chatWindow->getFont(); - if (!font) - return; - - const TextChunkList *const cache = font->getCache(); - if (!cache) - return; - - unsigned int all = 0; - debugChatTab->chatLog(_("font cache size")); - std::string str; - for (int f = 0; f < 256; f ++) - { - if (!cache[f].size) - { - const unsigned int sz = static_cast<int>(cache[f].size); - all += sz; - str.append(strprintf("%d: %u, ", f, sz)); - } - } - debugChatTab->chatLog(str); - debugChatTab->chatLog(strprintf("%s %d", _("Cache size:"), all)); -#ifdef DEBUG_FONT_COUNTERS - debugChatTab->chatLog(""); - debugChatTab->chatLog(strprintf("%s %d", - _("Created:"), font->getCreateCounter())); - debugChatTab->chatLog(strprintf("%s %d", - _("Deleted:"), font->getDeleteCounter())); -#endif -*/ - return true; -} - impHandler0(serverIgnoreAll) { Net::getChatHandler()->ignoreAll(); diff --git a/src/commands.h b/src/commands.h index c658a229f..832895ba2 100644 --- a/src/commands.h +++ b/src/commands.h @@ -76,7 +76,6 @@ namespace Commands decHandler(dumpOGL); decHandler(dumpGL); decHandler(dumpMods); - decHandler(cacheInfo); decHandler(execute); decHandler(testsdlfont); decHandler(enableHighlight); @@ -100,8 +99,7 @@ namespace Commands enum { - COMMAND_CACHEINFO = 0, - COMMAND_DISCONNECT, + COMMAND_DISCONNECT = 0, COMMAND_UNDRESS, COMMAND_ATTACK, COMMAND_DIRS, @@ -149,7 +147,6 @@ enum static const CommandInfo commands[] = { - {"cacheinfo", &Commands::cacheInfo, -1, false}, {"disconnect", &Commands::disconnect, -1, false}, {"undress", &Commands::undress, -1, true}, {"attack", &Commands::attack, -1, true}, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 280a16970..f1c7becea 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -382,6 +382,7 @@ namespace InputAction TRADE, PRICE_LOAD, PRICE_SAVE, + CACHE_INFO, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index fd0d573d5..c6fb36f1f 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3207,6 +3207,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputAction::NO_VALUE, 50, InputCondition::INGAME, "pricesave", + false}, + {"keyCacheInfo", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::cacheInfo, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "cacheinfo", false} }; diff --git a/src/input/pages/other.cpp b/src/input/pages/other.cpp index 786a1974d..52970cd8e 100644 --- a/src/input/pages/other.cpp +++ b/src/input/pages/other.cpp @@ -250,6 +250,12 @@ SetupActionData setupActionDataOther[] = "", }, { + // TRANSLATORS: input action name + N_("Print debug cache info"), + InputAction::CACHE_INFO, + "", + }, + { "", InputAction::NO_VALUE, "" |