MCPcopy Create free account
hub / github.com/NetHack/NetHack / nhl_timer_stop_at

Function nhl_timer_stop_at

src/nhlua.c:1586–1607  ·  view source on GitHub ↗

stop timer at location x,y */ nh.stop_timer_at(x,y, "melt-ice"); */ nh.stop_timer_at({x=6,y=8}, "melt-ice"); */

Source from the content-addressed store, hash-verified

1584/* nh.stop_timer_at(x,y, "melt-ice"); */
1585/* nh.stop_timer_at({x=6,y=8}, "melt-ice"); */
1586staticfn int
1587nhl_timer_stop_at(lua_State *L)
1588{
1589 short timertype = nhl_get_timertype(L, -1);
1590 lua_Integer lx, ly;
1591 coordxy x, y;
1592
1593 lua_pop(L, 1); /* remove timertype */
1594 if (!nhl_get_xy_params(L, &lx, &ly)) {
1595 nhl_error(L, "nhl_timer_stop_at: Wrong args");
1596 /*NOTREACHED*/
1597 return 0;
1598 }
1599
1600 x = (coordxy) lx;
1601 y = (coordxy) ly;
1602 cvt_to_abscoord(&x, &y);
1603
1604 if (timer_is_pos(timertype) && isok(x, y))
1605 spot_stop_timers(x, y, timertype);
1606 return 0;
1607}
1608
1609/* start timer at location x,y */
1610/* nh.start_timer_at(x,y, "melt-ice", 10); */

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected