Turned on Abends so they appear rather then having the program simply CTD.

Setup a failsafe in the pathfinding system that will force an abend should the system fall into an infinite loop.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2194 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
ChrisL
2008-05-21 16:55:38 +00:00
parent 73acf25c7a
commit 51d541f29c
4 changed files with 26 additions and 10 deletions
+7 -8
View File
@@ -3081,12 +3081,13 @@ BOOLEAN GetItemPoolFromGround( INT16 sMapPos, ITEM_POOL **ppItemPool )
//if we know the level, we can avoid an if, and this function is called alot
LEVELNODE *pObject = gpWorldLevelData[ sMapPos ].pStructHead;
//ADB: let's not make 51200 calls to FileWrite ok?
#ifdef JA2BETAVERSION
if ( pObject )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("gpWorldLevelData, %d %d %d", pObject, sMapPos, (&gpWorldLevelData[25600-1]) + sizeof(MAP_ELEMENT) ) );
}
#endif
//#ifdef JA2BETAVERSION
// if ( pObject )
// {
// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("gpWorldLevelData, %d %d %d", pObject, sMapPos, (&gpWorldLevelData[25600-1]) + sizeof(MAP_ELEMENT) ) );
// }
//#endif
(*ppItemPool) = NULL;
// LOOP THORUGH OBJECT LAYER
while( pObject != NULL )
@@ -3105,8 +3106,6 @@ BOOLEAN GetItemPoolFromGround( INT16 sMapPos, ITEM_POOL **ppItemPool )
pObject = pObject->pNext;
}
(*ppItemPool) = NULL;
return( FALSE );
}
+16
View File
@@ -792,6 +792,11 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
INT16 parent = DestNode;
INT16 current = parent;
unsigned int sizePath = 0;
//CHRISL: If, for whatever reason, the pathfinding system gets the wrong Grid values, it's possible that an infinite
// loop can result. This can often require a hard reboot to get around. To try and force a CTD in this event, lets
// track all the grids and force a crash if we ever pull the same GridNo.
std::vector<INT16> trackNode;
trackNode.resize(1,current);
while (current != -1)
{
sizePath += GetNumSteps( current);
@@ -801,6 +806,17 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
parent = GetAStarParent( parent);
}
current = GetAStarParent( current);
for(unsigned int i = 0; i<trackNode.size(); i++)
{
if(trackNode.at(i) == current)
{
//CHAR8 str[128];
//sprintf( str, "Duplicate GridNo found during pathfinding" );
//AssertMsg( 0, str );
AssertMsg( FALSE, String( "Duplicate GridNo found during pathfinding at %d. Related to soldier %d at GridNo %d.", current, s->ubID, s->sGridNo ) );
}
}
trackNode.push_back(current);
}
// if this function was called because a solider is about to embark on an actual route
+1
View File
@@ -19,6 +19,7 @@
#define ROBOT_ALWAYS_READY
#define FORCE_ASSERTS_ON
#define BLOOD_N_GORE_ENABLED
+2 -2
View File
@@ -265,7 +265,7 @@ UINT32 ErrorScreenHandle(void)
{
InputAtom InputEvent;
static BOOLEAN fFirstTime = FALSE;
#ifdef JA2BETAVERSION
#if defined ( JA2BETAVERSION ) || defined ( FORCE_ASSERTS_ON )
CHAR16 str[256];
#endif
@@ -287,7 +287,7 @@ UINT32 ErrorScreenHandle(void)
SetFontForeground( FONT_LTRED );
#ifdef JA2BETAVERSION
#if defined ( JA2BETAVERSION ) || defined ( FORCE_ASSERTS_ON )
if( gubAssertString[0] )
{