From 88bca8e13d0d385161bd8aee95998345a6aa516e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 19 Oct 2010 09:43:31 +0000 Subject: SWORD25: Optimize ReverseArray, move it to only place it is used svn-id: r53606 --- engines/sword25/math/walkregion.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'engines/sword25/math') 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 +void ReverseArray(Common::Array &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 -- cgit v1.2.3