From b953625e5b48ed01ae2b7edecdb14b580622c3f5 Mon Sep 17 00:00:00 2001 From: SHIRAKATA Kentaro Date: Tue, 5 Nov 2024 15:13:52 +0900 Subject: [PATCH] early return when `value` == 0 on dosacrifice() `calc_value()` returns a non-negative value, and there is no code that sets `value` to 0 after this point. --- src/pray.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pray.c b/src/pray.c index 900c57692..f843ddd9e 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1908,7 +1908,9 @@ dosacrifice(void) value = -1; HAggravate_monster |= FROMOUTSIDE; } else if (!value) { - ; /* too old; don't give undead or unicorn bonus or penalty */ + /* too old; don't give undead or unicorn bonus or penalty */ + pline1(nothing_happens); + return ECMD_TIME; } else if (is_undead(ptr)) { /* Not demons--no demon corpses */ /* most undead that leave a corpse yield 'human' (or other race) corpse so won't get here; the exception is wraith; give the @@ -1954,11 +1956,6 @@ dosacrifice(void) } } - if (value == 0) { - pline1(nothing_happens); - return ECMD_TIME; - } - if (altaralign != u.ualign.type && highaltar) { desecrate_altar(highaltar, altaralign); } else if (value < 0) { /* don't think the gods are gonna like this... */