diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/commands.h | 1 | ||||
-rw-r--r-- | src/enums/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 6 | ||||
-rw-r--r-- | src/progs/dyecmd/actions/commands.cpp | 1 | ||||
-rw-r--r-- | src/progs/manaplus/actions/commands.cpp | 15 |
5 files changed, 24 insertions, 0 deletions
diff --git a/src/actions/commands.h b/src/actions/commands.h index 80ac78a4e..3b675c848 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -163,6 +163,7 @@ namespace Actions decHandler(movePriorityAttackUp); decHandler(movePriorityAttackDown); decHandler(addSkillShortcut); + decHandler(trimMemory); } // namespace Actions #undef decHandler diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index c21506729..a1689e7a8 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -710,6 +710,7 @@ enumStart(InputAction) PET_UNEQUIP, ADD_SKILL_SHORTCUT, WINDOW_CLAN, + TRIM_MEMORY, TOTAL } enumEnd(InputAction); diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index f215a403b..ba8830130 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5966,6 +5966,12 @@ static const InputActionData inputActionData "clanwindow|clan", UseArgs_false, Protected_false}, + {"keyTrimMemory", + defaultAction(&Actions::trimMemory), + InputCondition::KEY_DOWN | InputCondition::INGAME, + "trim|trimmemory|memorytrim", + UseArgs_false, + Protected_true}, }; #undef defaultAction diff --git a/src/progs/dyecmd/actions/commands.cpp b/src/progs/dyecmd/actions/commands.cpp index 217aa5b53..5ee4d3089 100644 --- a/src/progs/dyecmd/actions/commands.cpp +++ b/src/progs/dyecmd/actions/commands.cpp @@ -163,5 +163,6 @@ impHandlerVoid(moveAttackDown) impHandlerVoid(movePriorityAttackUp) impHandlerVoid(movePriorityAttackDown) impHandlerVoid(addSkillShortcut) +impHandlerVoid(trimMemory) } // namespace Actions diff --git a/src/progs/manaplus/actions/commands.cpp b/src/progs/manaplus/actions/commands.cpp index ff24d6bc3..57f5125b2 100644 --- a/src/progs/manaplus/actions/commands.cpp +++ b/src/progs/manaplus/actions/commands.cpp @@ -85,6 +85,8 @@ #include "utils/parameters.h" #include "utils/process.h" +#include <malloc.h> + #include "debug.h" namespace Actions @@ -2200,4 +2202,17 @@ impHandler(addSkillShortcut) return true; } +impHandler0(trimMemory) +{ +#ifdef HAVE_MALLOC_TRIM + malloc_trim(0); +#else + localChatTab->chatLog(_("Trim memory not supported"), + ChatMsgType::BY_SERVER, + IgnoreRecord_false, + TryRemoveColors_true); +#endif + return true; +} + } // namespace Actions |