aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSubv <s.v.h21@hotmail.com>2012-09-09 15:14:02 -0500
committerSubv <s.v.h21@hotmail.com>2012-09-09 15:14:02 -0500
commit8966347a416b9e2fba43bc3ff7043d946cfe10c4 (patch)
treea3f44041cef42bda7bf5c5f8e5186662a1b2d270 /src
parent50327363ca764347b508d7b5e736db631f2be45c (diff)
Core/MMaps: Added a little workaround to prevent the crash.
ref issue #7631
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Movement/PathGenerator.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp
index 6f505de25cd..9635399e71f 100644
--- a/src/server/game/Movement/PathGenerator.cpp
+++ b/src/server/game/Movement/PathGenerator.cpp
@@ -584,12 +584,19 @@ NavTerrain PathGenerator::GetNavTerrain(float x, float y, float z)
}
}
-bool PathGenerator::HaveTile(Vector3 const& p) const
+bool PathGenerator::HaveTile(const Vector3& p) const
{
- int tx, ty;
+ int tx = -1, ty = -1;
float point[VERTEX_SIZE] = {p.y, p.z, p.x};
_navMesh->calcTileLoc(point, &tx, &ty);
+
+ /// Workaround
+ /// For some reason, often the tx and ty variables wont get a valid value
+ /// Use this check to prevent getting negative tile coords and crashing on getTileAt
+ if (tx < 0 || ty < 0)
+ return false;
+
return (_navMesh->getTileAt(tx, ty) != NULL);
}