Prevent divide by zero in newman

...which happened when your max power was 0
This commit is contained in:
Pasi Kallinen
2015-04-15 21:05:46 +03:00
parent 5a08671fc0
commit 38bdb175cc
+1 -1
View File
@@ -300,7 +300,7 @@ newman()
enmax = rounddiv((long)enmax * (long)rn1(4, 8), 10); enmax = rounddiv((long)enmax * (long)rn1(4, 8), 10);
for (i = 0; (u.ulevel = i) < newlvl; i++) enmax += newpw(); for (i = 0; (u.ulevel = i) < newlvl; i++) enmax += newpw();
if (enmax < u.ulevel) enmax = u.ulevel; if (enmax < u.ulevel) enmax = u.ulevel;
u.uen = rounddiv((long)u.uen * (long)enmax, u.uenmax); u.uen = rounddiv((long)u.uen * (long)enmax, ((u.uenmax < 1) ? 1 : u.uenmax));
u.uenmax = enmax; u.uenmax = enmax;
/* [should alignment record be tweaked too?] */ /* [should alignment record be tweaked too?] */