only autoselect a secondary weapon if the player didn't have any of that type before...
authorChris Taylor <chris@icculus.org>
Fri, 1 Dec 2006 12:55:20 +0000 (12:55 +0000)
committerChris Taylor <chris@icculus.org>
Fri, 1 Dec 2006 12:55:20 +0000 (12:55 +0000)
ChangeLog
main/weapon.c

index c3f7283..a678802 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-12-01  Chris Taylor  <chris@icculus.org>
+
+       * main/weapon.c: only autoselect a secondary weapon if the player
+       didn't have any of that type before (fix bug #2671)
+
 2006-11-30  Chris Taylor  <chris@icculus.org>
 
        * arch/ogl/ogl.c: avoid loading OpenGL textures before they have
index ca77624..ea97b97 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: weapon.c,v 1.10 2004-08-28 23:17:45 schaffner Exp $ */
+/* $Id: weapon.c,v 1.11 2006-12-01 12:55:20 chris Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -23,7 +23,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: weapon.c,v 1.10 2004-08-28 23:17:45 schaffner Exp $";
+static char rcsid[] = "$Id: weapon.c,v 1.11 2006-12-01 12:55:20 chris Exp $";
 #endif
 
 #include <stdlib.h>
@@ -598,21 +598,24 @@ int pick_up_secondary(int weapon_index,int count)
                Players[Player_num].secondary_ammo[weapon_index] = max;
        }
 
-       cutpoint=SOrderList (255);
-       if (SOrderList (weapon_index)<cutpoint && ((SOrderList (weapon_index) < SOrderList(Secondary_weapon)) || (Players[Player_num].secondary_ammo[Secondary_weapon] == 0))   )
-               select_weapon(weapon_index,1, 0, 1);
-       else {
-               //if we don't auto-select this weapon, but it's a proxbomb or smart mine,
-               //we want to do a mini-auto-selection that applies to the drop bomb key
+       if (Players[Player_num].secondary_ammo[weapon_index] == count)  // only autoselect if player didn't have any
+       {
+               cutpoint=SOrderList (255);
+               if (SOrderList (weapon_index)<cutpoint && ((SOrderList (weapon_index) < SOrderList(Secondary_weapon)) || (Players[Player_num].secondary_ammo[Secondary_weapon] == 0))   )
+                       select_weapon(weapon_index,1, 0, 1);
+               else {
+                       //if we don't auto-select this weapon, but it's a proxbomb or smart mine,
+                       //we want to do a mini-auto-selection that applies to the drop bomb key
 
-               if ((weapon_index == PROXIMITY_INDEX || weapon_index == SMART_MINE_INDEX) &&
-                               !(Secondary_weapon == PROXIMITY_INDEX || Secondary_weapon == SMART_MINE_INDEX)) {
-                       int cur;
+                       if ((weapon_index == PROXIMITY_INDEX || weapon_index == SMART_MINE_INDEX) &&
+                                       !(Secondary_weapon == PROXIMITY_INDEX || Secondary_weapon == SMART_MINE_INDEX)) {
+                               int cur;
 
-                       cur = Secondary_last_was_super[PROXIMITY_INDEX]?SMART_MINE_INDEX:PROXIMITY_INDEX;
+                               cur = Secondary_last_was_super[PROXIMITY_INDEX]?SMART_MINE_INDEX:PROXIMITY_INDEX;
 
-                       if (SOrderList (weapon_index) < SOrderList(cur))
-                               Secondary_last_was_super[PROXIMITY_INDEX] = (weapon_index == SMART_MINE_INDEX);
+                               if (SOrderList (weapon_index) < SOrderList(cur))
+                                       Secondary_last_was_super[PROXIMITY_INDEX] = (weapon_index == SMART_MINE_INDEX);
+                       }
                }
        }