MCPcopy Index your code
hub / github.com/NetHack/NetHack / nhl_timer_start_at

Function nhl_timer_start_at

src/nhlua.c:1611–1638  ·  view source on GitHub ↗

start timer at location x,y */ nh.start_timer_at(x,y, "melt-ice", 10); */

Source from the content-addressed store, hash-verified

1609/* start timer at location x,y */
1610/* nh.start_timer_at(x,y, "melt-ice", 10); */
1611staticfn int
1612nhl_timer_start_at(lua_State *L)
1613{
1614 short timertype = nhl_get_timertype(L, -2);
1615 long when = lua_tointeger(L, -1);
1616 lua_Integer lx, ly;
1617 coordxy x, y;
1618
1619 lua_pop(L, 2); /* remove when and timertype */
1620 if (!nhl_get_xy_params(L, &lx, &ly)) {
1621 nhl_error(L, "nhl_timer_start_at: Wrong args");
1622 /*NOTREACHED*/
1623 return 0;
1624 }
1625
1626 x = (coordxy) lx;
1627 y = (coordxy) ly;
1628 cvt_to_abscoord(&x, &y);
1629
1630 if (timer_is_pos(timertype) && isok(x, y)) {
1631 long where = ((long) x << 16) | (long) y;
1632
1633 spot_stop_timers(x, y, timertype);
1634 (void) start_timer((long) when, TIMER_LEVEL, MELT_ICE_AWAY,
1635 long_to_any(where));
1636 }
1637 return 0;
1638}
1639
1640/* returns the visual interpretation of the key bound to an extended command,
1641 or the ext cmd name if not bound to any key */

Callers

nothing calls this directly

Calls 8

nhl_get_timertypeFunction · 0.85
nhl_get_xy_paramsFunction · 0.85
nhl_errorFunction · 0.85
cvt_to_abscoordFunction · 0.85
isokFunction · 0.85
spot_stop_timersFunction · 0.85
start_timerFunction · 0.85
long_to_anyFunction · 0.85

Tested by

no test coverage detected