shithub: rott

Download patch

ref: 64f869c2cb8a8317e64d35fed3a5c995f165039c
parent: f58bd7dfbba6dfe43d910ac18ef52be6f3ad693a
author: levesqu8 <levesqu8@msu.edu>
date: Fri Sep 29 06:34:31 EDT 2017

Fixed warnings found in GivePlayerAmmo

--- a/rott/rt_game.c
+++ b/rott/rt_game.c
@@ -1424,19 +1424,19 @@
 
     M_LINKSTATE(ob, pstate);
 
-    signed char * playerCurrentAmmo = pstate->ammo;
-    signed char * ammoInItem = item_pickup->ammo;
-    signed char * maxAmmoInWeapon = stats[item_pickup->itemnumber].ammo;
-    signed char newAmmoAmount = (signed char)((int)ammoInItem + (int)playerCurrentAmmo);
+    signed char * playerCurrentAmmo = (signed char *) (int)pstate->ammo;
+    signed char * ammoInItem = (signed char *) (int)item_pickup->ammo;
+    signed char * maxAmmoInWeapon = (signed char *) (int)stats[item_pickup->itemnumber].ammo;
+    signed char * newAmmoAmount = (signed char *)((int)ammoInItem + (int)playerCurrentAmmo);
 
     if (newAmmoAmount > maxAmmoInWeapon)
     {
-        ammoInItem = (signed char)((int)newAmmoAmount - (int)maxAmmoInWeapon);
+        ammoInItem = (signed char *)((int)newAmmoAmount - (int)maxAmmoInWeapon);
         if (ammoInItem < 0)
         {
             Error("Ammo in item cannot be set to a negative number!");
         }
-        item_pickup->ammo = ammoInItem;
+        item_pickup->ammo = (int) ammoInItem;
         newAmmoAmount = maxAmmoInWeapon;
     }
     else
@@ -1443,7 +1443,7 @@
     {
         ammoInItem = 0;
     }
-    pstate->ammo = newAmmoAmount;
+    pstate->ammo = (int) newAmmoAmount;
 
     //if (!gamestate.BattleOptions.WeaponPersistence)
     //{
@@ -1471,7 +1471,7 @@
                 }
 
                 //update ammo count on missile weapon on ground
-                LASTSTAT->ammo = ammoInItem;
+                LASTSTAT->ammo = (int) ammoInItem;
                 EnableOldWeapon(pstate);
             }
 
--