Skip to content

Commit e486d94

Browse files
author
PatR
committed
couple of #wizintrinsic fixes
When #wizinstrinsic was expanded to be able to set any timed attribute, some that need more than just a timeout counter were left inconsistent. 1) Timed Flying wasn't blocked by levitation, and existing flight wasn't becoming blocked by timed levitation. Also, eventual flight timeout wasn't updating the status line, so false 'Fly' condition remained shown until a status update happened for some other reason. 2) Setting timer for Warn_of_mon didn't set up any type of monster to warn about so wouldn't do anything. This sets that to grid bug unless already set due to polymorph form or artifact that warns. The end.c portion is just a bit of formatting.
1 parent 26171ed commit e486d94

4 files changed

Lines changed: 42 additions & 7 deletions

File tree

‎doc/fixes36.2‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ attempting to #ride a long worm's tail could trigger impossible "worm_cross
192192
avoid "The " in "The <known-artifact-but-not-The-artifact> falls down stairs."
193193
avoid potential buffer overflow if object with very long name knocks other
194194
objects down stairs when dropped, thrown, or kicked there
195+
#wizintrinsic for 'flying' didn't update status line when flying ended
196+
#wizintrinsic for 'warn_of_mon' didn't set any type of monster (now grid bugs)
195197

196198

197199
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

‎src/cmd.c‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* NetHack 3.6 cmd.c $NHDT-Date: 1541631031 2018/11/07 22:50:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.299 $ */
1+
/* NetHack 3.6 cmd.c $NHDT-Date: 1541902950 2018/11/11 02:22:30 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.301 $ */
22
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
33
/*-Copyright (c) Robert Patrick Rankin, 2013. */
44
/* NetHack may be freely redistributed. See license for details. */
@@ -1423,7 +1423,19 @@ wiz_intrinsic(VOID_ARGS)
14231423
make_vomiting(newtimeout, FALSE);
14241424
pline1(buf);
14251425
break;
1426+
case WARN_OF_MON:
1427+
if (!Warn_of_mon) {
1428+
context.warntype.speciesidx = PM_GRID_BUG;
1429+
context.warntype.species
1430+
= &mons[context.warntype.speciesidx];
1431+
}
1432+
goto def_feedback;
1433+
case LEVITATION:
1434+
case FLYING:
1435+
float_vs_flight();
1436+
/*FALLTHRU*/
14261437
default:
1438+
def_feedback:
14271439
pline("Timeout for %s %s %d.", propertynames[i].prop_name,
14281440
oldtimeout ? "increased by" : "set to", amt);
14291441
incr_itimeout(&u.uprops[p].intrinsic, amt);

‎src/end.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* NetHack 3.6 end.c $NHDT-Date: 1540767809 2018/10/28 23:03:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.148 $ */
1+
/* NetHack 3.6 end.c $NHDT-Date: 1541902951 2018/11/11 02:22:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.150 $ */
22
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
33
/*-Copyright (c) Robert Patrick Rankin, 2012. */
44
/* NetHack may be freely redistributed. See license for details. */
@@ -2009,10 +2009,10 @@ const char *killername;
20092009
{
20102010
struct kinfo *k = find_delayed_killer(id);
20112011

2012-
if (k == (struct kinfo *) 0) {
2012+
if (!k) {
20132013
/* no match, add a new delayed killer to the list */
2014-
k = (struct kinfo *) alloc(sizeof(struct kinfo));
2015-
(void) memset((genericptr_t)k, 0, sizeof(struct kinfo));
2014+
k = (struct kinfo *) alloc(sizeof (struct kinfo));
2015+
(void) memset((genericptr_t) k, 0, sizeof (struct kinfo));
20162016
k->id = id;
20172017
k->next = killer.next;
20182018
killer.next = k;

‎src/timeout.c‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* NetHack 3.6 timeout.c $NHDT-Date: 1505214876 2017/09/12 11:14:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.75 $ */
1+
/* NetHack 3.6 timeout.c $NHDT-Date: 1541902953 2018/11/11 02:22:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.84 $ */
22
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
33
/*-Copyright (c) Robert Patrick Rankin, 2018. */
44
/* NetHack may be freely redistributed. See license for details. */
@@ -45,7 +45,7 @@ const struct propname {
4545
{ SEE_INVIS, "see invisible" },
4646
{ INVIS, "invisible" },
4747
/* properties beyond here don't have timed values during normal play,
48-
so there's no much point in trying to order them sensibly;
48+
so there's not much point in trying to order them sensibly;
4949
they're either on or off based on equipment, role, actions, &c */
5050
{ FIRE_RES, "fire resistance" },
5151
{ COLD_RES, "cold resistance" },
@@ -367,6 +367,7 @@ nh_timeout()
367367
{
368368
register struct prop *upp;
369369
struct kinfo *kptr;
370+
boolean was_flying;
370371
int sleeptime;
371372
int m_idx;
372373
int baseluck = (flags.moonphase == FULL_MOON) ? 1 : 0;
@@ -431,6 +432,7 @@ nh_timeout()
431432
pline("%s stops galloping.", Monnam(u.usteed));
432433
}
433434

435+
was_flying = Flying;
434436
for (upp = u.uprops; upp < u.uprops + SIZE(u.uprops); upp++)
435437
if ((upp->intrinsic & TIMEOUT) && !(--upp->intrinsic & TIMEOUT)) {
436438
kptr = find_delayed_killer((int) (upp - u.uprops));
@@ -554,6 +556,25 @@ nh_timeout()
554556
case LEVITATION:
555557
(void) float_down(I_SPECIAL | TIMEOUT, 0L);
556558
break;
559+
case FLYING:
560+
/* timed Flying is via #wizintrinsic only */
561+
if (was_flying && !Flying) {
562+
context.botl = 1;
563+
You("land.");
564+
spoteffects(TRUE);
565+
}
566+
break;
567+
case WARN_OF_MON:
568+
/* timed Warn_of_mon is via #wizintrinsic only */
569+
if (!Warn_of_mon) {
570+
context.warntype.speciesidx = NON_PM;
571+
if (context.warntype.species) {
572+
You("are no longer warned about %s.",
573+
makeplural(context.warntype.species->mname));
574+
context.warntype.species = (struct permonst *) 0;
575+
}
576+
}
577+
break;
557578
case PASSES_WALLS:
558579
if (!Passes_walls) {
559580
if (stuck_in_wall())

0 commit comments

Comments
 (0)