Merge branch 'NetHack-3.6'
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
@@ -1866,13 +1866,32 @@ short kind;
|
||||
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 = g.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 = g.timer_id++;
|
||||
gnu->timeout = g.monstermoves + when;
|
||||
@@ -1885,7 +1904,6 @@ anything *arg;
|
||||
if (kind == TIMER_OBJECT) /* increment object's timed count */
|
||||
(arg->a_obj)->timed++;
|
||||
|
||||
/* should check for duplicates and fail if any */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user