Fix: redraw ammo count in EDB if button is dirty

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8439 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2017-08-06 20:20:18 +00:00
parent 1e7a5772d0
commit 35cdd64a92
+14 -11
View File
@@ -6009,25 +6009,23 @@ BOOLEAN ReloadItemDesc( )
void RenderBulletIcon(OBJECTTYPE *pObject, UINT32 ubStatusIndex) void RenderBulletIcon(OBJECTTYPE *pObject, UINT32 ubStatusIndex)
{ {
CHAR16 pStr[10]; CHAR16 pStr[10];
CHAR8 ubString[48];
if(pObject->exists() == false)
return;
if(!gfInItemDescBox)
return;
// Flugente: if the ammo button does not exist, no point in entering its text... // Flugente: if the ammo button does not exist, no point in entering its text...
if ( giItemDescAmmoButton < 0 ) if ( giItemDescAmmoButton < 0 )
return; return;
if ( GetMagSize(pObject) <= 99 ) if ( !gfInItemDescBox )
swprintf( pStr, L"%d/%d", (*pObject)[ubStatusIndex]->data.gun.ubGunShotsLeft, GetMagSize(pObject)); return;
if ( pObject->exists( ) == false )
return;
UINT16 magsize = GetMagSize( pObject );
if ( magsize <= 99 )
swprintf( pStr, L"%d/%d", (*pObject)[ubStatusIndex]->data.gun.ubGunShotsLeft, magsize );
else else
swprintf( pStr, L"%d", (*pObject)[ubStatusIndex]->data.gun.ubGunShotsLeft ); swprintf( pStr, L"%d", (*pObject)[ubStatusIndex]->data.gun.ubGunShotsLeft );
FilenameForBPP("INTERFACE\\infobox.sti", ubString);
SpecifyButtonText( giItemDescAmmoButton, pStr ); SpecifyButtonText( giItemDescAmmoButton, pStr );
} }
@@ -6902,6 +6900,11 @@ void RenderItemDescriptionBox( )
} }
} }
} }
// Flugente: redraw bullet count
if ( giItemDescAmmoButton > -1 && ButtonList[giItemDescAmmoButton]->uiFlags & BUTTON_DIRTY )
RenderBulletIcon( gpItemDescObject, gubItemDescStatusIndex );
//Display the money 'seperating' border //Display the money 'seperating' border
if ( gpItemDescObject->usItem == MONEY ) if ( gpItemDescObject->usItem == MONEY )
{ {