From ae15b66e60e0048875b89c69f8380c8422f29a94 Mon Sep 17 00:00:00 2001 From: onpon4 Date: Wed, 8 Apr 2015 20:33:53 -0400 Subject: [PATCH] Fixed shop bug which caused loss of super charge. --- src/shop.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/shop.cpp b/src/shop.cpp index 05e78b9..293603a 100644 --- a/src/shop.cpp +++ b/src/shop.cpp @@ -806,9 +806,10 @@ static void sell(int i) sell(SHOP_PLASMA_MIN_OUTPUT); currentGame.maxPlasmaOutput--; - weapon[W_PLAYER_WEAPON].ammo[0] = MIN( - weapon[W_PLAYER_WEAPON].ammo[0], - currentGame.maxPlasmaOutput); + if (weapon[W_PLAYER_WEAPON].ammo[0] <= currentGame.maxPlasmaOutput + 1) + weapon[W_PLAYER_WEAPON].ammo[0] = MIN( + weapon[W_PLAYER_WEAPON].ammo[0], + currentGame.maxPlasmaOutput); break; case SHOP_PLASMA_MAX_DAMAGE: @@ -822,9 +823,10 @@ static void sell(int i) sell(SHOP_PLASMA_MIN_DAMAGE); currentGame.maxPlasmaDamage--; - weapon[W_PLAYER_WEAPON].damage = MIN( - weapon[W_PLAYER_WEAPON].damage, - currentGame.maxPlasmaDamage); + if (weapon[W_PLAYER_WEAPON].damage <= currentGame.maxPlasmaDamage + 1) + weapon[W_PLAYER_WEAPON].damage = MIN( + weapon[W_PLAYER_WEAPON].damage, + currentGame.maxPlasmaDamage); break; case SHOP_PLASMA_MAX_RATE: @@ -838,9 +840,10 @@ static void sell(int i) sell(SHOP_PLASMA_MIN_RATE); currentGame.maxPlasmaRate--; - weapon[W_PLAYER_WEAPON].reload[0] = MAX( - weapon[W_PLAYER_WEAPON].reload[0], - rate2reload[currentGame.maxPlasmaRate]); + if (weapon[W_PLAYER_WEAPON].reload[0] >= rate2reload[currentGame.maxPlasmaRate + 1]) + weapon[W_PLAYER_WEAPON].reload[0] = MAX( + weapon[W_PLAYER_WEAPON].reload[0], + rate2reload[currentGame.maxPlasmaRate]); break; case SHOP_PLASMA_MIN_OUTPUT: