The Bug "pObject corrupted", aka "Toni SKI crash" or 6 Shuriken stacking crash" is triggered for debugging here, but only in _DEBUG build. In Release, nothing is changed. In _DEBUG, the code will DebugBreak() and if no Studio running, it will AsserMsg(). But this happens only if the corruption was _detected_. Not when it has happened :-( It is only a starting point for further excavation, and better than having nothing...

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1070 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sergeant_Kolja
2007-07-17 20:12:29 +00:00
parent c75026b151
commit cab825a382
+28
View File
@@ -1078,6 +1078,16 @@ void HandleRenderInvSlots( SOLDIERTYPE *pSoldier, UINT8 fDirtyLevel )
{
if ( fDirtyLevel == DIRTYLEVEL2 )
{
# if defined( _DEBUG ) /* Sergeant_Kolja, to be removed later again */
if( pSoldier->inv[ cnt ].ubGunAmmoType >= MAXITEMS )
{
DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String("pObject (%s) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usItem<MAXITEMS) ? Item[pSoldier->inv[ cnt ].usItem].szItemName : "???" ));
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"pObject (%S) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usItem<MAXITEMS) ? Item[pSoldier->inv[ cnt ].usItem].szItemName : "???" );
DebugBreak();
AssertMsg( 0, "pObject corrupted! GetHelpTextForItem() can crash." );
}
# endif
GetHelpTextForItem( pStr, &( pSoldier->inv[ cnt ] ), pSoldier );
SetRegionFastHelpText( &(gSMInvRegion[ cnt ]), pStr );
@@ -7422,6 +7432,24 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
}
}
/* 2007-05-27, Sergeant_Kolja: code temporarily added for tracking the
6 Shuriken bug plus the
SKI Tony inventory crash.
Remove when fixed!
*/
# if defined( _DEBUG )
if ( (pObject->ubGunAmmoType >= MAXITEMS) ||
((usItem == 1053) && (pObject->ubGunAmmoType != 0 )) /* shuriken: 1053 */
)
{
DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String( "corrupted pObject (%s) found in GetHelpTextForItem()", (usItem<MAXITEMS) ? Item[usItem].szItemName : "???" ));
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"corrupted pObject (%S) found in GetHelpTextForItem()" , (usItem<MAXITEMS) ? Item[usItem].szItemName : "???" );
DebugBreak();
AssertMsg( 0, "GetHelpTextForItem() would crash" );
}
#endif
if ( usItem != NOTHING )
{
// Retrieve the status of the items