diff options
author | Max Horn | 2010-10-19 09:43:31 +0000 |
---|---|---|
committer | Max Horn | 2010-10-19 09:43:31 +0000 |
commit | 88bca8e13d0d385161bd8aee95998345a6aa516e (patch) | |
tree | abed137cd34a063608e02ace3e83e271e2781dc5 /engines/sword25/math | |
parent | f020ec90779dd4db968df7dfd1e2961434ea3fc6 (diff) | |
download | scummvm-rg350-88bca8e13d0d385161bd8aee95998345a6aa516e.tar.gz scummvm-rg350-88bca8e13d0d385161bd8aee95998345a6aa516e.tar.bz2 scummvm-rg350-88bca8e13d0d385161bd8aee95998345a6aa516e.zip |
SWORD25: Optimize ReverseArray, move it to only place it is used
svn-id: r53606
Diffstat (limited to 'engines/sword25/math')
-rw-r--r-- | engines/sword25/math/walkregion.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/engines/sword25/math/walkregion.cpp b/engines/sword25/math/walkregion.cpp index d47ed3d11f..3f4ad3c030 100644 --- a/engines/sword25/math/walkregion.cpp +++ b/engines/sword25/math/walkregion.cpp @@ -164,6 +164,17 @@ static void relaxEndPoint(const Vertex &curNodePos, } } +template<class T> +void ReverseArray(Common::Array<T> &arr) { + const uint size = arr.size(); + if (size < 2) + return; + + for (uint i = 0; i <= (size / 2 - 1); ++i) { + SWAP(arr[i], arr[size - i - 1]); + } +} + bool WalkRegion::findPath(const Vertex &start, const Vertex &end, BS_Path &path) const { // This is an implementation of Dijkstra's algorithm |