early return on dosacrifice()

... to reduce indents and prepare further refactorings.
This commit is contained in:
SHIRAKATA Kentaro
2024-11-05 00:50:19 +09:00
parent 091a709cdb
commit 955c2c5faf
+9 -7
View File
@@ -1827,7 +1827,9 @@ dosacrifice(void)
struct obj *otmp; struct obj *otmp;
boolean highaltar; boolean highaltar;
aligntyp altaralign = a_align(u.ux, u.uy); aligntyp altaralign = a_align(u.ux, u.uy);
int value = 0; int value;
struct permonst *ptr;
struct monst *mtmp;
if (!on_altar() || u.uswallow) { if (!on_altar() || u.uswallow) {
You("are not %s an altar.", You("are not %s an altar.",
@@ -1858,6 +1860,11 @@ dosacrifice(void)
return ECMD_TIME; return ECMD_TIME;
} /* fake Amulet */ } /* fake Amulet */
if (otmp->otyp != CORPSE) {
pline1(nothing_happens);
return ECMD_TIME;
}
/* /*
* Was based on nutritional value and aging behavior (< 50 moves). * Was based on nutritional value and aging behavior (< 50 moves).
* Sacrificing a food ration got you max luck instantly, making the * Sacrificing a food ration got you max luck instantly, making the
@@ -1869,9 +1876,7 @@ dosacrifice(void)
*/ */
#define MAXVALUE 24 /* Highest corpse value (besides Wiz) */ #define MAXVALUE 24 /* Highest corpse value (besides Wiz) */
if (otmp->otyp == CORPSE) { ptr = &mons[otmp->corpsenm];
struct permonst *ptr = &mons[otmp->corpsenm];
struct monst *mtmp;
/* KMH, conduct */ /* KMH, conduct */
if (!u.uconduct.gnostic++) if (!u.uconduct.gnostic++)
@@ -1948,9 +1953,6 @@ dosacrifice(void)
value += 3; value += 3;
} }
} }
} else { /* !corpse */
; /* value==0 which is what we want for non-corpse */
} /* ?corpse */
if (value == 0) { if (value == 0) {
pline1(nothing_happens); pline1(nothing_happens);