From 8cd62ce159a7c9efbeca8131be7c3efeb90f6f3c Mon Sep 17 00:00:00 2001 From: Dino Date: Mon, 18 May 2026 00:31:00 -0400 Subject: [PATCH] lua: add function (Tile).latitude RM #2031 --- common/scriptcore/api_game_methods.c | 11 +++++++++++ common/scriptcore/api_game_methods.h | 1 + common/scriptcore/tolua_game.pkg | 2 ++ 3 files changed, 14 insertions(+) diff --git a/common/scriptcore/api_game_methods.c b/common/scriptcore/api_game_methods.c index e222ee8d8b..f921868aed 100644 --- a/common/scriptcore/api_game_methods.c +++ b/common/scriptcore/api_game_methods.c @@ -1239,6 +1239,17 @@ int api_methods_tile_map_y(lua_State *L, Tile *ptile) return index_to_map_pos_y(tile_index(ptile)); } +/**********************************************************************//** + Return the latitude of the tile. +**************************************************************************/ +int api_methods_tile_latitude(lua_State *L, Tile *ptile) +{ + LUASCRIPT_CHECK_STATE(L, -1); + LUASCRIPT_CHECK_SELF(L, ptile, -1); + + return map_signed_latitude(ptile); +} + /**********************************************************************//** Return City on ptile, else NULL **************************************************************************/ diff --git a/common/scriptcore/api_game_methods.h b/common/scriptcore/api_game_methods.h index e41a41892f..bb9bfc1d39 100644 --- a/common/scriptcore/api_game_methods.h +++ b/common/scriptcore/api_game_methods.h @@ -175,6 +175,7 @@ int api_methods_tile_nat_x(lua_State *L, Tile *ptile); int api_methods_tile_nat_y(lua_State *L, Tile *ptile); int api_methods_tile_map_x(lua_State *L, Tile *ptile); int api_methods_tile_map_y(lua_State *L, Tile *ptile); +int api_methods_tile_latitude(lua_State *L, Tile *ptile); City *api_methods_tile_city(lua_State *L, Tile *ptile); bool api_methods_tile_city_exists_within_max_city_map(lua_State *L, Tile *ptile, diff --git a/common/scriptcore/tolua_game.pkg b/common/scriptcore/tolua_game.pkg index abaa38a6a8..3f01c6e114 100644 --- a/common/scriptcore/tolua_game.pkg +++ b/common/scriptcore/tolua_game.pkg @@ -385,6 +385,8 @@ module Tile { @ y (lua_State *L, Tile *self); } + int api_methods_tile_latitude + @ latitude (lua_State *L, Tile *self); City *api_methods_tile_city @ city (lua_State *L, Tile *self); bool api_methods_tile_city_exists_within_max_city_map -- 2.31.0