summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index a45ec21ec..9c608cb82 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -332,7 +332,14 @@ bool ModuleManager::SetPriority(Module* mod, Implementation i, PriorityState s,
/* Do we need to swap? */
if (swap && (swap_pos != source))
- std::swap(EventHandlers[i][swap_pos], EventHandlers[i][source]);
+ {
+ /* Suggestion from Phoenix, "shuffle" the modules to better retain call order */
+ int incrmnt = 1;
+ if (source > swap_pos)
+ incrmnt = -1;
+ for (unsigned int j = source; j != swap_pos; j += incrmnt)
+ std::swap(EventHandlers[i][j], EventHandlers[i][j+incrmnt]);
+ }
return true;
}