From 6127c1084831e2ac89ef28e9305e974aabf8619f Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 5 May 2019 15:20:09 -0700 Subject: [PATCH] comment/formatting tidbits Some miscellaneous stuff I don't want to discard of lose track of. No change it actual code. --- src/botl.c | 20 +++++++++++++++----- src/dogmove.c | 24 +++++++++++------------- src/end.c | 11 ++++++++++- src/monmove.c | 9 +++++---- 4 files changed, 41 insertions(+), 23 deletions(-) diff --git a/src/botl.c b/src/botl.c index b961c75bc..f43c0f498 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 botl.c $NHDT-Date: 1554857126 2019/04/10 00:45:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.144 $ */ +/* NetHack 3.6 botl.c $NHDT-Date: 1557094795 2019/05/05 22:19:55 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.145 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -811,6 +811,15 @@ boolean *valsetlist; } #endif + /* + * TODO? + * It's possible for HPmax (or ENEmax) to change while current + * HP (or energy) stays the same. [Perhaps current and maximum + * both go up, then before the next status update takes place + * current goes down again.] If that happens with HPmax, we + * ought to force the windowport to treat current HP as changed + * if hitpointbar is On, in order for that to be re-rendered. + */ if (update_all || chg || reset) { idxmax = curr->idxmax; pc = (idxmax >= 0) ? percentage(curr, &blstats[idx][idxmax]) : 0; @@ -892,8 +901,8 @@ boolean *valsetlist; if (context.botlx && (windowprocs.wincap2 & WC2_RESET_STATUS) != 0L) status_update(BL_RESET, (genericptr_t) 0, 0, 0, NO_COLOR, (unsigned long *) 0); - else if ((updated || context.botlx) && - (windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L) + else if ((updated || context.botlx) + && (windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L) status_update(BL_FLUSH, (genericptr_t) 0, 0, 0, NO_COLOR, (unsigned long *) 0); @@ -1376,7 +1385,8 @@ const char *name; STATIC_OVL boolean hilite_reset_needed(bl_p, augmented_time) struct istat_s *bl_p; -long augmented_time; +long augmented_time; /* no longer augmented; it once encoded fractional + * amounts for multiple moves within same turn */ { /* * This 'multi' handling may need some tuning... @@ -1434,7 +1444,7 @@ status_eval_next_unhilite() } } -/* called by options handling when 'statushilites' boolean is toggled */ +/* called by options handling when 'statushilites' value is changed */ void reset_status_hilites() { diff --git a/src/dogmove.c b/src/dogmove.c index 552da454b..df3452faa 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dogmove.c $NHDT-Date: 1551493951 2019/03/02 02:32:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.72 $ */ +/* NetHack 3.6 dogmove.c $NHDT-Date: 1557094801 2019/05/05 22:20:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.74 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -379,8 +379,9 @@ struct edog *edog; else You_feel("worried about %s.", y_monnam(mtmp)); stop_occupation(); - } else if (monstermoves > edog->hungrytime + 750 || DEADMONSTER(mtmp)) { - dog_died: + } else if (monstermoves > edog->hungrytime + 750 + || DEADMONSTER(mtmp)) { + dog_died: if (mtmp->mleashed && mtmp != u.usteed) Your("leash goes slack."); else if (cansee(mtmp->mx, mtmp->my)) @@ -615,7 +616,6 @@ int after, udist, whappr; return appr; } - STATIC_OVL struct monst * find_targ(mtmp, dx, dy, maxdist) register struct monst *mtmp; @@ -644,14 +644,13 @@ int maxdist; if (!m_cansee(mtmp, curx, cury)) break; - targ = m_at(curx, cury); - if (curx == mtmp->mux && cury == mtmp->muy) return &youmonst; - if (targ) { + if ((targ = m_at(curx, cury)) != 0) { /* Is the monster visible to the pet? */ - if ((!targ->minvis || perceives(mtmp->data)) && !targ->mundetected) + if ((!targ->minvis || perceives(mtmp->data)) + && !targ->mundetected) break; /* If the pet can't see it, it assumes it aint there */ targ = 0; @@ -807,7 +806,6 @@ struct monst *mtmp, *mtarg; return score; } - STATIC_OVL struct monst * best_target(mtmp) struct monst *mtmp; /* Pet */ @@ -859,7 +857,6 @@ struct monst *mtmp; /* Pet */ return best_targ; } - /* return 0 (no move), 1 (move) or 2 (dead) */ int dog_move(mtmp, after) @@ -1124,7 +1121,7 @@ int after; /* this is extra fast monster movement */ chcnt = 0; chi = i; } - nxti: + nxti: ; } @@ -1139,6 +1136,7 @@ int after; /* this is extra fast monster movement */ /* How hungry is the pet? */ if (!mtmp->isminion) { struct edog *dog = EDOG(mtmp); + hungry = (monstermoves > (dog->hungrytime + 300)); } @@ -1184,7 +1182,7 @@ int after; /* this is extra fast monster movement */ } } -newdogpos: + newdogpos: if (nix != omx || niy != omy) { boolean wasseen; @@ -1256,7 +1254,7 @@ newdogpos: } cc.x = mtmp->mx; cc.y = mtmp->my; - dognext: + dognext: if (!m_in_out_region(mtmp, nix, niy)) return 1; remove_monster(mtmp->mx, mtmp->my); diff --git a/src/end.c b/src/end.c index 73860ace4..ecf71a457 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1554591224 2019/04/06 22:53:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.168 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1557094801 2019/05/05 22:20:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.170 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -500,6 +500,15 @@ int how; } Strcpy(killer.name, buf); + /* + * Chicken and egg issue: + * Ordinarily Unchanging ought to override something like this, + * but the transformation occurs at death. With the current code, + * the effectiveness of Unchanging stops first, but a case could + * be made that it should last long enough to prevent undead + * transformation. (Turning to slime isn't an issue here because + * Unchanging prevents that from happening.) + */ if (mptr->mlet == S_WRAITH) u.ugrave_arise = PM_WRAITH; else if (mptr->mlet == S_MUMMY && urace.mummynum != NON_PM) diff --git a/src/monmove.c b/src/monmove.c index 942124c28..2f7ae6f5c 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 monmove.c $NHDT-Date: 1545596010 2018/12/23 20:13:30 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.111 $ */ +/* NetHack 3.6 monmove.c $NHDT-Date: 1557094802 2019/05/05 22:20:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.113 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -541,7 +541,7 @@ register struct monst *mtmp; } } } -toofar: + toofar: /* If monster is nearby you, and has to wield a weapon, do so. This * costs the monster a move, of course. @@ -982,7 +982,7 @@ register int after; if ((likegold || likegems || likeobjs || likemagic || likerock || conceals) && (!*in_rooms(omx, omy, SHOPBASE) || (!rn2(25) && !mtmp->isshk))) { - look_for_obj: + look_for_obj: oomx = min(COLNO - 1, omx + minr); oomy = min(ROWNO - 1, omy + minr); lmx = max(1, omx - minr); @@ -1572,6 +1572,7 @@ register struct monst *mtmp; if (!gotu) { register int try_cnt = 0; + do { if (++try_cnt > 200) goto found_you; /* punt */ @@ -1585,7 +1586,7 @@ register struct monst *mtmp; && (can_ooze(mtmp) || can_fog(mtmp))))) || !couldsee(mx, my)); } else { - found_you: + found_you: mx = u.ux; my = u.uy; }