From 998f69ca37e269558a31a0d44a0ee205515261f1 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 26 Apr 2019 17:33:19 +0200 Subject: [PATCH] Clean up WitchBookLevel --- Source/items.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Source/items.cpp b/Source/items.cpp index b7f88c8c1..8a2833d34 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -3783,20 +3783,18 @@ void SortWitch() void WitchBookLevel(int ii) { - int slvl; // edi + int slvl; if (witchitem[ii]._iMiscId == IMISC_BOOK) { witchitem[ii]._iMinMag = spelldata[witchitem[ii]._iSpell].sMinInt; slvl = plr[myplr]._pSplLvl[witchitem[ii]._iSpell]; - if (slvl) { - do { - witchitem[ii]._iMinMag += 20 * witchitem[ii]._iMinMag / 100; - --slvl; - if (witchitem[ii]._iMinMag > 255) { - witchitem[ii]._iMinMag = -1; - slvl = 0; - } - } while (slvl); + while (slvl) { + witchitem[ii]._iMinMag += 20 * witchitem[ii]._iMinMag / 100; + slvl--; + if (witchitem[ii]._iMinMag + 20 * witchitem[ii]._iMinMag / 100 > 255) { + witchitem[ii]._iMinMag = 255; + slvl = 0; + } } } }