]> granicus.if.org Git - nethack/commitdiff
Separate some codes for desecratintg high altar
authorSHIRAKATA Kentaro <argrath@ub32.org>
Sat, 26 Mar 2022 19:15:23 +0000 (04:15 +0900)
committerPatR <rankin@nethack.org>
Sat, 30 Apr 2022 06:22:19 +0000 (23:22 -0700)
... and remove one goto.

src/pray.c

index c9a8e86eb8d1b3d97cc02c50c8e05c9a073e385d..df86537c745ff36602804ea40ac3c804f450859f 100644 (file)
@@ -20,6 +20,7 @@ static void gods_angry(aligntyp);
 static void gods_upset(aligntyp);
 static void consume_offering(struct obj *);
 static void offer_too_soon(aligntyp);
+static void desecrate_high_altar(aligntyp);
 static boolean water_prayer(boolean);
 static boolean blocked_boulder(int, int);
 
@@ -1437,6 +1438,21 @@ offer_too_soon(aligntyp altaralign)
                         : "ashamed");
 }
 
+static void
+desecrate_high_altar(aligntyp altaralign)
+{
+    /*
+     * REAL BAD NEWS!!! High altars cannot be converted.  Even an attempt
+     * gets the god who owns it truly pissed off.
+     */
+    You_feel("the air around you grow charged...");
+    pline("Suddenly, you realize that %s has noticed you...", a_gname());
+    godvoice(altaralign,
+                "So, mortal!  You dare desecrate my High Temple!");
+    /* Throw everything we have at the player */
+    god_zaps_you(altaralign);
+}
+
 /* the #offer command - sacrifice something to the gods */
 int
 dosacrifice(void)
@@ -1506,7 +1522,8 @@ dosacrifice(void)
 
             if (highaltar
                 && (altaralign != A_CHAOTIC || u.ualign.type != A_CHAOTIC)) {
-                goto desecrate_high_altar;
+                desecrate_high_altar(altaralign);
+                return ECMD_TIME;
             } else if (altaralign != A_CHAOTIC && altaralign != A_NONE) {
                 /* curse the lawful/neutral altar */
                 pline_The("altar is stained with %s blood.", g.urace.adj);
@@ -1714,17 +1731,7 @@ dosacrifice(void)
     }
 
     if (altaralign != u.ualign.type && highaltar) {
- desecrate_high_altar:
-        /*
-         * REAL BAD NEWS!!! High altars cannot be converted.  Even an attempt
-         * gets the god who owns it truly pissed off.
-         */
-        You_feel("the air around you grow charged...");
-        pline("Suddenly, you realize that %s has noticed you...", a_gname());
-        godvoice(altaralign,
-                 "So, mortal!  You dare desecrate my High Temple!");
-        /* Throw everything we have at the player */
-        god_zaps_you(altaralign);
+        desecrate_high_altar(altaralign);
     } else if (value < 0) { /* don't think the gods are gonna like this... */
         gods_upset(altaralign);
     } else {