| 492 | } |
| 493 | |
| 494 | RESTORE_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 | */ |
| 505 | boolean |
| 506 | nhl_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 | |
| 525 | DISABLE_WARNING_UNREACHABLE_CODE |
| 526 |
no test coverage detected