diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index 9c608cb82..57790cd1b 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -335,10 +335,17 @@ bool ModuleManager::SetPriority(Module* mod, Implementation i, PriorityState s, { /* 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) + { + if (( j + incrmnt > EventHandlers[i].size() - 1) || (j - incrmnt < 0)) + continue; + std::swap(EventHandlers[i][j], EventHandlers[i][j+incrmnt]); + } } return true; |