From 2a7712794e617d7835656cb0261410809f1af554 Mon Sep 17 00:00:00 2001 From: BC Ko Date: Thu, 12 Aug 2021 03:22:34 -0700 Subject: [PATCH] cleanup manual value clamping: stores.cpp 2 (#2583) --- Source/stores.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Source/stores.cpp b/Source/stores.cpp index 404f17277..9e095fb81 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -663,9 +663,7 @@ void StartWitchBuy() for (int i = 0; !witchitem[i].isEmpty(); i++) { storenumh++; } - stextsmax = storenumh - 4; - if (stextsmax < 0) - stextsmax = 0; + stextsmax = std::max(storenumh - 4, 0); } bool WitchSellOk(int i) @@ -2608,10 +2606,7 @@ void StorePrior() PlaySFX(IS_TITLEMOV); if (stextsel != -1 && stextscrl) { if (stextsel == stextup) { - if (stextsval != 0) - stextsval -= 4; - if (stextsval < 0) - stextsval = 0; + stextsval = std::max(stextsval - 4, 0); } else { stextsel = stextup; }