diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index c9f41c4e..a262272c 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -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 ); } diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index c785158d..1ea332f3 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -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 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; iubID, s->sGridNo ) ); + } + } + trackNode.push_back(current); } // if this function was called because a solider is about to embark on an actual route diff --git a/builddefines.h b/builddefines.h index c0654ff9..8447fc03 100644 --- a/builddefines.h +++ b/builddefines.h @@ -19,6 +19,7 @@ #define ROBOT_ALWAYS_READY +#define FORCE_ASSERTS_ON #define BLOOD_N_GORE_ENABLED diff --git a/jascreens.cpp b/jascreens.cpp index bf7561ae..8cb72afd 100644 --- a/jascreens.cpp +++ b/jascreens.cpp @@ -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] ) {