From 603550b5aee8a82984ae36200cbfad1930776f8a Mon Sep 17 00:00:00 2001 From: silversurfer Date: Mon, 20 Jan 2014 17:38:35 +0000 Subject: [PATCH] Fix for ammo icon in description box which showed another shifted description box when ammo type was invalid. http://www.ja-galaxy-forum.com/board/ubbthreads.php/topics/328324/Re:_BUGZILLA_report_all_bugs_h.html#Post328324 Ammo type of such weapons will now be reset to 0 (standard ball ammo). git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6798 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Items.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 8fdb8b906..41dc47b54 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -5147,6 +5147,12 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, FilenameForBPP("INTERFACE\\infobox.sti", ubString); sForeColour = ITEMDESC_AMMO_FORE; + // silversurfer: This should never happen but some maps may contain items with invalid ammo types and this leads to graphical glitches + // because the game cannot find the right ammo icon in infobox.sti and then uses index 0. Index 0 is the info box itself. + // Better reset ammo type to 0 which is standard ball ammo. + if ( AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].grayed == 0 || AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].offNormal == 0 || AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].onNormal == 0 ) + (*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType = 0; + giItemDescAmmoButtonImages = LoadButtonImage(ubString,AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].grayed,AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].offNormal,-1,AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].onNormal,-1 ); if( guiCurrentItemDescriptionScreen == MAP_SCREEN )