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

Function nhl_get_xy_params

src/nhlua.c:494–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492}
493
494RESTORE_WARNING_UNREACHABLE_CODE
495
496/* get parameters (XX,YY) or ({ x = XX, y = YY }) or ({ XX, YY }),
497 and set the x and y values.
498 return TRUE if there are such params in the stack.
499 Note that this does not adjust the values of x and y at all from what is
500 specified in the level file; so, it returns absolute coordinates rather
501 than map-relative coordinates. Callers of this function must decide if
502 they want to interpret the values as absolute or as map-relative, and
503 adjust accordingly.
504 */
505boolean
506nhl_get_xy_params(lua_State *L, lua_Integer *x, lua_Integer *y)
507{
508 int argc = lua_gettop(L);
509 boolean ret = FALSE;
510
511 if (argc == 2) {
512 *x = lua_tointeger(L, 1);
513 *y = lua_tointeger(L, 2);
514 ret = TRUE;
515 } else if (argc == 1 && lua_type(L, 1) == LUA_TTABLE) {
516 lua_Integer ax, ay;
517
518 ret = get_coord(L, 1, &ax, &ay);
519 *x = ax;
520 *y = ay;
521 }
522 return ret;
523}
524
525DISABLE_WARNING_UNREACHABLE_CODE
526

Callers 9

nhl_gettrapFunction · 0.85
nhl_deltrapFunction · 0.85
nhl_getmapFunction · 0.85
nhl_timer_has_atFunction · 0.85
nhl_timer_peek_atFunction · 0.85
nhl_timer_stop_atFunction · 0.85
nhl_timer_start_atFunction · 0.85
l_selection_getpointFunction · 0.85
l_create_stairwayFunction · 0.85

Calls 1

get_coordFunction · 0.85

Tested by

no test coverage detected