mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
in ReadInAttachmentComboMergeStats() added a missing fclose plus a missing XML_free
in Items.cpp added unfriendly code to trace + stop the game when pObj is corrupted. (the corruption comes from somewhere outside the destructed foo!) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@900 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+9
-1
@@ -6556,8 +6556,16 @@ INT16 GetRateOfFireBonus( OBJECTTYPE * pObj )
|
||||
INT8 bLoop;
|
||||
INT16 bns=0;
|
||||
|
||||
if( (MAXITEMS <= pObj->usItem) || (MAXITEMS <= pObj->usGunAmmoItem) )
|
||||
{
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String("GetRateOfFireBonus would crash: pObj->usItem=%d or pObj->usGunAmmoItem=%d ist higher than max %d", pObj->usItem, pObj->usGunAmmoItem, MAXITEMS ));
|
||||
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"GetRateOfFireBonus would crash: pObj->usItem=%d or pObj->usGunAmmoItem=%d ist higher than max %d", pObj->usItem, pObj->usGunAmmoItem, MAXITEMS );
|
||||
AssertMsg( 0, "GetRateOfFireBonus would crash" );
|
||||
return 0; /* cannot calculate Bonus, this only happens sometimes in FULLSCREEN */
|
||||
}
|
||||
|
||||
bns = BonusReduceMore( Item[pObj->usItem].rateoffirebonus, pObj->bStatus[0] );
|
||||
bns += Item[pObj->usGunAmmoItem].rateoffirebonus ;
|
||||
bns += Item[pObj->usGunAmmoItem].rateoffirebonus;
|
||||
|
||||
for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++)
|
||||
{
|
||||
|
||||
@@ -193,6 +193,7 @@ BOOLEAN ReadInAttachmentComboMergeStats(STR fileName)
|
||||
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
|
||||
{
|
||||
MemFree(lpcBuffer);
|
||||
FileClose( hFile ); /* added, Sgt. Kolja */
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
@@ -220,6 +221,7 @@ BOOLEAN ReadInAttachmentComboMergeStats(STR fileName)
|
||||
LiveMessage(errorBuf);
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
XML_ParserFree(parser); /* added, Sgt. Kolja */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user