diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-06-24 16:43:34 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-06-24 16:43:34 +0000 |
commit | 20b31c2b688086abf5891879d73f0c6194f52392 (patch) | |
tree | 45b111b42355370505229265eb8856291e1493a7 | |
parent | 8a3bcebffc063457b0e49f87ac5d80d18994e3f0 (diff) |
Module priority 'shuffler' suggestion from Phoenix, needs some testing but works ok for him
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9933 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules.cpp | 9 |
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; } |