aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-10-19 09:43:31 +0000
committerMax Horn2010-10-19 09:43:31 +0000
commit88bca8e13d0d385161bd8aee95998345a6aa516e (patch)
treeabed137cd34a063608e02ace3e83e271e2781dc5
parentf020ec90779dd4db968df7dfd1e2961434ea3fc6 (diff)
downloadscummvm-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
-rw-r--r--engines/sword25/kernel/kernel.h12
-rw-r--r--engines/sword25/math/walkregion.cpp11
2 files changed, 11 insertions, 12 deletions
diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h
index aaf4d2bb16..9a115db908 100644
--- a/engines/sword25/kernel/kernel.h
+++ b/engines/sword25/kernel/kernel.h
@@ -349,18 +349,6 @@ public:
Service*(*CreateMethod)(Kernel *);
};
-template<class T>
-void ReverseArray(Common::Array<T> &Arr) {
- if (Arr.size() < 2)
- return;
-
- for (uint i = 0; i <= (Arr.size() / 2 - 1); ++i) {
- T temp = Arr[i];
- Arr[i] = Arr[Arr.size() - i - 1];
- Arr[Arr.size() - i - 1] = temp;
- }
-}
-
} // End of namespace Sword25
#endif
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