exerchk fix (trunk only)

Post-3.4.3 problem noticed by Michael:  some code which was supposed
to be inside the end of a loop got placed in front of the wrong closing
brace, ending up beyond that loop.  As a result, decay of old attribute
exercise wasn't working as intended, and out of bounds array modification
was occurring (clobbering u.abon.a[0], which probably messed up resetting
strength when taking off rings of gain strength which were worn during an
exercise check).
This commit is contained in:
nethack.rankin
2008-12-30 21:45:41 +00:00
parent 624df671c6
commit b8ed7412dc

View File

@@ -526,15 +526,15 @@ exerchk()
(mod_val > 0) ? "must have been" : "haven't been",
exertext[i][(mod_val > 0) ? 0 : 1]);
}
nextattrib:
/* this used to be ``AEXE(i) /= 2'' but that would produce
platform-dependent rounding/truncation for negative vals */
AEXE(i) = (abs(ax) / 2) * mod_val;
}
context.next_attrib_check += rn1(200,800);
#ifdef DEBUG
pline("exerchk: next check at %ld.", context.next_attrib_check);
#endif
nextattrib:
/* this used to be ``AEXE(i) /= 2'' but that would produce
platform-dependent rounding/truncation for negative values */
AEXE(i) = (abs(ax) / 2) * mod_val;
}
}