ice Warning (trunk only)
This commit is contained in:
13
src/hack.c
13
src/hack.c
@@ -1485,6 +1485,19 @@ stillinwater:;
|
||||
if (trap && !pit)
|
||||
dotrap(trap, 0); /* fall into arrow trap, etc. */
|
||||
}
|
||||
/* Warning alerts you to ice danger */
|
||||
if (Warning && is_ice(u.ux,u.uy)) {
|
||||
static const char * const icewarnings[] = {
|
||||
"The ice seems very soft and slushy.",
|
||||
"You feel the ice shift beneath you!",
|
||||
"The ice, is gonna BREAK!", /* The Dead Zone */
|
||||
};
|
||||
long time_left = spot_time_left(u.ux, u.uy, MELT_ICE_AWAY);
|
||||
if (time_left && time_left < 15L)
|
||||
pline("%s",
|
||||
(time_left < 5L) ? icewarnings[2] :
|
||||
(time_left < 10L) ? icewarnings[1] : icewarnings[0]);
|
||||
}
|
||||
if((mtmp = m_at(u.ux, u.uy)) && !u.uswallow) {
|
||||
mtmp->mundetected = mtmp->msleeping = 0;
|
||||
switch(mtmp->data->mlet) {
|
||||
|
||||
@@ -1585,6 +1585,34 @@ short func_index;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* When is the spot timer of type func_index going to expire?
|
||||
* Returns 0L if no such timer.
|
||||
*/
|
||||
long
|
||||
spot_time_expires(x,y,func_index)
|
||||
xchar x,y;
|
||||
short func_index;
|
||||
{
|
||||
timer_element *curr;
|
||||
long where = (((long)x << 16) | ((long)y));
|
||||
|
||||
for (curr = timer_base; curr; curr = curr->next) {
|
||||
if (curr->kind == TIMER_LEVEL &&
|
||||
curr->func_index == func_index && curr->arg == (genericptr_t)where)
|
||||
return curr->timeout;
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
long
|
||||
spot_time_left(x,y,func_index)
|
||||
xchar x,y;
|
||||
short func_index;
|
||||
{
|
||||
long expires = spot_time_expires(x,y,func_index);
|
||||
return (expires > 0L) ? expires - monstermoves : 0L;
|
||||
}
|
||||
|
||||
/* Insert timer into the global queue */
|
||||
STATIC_OVL void
|
||||
|
||||
Reference in New Issue
Block a user