suppress obsolete restore_attrib()

moveloop() has been calling restore_attrib() every turn, and
restore_attrib() loops through all six characteristics every time
to check for ones that have temporary adjustments timing out.  But
ATIME(characteristic) is never set anywhere and no time outs would
occur.  So delete the call to restore_attrib() from moveloop().

This leaves that no-longer-called routine in place and updates it
to handle Wounded_legs properly in case it ever does get used.

Also, add a comment about "restore ability" not fixing temporarily
lost characteristics due to hunger or wounded legs.  And update
unfixable_trouble_count() to check for those so that restore ability
won't say "you feel great" when it fails to fix them.
This commit is contained in:
PatR
2022-01-11 11:25:04 -08:00
parent ffeb0e27a8
commit a8e9e1b488
4 changed files with 22 additions and 10 deletions

View File

@@ -377,19 +377,26 @@ set_moreluck(void)
u.moreluck = -LUCKADD;
}
/* (not used) */
void
restore_attrib(void)
{
int i, equilibrium;;
/*
* Note: this gets called on every turn but ATIME() is never set
* to non-zero anywhere, and ATEMP() is only used for strength loss
* from hunger, so it doesn't actually do anything.
* Note: this used to get called by moveloop() on every turn but
* ATIME() is never set to non-zero anywhere so didn't do anything.
* Presumably it once supported something like potion of heroism
* which conferred temporary characteristics boost(s).
*
* ATEMP() is used for strength loss from hunger, which doesn't
* time out, and for dexterity loss from wounded legs, which has
* its own timeout routine.
*/
for (i = 0; i < A_MAX; i++) { /* all temporary losses/gains */
equilibrium = (i == A_STR && u.uhs >= WEAK) ? -1 : 0;
equilibrium = ((i == A_STR && u.uhs >= WEAK)
|| (i == A_DEX && Wounded_legs)) ? -1 : 0;
if (ATEMP(i) != equilibrium && ATIME(i) != 0) {
if (!(--(ATIME(i)))) { /* countdown for change */
ATEMP(i) += (ATEMP(i) > 0) ? -1 : 1;