Fixed reading of Punch and Kick damage values
- Randomized reading of infantry punch and kick damage arrays provided a max value that one too high, and was our of the range of the array.
This commit is contained in:
parent
7095efe1ad
commit
6c445969bf
1 changed files with 2 additions and 2 deletions
|
@ -2786,7 +2786,7 @@ RadioMessageType InfantryClass::Receive_Message(RadioClass * from, RadioMessageT
|
||||||
** Just received a kick! Take some damage.
|
** Just received a kick! Take some damage.
|
||||||
*/
|
*/
|
||||||
case RADIO_KICK:
|
case RADIO_KICK:
|
||||||
damage = Infantry_Kick_Damage[Random_Pick(0, (int)(sizeof(Infantry_Kick_Damage) / sizeof(Infantry_Kick_Damage[0])))];
|
damage = Infantry_Kick_Damage[Random_Pick(0, (int)(sizeof(Infantry_Kick_Damage) / sizeof(Infantry_Kick_Damage[0])) - 1)];
|
||||||
if (Take_Damage(damage, 0, WARHEAD_FOOT, this) == RESULT_DESTROYED) return(RADIO_STATIC);
|
if (Take_Damage(damage, 0, WARHEAD_FOOT, this) == RESULT_DESTROYED) return(RADIO_STATIC);
|
||||||
return(RADIO_ROGER);
|
return(RADIO_ROGER);
|
||||||
|
|
||||||
|
@ -2794,7 +2794,7 @@ RadioMessageType InfantryClass::Receive_Message(RadioClass * from, RadioMessageT
|
||||||
** Just recieved a punch! Take some damage.
|
** Just recieved a punch! Take some damage.
|
||||||
*/
|
*/
|
||||||
case RADIO_PUNCH:
|
case RADIO_PUNCH:
|
||||||
damage = Infantry_Punch_Damage[Random_Pick(0, (int)(sizeof(Infantry_Punch_Damage) / sizeof(Infantry_Punch_Damage[0])))];
|
damage = Infantry_Punch_Damage[Random_Pick(0, (int)(sizeof(Infantry_Punch_Damage) / sizeof(Infantry_Punch_Damage[0])) - 1)];
|
||||||
if (Take_Damage(damage, 0, WARHEAD_FIST, this) == RESULT_DESTROYED) return(RADIO_STATIC);
|
if (Take_Damage(damage, 0, WARHEAD_FIST, this) == RESULT_DESTROYED) return(RADIO_STATIC);
|
||||||
return(RADIO_ROGER);
|
return(RADIO_ROGER);
|
||||||
|
|
||||||
|
|
Reference in a new issue