From cab825a38257000c8f8a6014b1d7dcd606d99332 Mon Sep 17 00:00:00 2001 From: Sergeant_Kolja Date: Tue, 17 Jul 2007 20:12:29 +0000 Subject: [PATCH] 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 --- Tactical/Interface Items.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 36f52690..632db14c 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -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 ].usIteminv[ cnt ].usItem].szItemName : "???" )); + ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"pObject (%S) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usIteminv[ 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