aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/server/nav_pathfind.h
diff options
context:
space:
mode:
Diffstat (limited to 'mp/src/game/server/nav_pathfind.h')
-rw-r--r--mp/src/game/server/nav_pathfind.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/mp/src/game/server/nav_pathfind.h b/mp/src/game/server/nav_pathfind.h
index b06b46a0..e9c2d7ec 100644
--- a/mp/src/game/server/nav_pathfind.h
+++ b/mp/src/game/server/nav_pathfind.h
@@ -16,7 +16,9 @@
#include "mathlib/ssemath.h"
#include "nav_area.h"
+#ifdef STAGING_ONLY
extern int g_DebugPathfindCounter;
+#endif
//-------------------------------------------------------------------------------------------------------------------
@@ -108,7 +110,9 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
*closestArea = startArea;
}
+#ifdef STAGING_ONLY
bool isDebug = ( g_DebugPathfindCounter-- > 0 );
+#endif
if (startArea == NULL)
return false;
@@ -154,10 +158,12 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
// get next area to check
CNavArea *area = CNavArea::PopOpenList();
+#ifdef STAGING_ONLY
if ( isDebug )
{
area->DrawFilled( 0, 255, 0, 128, 30.0f );
}
+#endif
// don't consider blocked areas
if ( area->IsBlocked( teamID, ignoreNavBlockers ) )
@@ -339,7 +345,13 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
continue;
float newCostSoFar = costFunc( newArea, area, ladder, elevator, length );
-
+
+ // NaNs really mess this function up causing tough to track down hangs. If
+ // we get inf back, clamp it down to a really high number.
+ DebuggerBreakOnNaN_StagingOnly( newCostSoFar );
+ if ( IS_NAN( newCostSoFar ) )
+ newCostSoFar = 1e30f;
+
// check if cost functor says this area is a dead-end
if ( newCostSoFar < 0.0f )
continue;
@@ -352,7 +364,7 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
// Make sure that any jump to a new area incurs some pathfinsing
// cost, to avoid us spinning our wheels over insignificant cost
// benefit, floating point precision bug, or busted cost functor.
- float minNewCostSoFar = area->GetCostSoFar() * 1.00001 + 0.00001;
+ float minNewCostSoFar = area->GetCostSoFar() * 1.00001f + 0.00001f;
newCostSoFar = Max( newCostSoFar, minNewCostSoFar );
// stop if path length limit reached