From 8085d038980a133fe76d609e486475538be46976 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 27 Aug 2024 13:59:57 -0700 Subject: [PATCH] some miscellaneous formatting and comments Clear out some miscellaneous changes that have been sitting around for a while. --- src/attrib.c | 2 +- src/end.c | 12 +++++++----- src/mkmaze.c | 27 ++++++++++++++++++--------- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/attrib.c b/src/attrib.c index e8d2bd3d1..6361ec374 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -242,7 +242,7 @@ losestr(int num, const char *knam, schar k_format) losehp(dmg, knam, k_format); if (Upolyd) { - /* if still polymorphed, reduce you-as-monst maxHP; never below 1 */ + /* when still poly'd, reduce you-as-monst maxHP; never below 1 */ u.mhmax -= min(dmg, u.mhmax - 1); } else if (!waspolyd) { /* not polymorphed now and didn't rehumanize when taking damage; diff --git a/src/end.c b/src/end.c index 3078a0ad3..994690cf4 100644 --- a/src/end.c +++ b/src/end.c @@ -937,8 +937,7 @@ fuzzer_savelife(int how) * Some debugging code pulled out of done() to unclutter it. * 'done_seq' is maintained in done(). */ - if (!program_state.panicking - && how != PANICKED && how != TRICKED) { + if (!program_state.panicking && how != PANICKED && how != TRICKED) { savelife(how); /* periodically restore characteristics plus lost experience @@ -986,11 +985,14 @@ fuzzer_savelife(int how) svk.killer.name[0] = '\0'; svk.killer.format = 0; - /* Guard against getting stuck in a loop if we die in one of + /* + * Guard against getting stuck in a loop if we die in one of * the few ways where life-saving isn't effective (cited case * was burning in lava when the level was too full to allow - * teleporting to safety). Deal with it by recreating - * the level, if we're in wizmode */ + * teleporting to safety). Deal with it by recreating the level + * if we're in wizmode (always the case for debug_fuzzer unless + * player has used a debugger to fiddle with 'iflags' bits). + */ if (gd.done_seq++ > gh.hero_seq + 100L) { if (!wizard) return FALSE; /* can't deal with it */ diff --git a/src/mkmaze.c b/src/mkmaze.c index 0b96a0c6c..578f822f8 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -308,8 +308,10 @@ is_exclusion_zone(xint16 type, coordxy x, coordxy y) struct exclusion_zone *ez = sve.exclusion_zones; while (ez) { - if (((type == LR_DOWNTELE && (ez->zonetype == LR_DOWNTELE || ez->zonetype == LR_TELE)) - || (type == LR_UPTELE && (ez->zonetype == LR_UPTELE || ez->zonetype == LR_TELE)) + if (((type == LR_DOWNTELE + && (ez->zonetype == LR_DOWNTELE || ez->zonetype == LR_TELE)) + || (type == LR_UPTELE + && (ez->zonetype == LR_UPTELE || ez->zonetype == LR_TELE)) || type == ez->zonetype) && within_bounded_area(x, y, ez->lx, ez->ly, ez->hx, ez->hy)) return TRUE; @@ -406,7 +408,8 @@ put_lregion_here( { struct monst *mtmp; - if (bad_location(x, y, nlx, nly, nhx, nhy) || is_exclusion_zone(rtype, x, y)) { + if (bad_location(x, y, nlx, nly, nhx, nhy) + || is_exclusion_zone(rtype, x, y)) { if (!oneshot) { return FALSE; /* caller should try again */ } else { @@ -420,7 +423,8 @@ put_lregion_here( mtmp->mtrapped = 0; deltrap(t); } - if (bad_location(x, y, nlx, nly, nhx, nhy) || is_exclusion_zone(rtype, x, y)) + if (bad_location(x, y, nlx, nly, nhx, nhy) + || is_exclusion_zone(rtype, x, y)) return FALSE; } } @@ -807,7 +811,7 @@ stolen_booty(void) cnt = rnd(3); for (i = 0; i < cnt; ++i) migr_booty_item(SKELETON_KEY, gang); - otyp = rn2((GAUNTLETS_OF_DEXTERITY - LEATHER_GLOVES) + 1) + LEATHER_GLOVES; + otyp = rn1((GAUNTLETS_OF_DEXTERITY - LEATHER_GLOVES) + 1, LEATHER_GLOVES); migr_booty_item(otyp, gang); cnt = rnd(10); for (i = 0; i < cnt; ++i) { @@ -1456,6 +1460,8 @@ mkportal(coordxy x, coordxy y, xint16 todnum, xint16 todlevel) return; } +/* augment the Plane of Fire; called from goto_level() when arriving and + moveloop_core() when on the level */ void fumaroles(void) { @@ -1509,13 +1515,16 @@ staticfn void set_wportal(void); staticfn void mk_bubble(coordxy, coordxy, int); staticfn void mv_bubble(struct bubble *, coordxy, coordxy, boolean); +/* augment the Plane of Water; called from goto_level() when arriving and + moveloop_core() when on the level */ void movebubbles(void) { - static const struct rm water_pos = { cmap_b_to_glyph(S_water), WATER, 0, - 0, 0, 0, 0, 0, 0, 0 }; - static const struct rm air_pos = { cmap_b_to_glyph(S_cloud), AIR, 0, 0, 0, - 1, 0, 0, 0, 0 }; + static const struct rm water_pos = { + cmap_b_to_glyph(S_water), WATER, 0, 0, 0, 0, 0, 0, 0, 0 + }, air_pos = { + cmap_b_to_glyph(S_cloud), AIR, 0, 0, 0, 1, 0, 0, 0, 0 + }; static boolean up = FALSE; struct bubble *b; struct container *cons;