mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- Bugfix: Fixed CTD if weapon doesn't have ubDeadliness set it causes a division by zero and a CTD. (fix by Dougster)
o Specifically an enemy had binoculars in his hand, and went to pick up a weapon off the ground, and it would crash. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4506 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1866,7 +1866,14 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
|
||||
{
|
||||
if (Weapon[pObj->usItem].ubDeadliness > Weapon[pSoldier->inv[HANDPOS].usItem].ubDeadliness)
|
||||
{
|
||||
iTempValue = 100 * Weapon[pObj->usItem].ubDeadliness / Weapon[pSoldier->inv[HANDPOS].usItem].ubDeadliness;
|
||||
if ((Weapon[pSoldier->inv[HANDPOS].usItem].ubDeadliness != NULL) && (Weapon[pSoldier->inv[HANDPOS].usItem].ubDeadliness >= 0))
|
||||
{
|
||||
iTempValue = 100 * Weapon[pObj->usItem].ubDeadliness / Weapon[pSoldier->inv[HANDPOS].usItem].ubDeadliness;
|
||||
}
|
||||
else
|
||||
{
|
||||
iTempValue = 100 * Weapon[pObj->usItem].ubDeadliness;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user