]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
to if or not to if that is a question
authorAmadeusz Sławiński <amade@asmblr.net>
Wed, 22 Feb 2017 13:29:36 +0000 (14:29 +0100)
committerAmadeusz Sławiński <amade@asmblr.net>
Wed, 22 Feb 2017 13:29:36 +0000 (14:29 +0100)
also remove duplicate case:

qcsrc/common/t_items.qc

index 626148b9a896740823673edf47e961fff3482f20..d6cae53efcb1457bba295ca2973c99ddb5009725 100644 (file)
@@ -1003,7 +1003,6 @@ float ammo_pickupevalfunc(entity player, entity item)
 
                        switch(it.ammo_field)
                        {
-                               case ammo_shells:  need_shells  = true; break;
                                case ammo_shells:  need_shells  = true; break;
                                case ammo_nails:   need_nails   = true; break;
                                case ammo_rockets: need_rockets = true; break;
@@ -1015,29 +1014,22 @@ float ammo_pickupevalfunc(entity player, entity item)
                rating = item.bot_pickupbasevalue;
        }
 
-       if (need_shells)
-       if (item.ammo_shells)
-       if (player.ammo_shells < g_pickup_shells_max)
+       if ((need_shells) && (item.ammo_shells) && (player.ammo_shells < g_pickup_shells_max))
                c = item.ammo_shells / player.ammo_shells;
-       if (need_nails)
-       if (item.ammo_nails)
-       if (player.ammo_nails < g_pickup_nails_max)
+
+       if ((need_nails) && (item.ammo_nails) && (player.ammo_nails < g_pickup_nails_max))
                c = item.ammo_nails / player.ammo_nails;
-       if (need_rockets)
-       if (item.ammo_rockets)
-       if (player.ammo_rockets < g_pickup_rockets_max)
+
+       if ((need_rockets) && (item.ammo_rockets) && (player.ammo_rockets < g_pickup_rockets_max))
                c = item.ammo_rockets / player.ammo_rockets;
-       if (need_cells)
-       if (item.ammo_cells)
-       if (player.ammo_cells < g_pickup_cells_max)
+
+       if ((need_cells) && (item.ammo_cells) && (player.ammo_cells < g_pickup_cells_max))
                c = item.ammo_cells / player.ammo_cells;
-       if (need_plasma)
-       if (item.ammo_plasma)
-       if (player.ammo_plasma < g_pickup_plasma_max)
+
+       if ((need_plasma) && (item.ammo_plasma) && (player.ammo_plasma < g_pickup_plasma_max))
                c = item.ammo_plasma / player.ammo_plasma;
-       if (need_fuel)
-       if (item.ammo_fuel)
-       if (player.ammo_fuel < g_pickup_fuel_max)
+
+       if ((need_fuel) && (item.ammo_fuel) && (player.ammo_fuel < g_pickup_fuel_max))
                c = item.ammo_fuel / player.ammo_fuel;
 
        rating *= min(2, c);