summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoraK-FDF <horak-fdf@web.de>2024-04-18 00:46:16 +0200
committerFree Yorp <thefreeyorp+git@gmail.com>2024-04-20 20:06:13 +0000
commit3f214c06c13dfc4c4eb42a3f24553d7a1d30b26d (patch)
tree14ea53b1b42812c63f70df845fb691061c76a4fb
parentb301141dd36b0dc5d7289ffe504e17cf4c2921e1 (diff)
downloadtmwa-3f214c06c13dfc4c4eb42a3f24553d7a1d30b26d.tar.gz
tmwa-3f214c06c13dfc4c4eb42a3f24553d7a1d30b26d.tar.bz2
tmwa-3f214c06c13dfc4c4eb42a3f24553d7a1d30b26d.tar.xz
tmwa-3f214c06c13dfc4c4eb42a3f24553d7a1d30b26d.zip
getmapmaxx getmapmaxy
-rw-r--r--src/map/script-fun.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 8dc1989..2be0333 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -5472,6 +5472,30 @@ void builtin_getmap(ScriptState *st)
}
/*==========================================
+ * Get the maximum x coordinate of a map
+ *------------------------------------------
+ */
+static
+void builtin_getmapmaxx(ScriptState *st)
+{
+ MapName mapname = stringish<MapName>(ZString(conv_str(st, &AARG(0))));
+ P<map_local> m = TRY_UNWRAP(map_mapname2mapid(mapname), return);
+ push_int<ScriptDataInt>(st->stack, m->xs-1);
+}
+
+/*==========================================
+ * Get the maximum y coordinate of a map
+ *------------------------------------------
+ */
+static
+void builtin_getmapmaxy(ScriptState *st)
+{
+ MapName mapname = stringish<MapName>(ZString(conv_str(st, &AARG(0))));
+ P<map_local> m = TRY_UNWRAP(map_mapname2mapid(mapname), return);
+ push_int<ScriptDataInt>(st->stack, m->ys-1);
+}
+
+/*==========================================
* Get the NPC's info
*------------------------------------------
*/
@@ -5732,6 +5756,8 @@ BuiltinFunction builtin_functions[] =
BUILTIN(getnpcy, "?"_s, 'i'),
BUILTIN(strnpcinfo, "i?"_s, 's'),
BUILTIN(getmap, "?"_s, 's'),
+ BUILTIN(getmapmaxx, "M"_s, 'i'),
+ BUILTIN(getmapmaxy, "M"_s, 'i'),
BUILTIN(mapexit, ""_s, '\0'),
BUILTIN(freeloop, "i"_s, '\0'),
BUILTIN(if_then_else, "iii"_s, 'v'),