-$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.94 $ $NHDT-Date: 1562838835 2019/07/11 09:53:55 $
+$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.95 $ $NHDT-Date: 1564269131 2019/07/27 23:12:11 $
This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however,
fix theft when poly'd into nymph form; 3.6.2 change made that anger the victim
hero poly'd into nymph would steal gold along with other items
change wizard mode #panic to require "yes" if 'paranoid_confirm:quit' is set
+add some additional validation checks when setting up a new timer (triggered
+ by an ancient source comment rather than by any observed problems)
Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
-/* NetHack 3.6 timeout.h $NHDT-Date: 1432512775 2015/05/25 00:12:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
+/* NetHack 3.6 timeout.h $NHDT-Date: 1564269131 2019/07/27 23:12:11 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.12 $ */
/* Copyright 1994, Dean Luick */
/* NetHack may be freely redistributed. See license for details. */
/* kind of timer */
enum timer_type {
- TIMER_LEVEL = 0, /* event specific to level */
- TIMER_GLOBAL, /* event follows current play */
- TIMER_OBJECT, /* event follows a object */
- TIMER_MONSTER /* event follows a monster */
+ TIMER_LEVEL = 0, /* event specific to level [melting ice] */
+ TIMER_GLOBAL = 1, /* event follows current play [not used] */
+ TIMER_OBJECT = 2, /* event follows an object [various] */
+ TIMER_MONSTER = 3, /* event follows a monster [not used] */
+ NUM_TIMER_KINDS /* 4 */
};
/* save/restore timer ranges */
-/* NetHack 3.6 timeout.c $NHDT-Date: 1559664953 2019/06/04 16:15:53 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.90 $ */
+/* NetHack 3.6 timeout.c $NHDT-Date: 1564269133 2019/07/27 23:12:13 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.91 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */
short func_index;
anything *arg;
{
- timer_element *gnu;
+ timer_element *gnu, *dup;
- if (func_index < 0 || func_index >= NUM_TIME_FUNCS)
- panic("start_timer");
+ if (kind < 0 || kind >= NUM_TIMER_KINDS
+ || func_index < 0 || func_index >= NUM_TIME_FUNCS)
+ panic("start_timer (%s: %d)", kind_name(kind), (int) func_index);
- gnu = (timer_element *) alloc(sizeof(timer_element));
- (void) memset((genericptr_t)gnu, 0, sizeof(timer_element));
+ /* fail if <arg> already has a <func_index> timer running */
+ for (dup = timer_base; dup; dup = dup->next)
+ if (dup->kind == kind
+ && dup->func_index == func_index
+ && dup->arg.a_void == arg->a_void)
+ break;
+ if (dup) {
+ char idbuf[QBUFSZ];
+
+#ifdef VERBOSE_TIMER
+ Sprintf(idbuf, "%s timer", timeout_funcs[func_index].name);
+#else
+ Sprintf(idbuf, "%s timer (%d)", kind_name(kind), (int) func_index);
+#endif
+ impossible("Attempted to start duplicate %s, aborted.", idbuf);
+ return FALSE;
+ }
+
+ gnu = (timer_element *) alloc(sizeof *gnu);
+ (void) memset((genericptr_t) gnu, 0, sizeof *gnu);
gnu->next = 0;
gnu->tid = timer_id++;
gnu->timeout = monstermoves + when;
if (kind == TIMER_OBJECT) /* increment object's timed count */
(arg->a_obj)->timed++;
- /* should check for duplicates and fail if any */
return TRUE;
}