summaryrefslogtreecommitdiff
path: root/src/render/Hud.cpp
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-01-13 23:07:12 +0300
committererorcun <erorcunerorcun@hotmail.com.tr>2021-01-13 23:16:25 +0300
commita844cbbc3d1dade48a7de6112ae1a9b092d9c3e8 (patch)
tree2348a955eab5470adfd1239f36b45040404bb4d6 /src/render/Hud.cpp
parent011a9cc775bb37313af2ee6b7af2b84eb00df058 (diff)
hud ammo fix
Diffstat (limited to 'src/render/Hud.cpp')
-rw-r--r--src/render/Hud.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index ae7b7eb3..b718c163 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -509,10 +509,10 @@ void CHud::Draw()
/*
DrawAmmo
*/
- uint32 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition;
- uint32 AmmoInClip = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_nAmmoInClip;
- uint32 TotalAmmo = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_nAmmoTotal;
- uint32 Ammo, Clip;
+ int32 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition;
+ int32 AmmoInClip = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_nAmmoInClip;
+ int32 TotalAmmo = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_nAmmoTotal;
+ int32 Ammo, Clip;
if (AmmoAmount <= 1 || AmmoAmount >= 1000)
sprintf(sTemp, "%d", TotalAmmo);
@@ -520,18 +520,12 @@ void CHud::Draw()
if (WeaponType == WEAPONTYPE_FLAMETHROWER) {
Clip = AmmoInClip / 10;
- if ((TotalAmmo - AmmoInClip) / 10 <= 9999)
- Ammo = (TotalAmmo - AmmoInClip) / 10;
- else
- Ammo = 9999;
+ Ammo = Min((TotalAmmo - AmmoInClip) / 10, 9999);
}
else {
Clip = AmmoInClip;
- if ((TotalAmmo - AmmoInClip) > 9999)
- Ammo = 9999;
- else
- Ammo = TotalAmmo - AmmoInClip;
+ Ammo = Min(TotalAmmo - AmmoInClip, 9999);
}
sprintf(sTemp, "%d-%d", Ammo, Clip);