From ae07c55f4da7f8eacb6b30824190a0b55bda9d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Fri, 26 Jan 2024 18:51:15 +0100 Subject: [PATCH] Add some sign api constants --- src/lua/LuaSimulation.cpp | 8 ++++++++ src/simulation/Sign.h | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/lua/LuaSimulation.cpp b/src/lua/LuaSimulation.cpp index 14e79c177..dfc7235dd 100644 --- a/src/lua/LuaSimulation.cpp +++ b/src/lua/LuaSimulation.cpp @@ -2083,6 +2083,14 @@ void LuaSimulation::Open(lua_State *L) lua_setfield(L, -2, "new"); lua_pushcfunction(L, Sign_delete); lua_setfield(L, -2, "delete"); +#define LCONSTAS(k, v) lua_pushinteger(L, int(v)); lua_setfield(L, -2, k) + LCONSTAS("JUSTMODE_LEFT" , sign::Left), + LCONSTAS("JUSTMODE_MIDDLE", sign::Middle), + LCONSTAS("JUSTMODE_RIGHT" , sign::Right), + LCONSTAS("JUSTMODE_NONE" , sign::None), + LCONSTAS("NUM_JUSTMODES" , sign::Max), + LCONSTAS("MAX_SIGNS" , MAXSIGNS), +#undef LCONSTAS lua_setfield(L, -2, "signs"); } lua_pushvalue(L, -1); diff --git a/src/simulation/Sign.h b/src/simulation/Sign.h index 0d4f514ac..25849c090 100644 --- a/src/simulation/Sign.h +++ b/src/simulation/Sign.h @@ -8,10 +8,11 @@ struct sign { enum Justification { - Left = 0, - Middle = 1, - Right = 2, - None = 3 + Left, + Middle, + Right, + None, + Max, }; enum Type