From 38308680db4ee2e31140739cf7a0444c275ec62a Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 16 Jun 2013 15:05:41 +0000 Subject: [PATCH] Fix: AMMOTYPE::highExplosive was sometimes interpreted as an item number, sometimes as boolean, and sometimes a an index over explosives. It is now treated as an item number git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6124 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Weapons.h | 2 +- Tactical/XML_AmmoTypes.cpp | 2 +- TileEngine/Explosion Control.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index fc3f35a6e..40b8e61ff 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -248,7 +248,7 @@ typedef struct UINT8 numberOfBullets; INT32 multipleBulletDamageMultiplier; INT32 multipleBulletDamageDivisor; - BOOLEAN highExplosive; + UINT16 highExplosive; UINT8 explosionSize; //0=none, 1=small, 2=medium, 3=large BOOLEAN antiTank; BOOLEAN dart; diff --git a/Tactical/XML_AmmoTypes.cpp b/Tactical/XML_AmmoTypes.cpp index e7302daa6..ab4503f7e 100644 --- a/Tactical/XML_AmmoTypes.cpp +++ b/Tactical/XML_AmmoTypes.cpp @@ -238,7 +238,7 @@ ammotypeEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "highExplosive") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.highExplosive = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.highExplosive = (UINT16) atol(pData->szCharData); } else if(strcmp(name, "explosionSize") == 0) { diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 8a465dff9..7c0f49c42 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -332,7 +332,7 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 // No explosive but an attacker with HE ammo. if ( !( Item[ usItem ].usItemClass & IC_EXPLOSV ) && ubOwner != NOBODY) { - ExpParams.ubTypeID = (INT8)Explosive[AmmoTypes[ammotype].highExplosive].ubAnimationID; + ExpParams.ubTypeID = (INT8)Explosive[Item[AmmoTypes[ammotype].highExplosive].ubClassIndex].ubAnimationID; // return; } else // just normal explosives should get here