From dc8d63fb15236eceab0ace87f2dd9dc537905dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Wed, 4 Jan 2023 21:35:58 +0100 Subject: [PATCH] Preprocessor purge round 10: LUACONSOLE --- meson.build | 1 + src/Config.template.h | 2 +- src/config/font/meson.build | 1 - src/config/powder/meson.build | 1 - src/config/render/meson.build | 1 - src/gui/game/IntroText.h | 7 ++++--- src/lua/LegacyLuaAPI.cpp | 4 ---- src/lua/LuaBit.cpp | 3 --- src/lua/LuaButton.cpp | 5 ----- src/lua/LuaCheckbox.cpp | 5 ----- src/lua/LuaComponent.cpp | 3 --- src/lua/LuaLabel.cpp | 5 ----- src/lua/LuaProgressBar.cpp | 5 ----- src/lua/LuaSlider.cpp | 5 ----- src/lua/LuaSmartRef.cpp | 3 --- src/lua/LuaTextbox.cpp | 5 ----- src/lua/LuaWindow.cpp | 3 --- 17 files changed, 6 insertions(+), 53 deletions(-) diff --git a/meson.build b/meson.build index b5989cb45..825bb41b3 100644 --- a/meson.build +++ b/meson.build @@ -349,6 +349,7 @@ conf_data.set('APPEXE', app_exe) conf_data.set('APPID', app_id) conf_data.set('APPDATA', get_option('app_data')) conf_data.set('APPVENDOR', get_option('app_vendor')) +conf_data.set('LUACONSOLE', lua_variant != 'none' ? 'true' : 'false') data_files = [] diff --git a/src/Config.template.h b/src/Config.template.h index 15e6f9519..69a7d9727 100644 --- a/src/Config.template.h +++ b/src/Config.template.h @@ -2,7 +2,6 @@ #include // Boolean macros (defined / not defined), would be great to get rid of them all. -#mesondefine LUACONSOLE #mesondefine NOHTTP #mesondefine GRAVFFT #mesondefine RENDERER @@ -17,6 +16,7 @@ #mesondefine MACOSX #mesondefine X86 +constexpr bool LUACONSOLE = @LUACONSOLE@; constexpr bool ALLOW_FAKE_NEWER_VERSION = @ALLOW_FAKE_NEWER_VERSION@; constexpr bool USE_UPDATESERVER = @USE_UPDATESERVER@; constexpr bool INSTALL_CHECK = @INSTALL_CHECK@; diff --git a/src/config/font/meson.build b/src/config/font/meson.build index 44c65f26d..2a84c60f4 100644 --- a/src/config/font/meson.build +++ b/src/config/font/meson.build @@ -1,7 +1,6 @@ font_conf_data = conf_data font_conf_data.set('FONTEDITOR', true) font_conf_data.set('RENDERER', false) -font_conf_data.set('LUACONSOLE', false) font_conf_data.set('NOHTTP', true) font_conf_data.set('GRAVFFT', false) configure_file( diff --git a/src/config/powder/meson.build b/src/config/powder/meson.build index 3fbc8cb55..86d580840 100644 --- a/src/config/powder/meson.build +++ b/src/config/powder/meson.build @@ -1,7 +1,6 @@ powder_conf_data = conf_data powder_conf_data.set('FONTEDITOR', false) powder_conf_data.set('RENDERER', false) -powder_conf_data.set('LUACONSOLE', lua_variant != 'none') powder_conf_data.set('NOHTTP', not enable_http) powder_conf_data.set('GRAVFFT', enable_gravfft) configure_file( diff --git a/src/config/render/meson.build b/src/config/render/meson.build index aaa90b3be..94adcd954 100644 --- a/src/config/render/meson.build +++ b/src/config/render/meson.build @@ -1,7 +1,6 @@ render_conf_data = conf_data render_conf_data.set('FONTEDITOR', false) render_conf_data.set('RENDERER', true) -render_conf_data.set('LUACONSOLE', false) render_conf_data.set('NOHTTP', true) render_conf_data.set('GRAVFFT', false) configure_file( diff --git a/src/gui/game/IntroText.h b/src/gui/game/IntroText.h index d82750414..22454d1c1 100644 --- a/src/gui/game/IntroText.h +++ b/src/gui/game/IntroText.h @@ -41,9 +41,10 @@ inline ByteString IntroText() #elif defined(MOD) sb << " MODVER " << SNAPSHOT_ID; #endif -#ifdef LUACONSOLE - sb << " LUACONSOLE"; -#endif + if constexpr (LUACONSOLE) + { + sb << " LUACONSOLE"; + } #ifdef GRAVFFT sb << " GRAVFFT"; #endif diff --git a/src/lua/LegacyLuaAPI.cpp b/src/lua/LegacyLuaAPI.cpp index a8d4a946d..c2e9e5403 100644 --- a/src/lua/LegacyLuaAPI.cpp +++ b/src/lua/LegacyLuaAPI.cpp @@ -1,6 +1,4 @@ #include "Config.h" -#ifdef LUACONSOLE - #include "client/http/Request.h" // includes curl.h, needs to come first to silence a warning on windows #include @@ -1369,5 +1367,3 @@ int luatpt_perfectCircle(lua_State* l) luacon_model->SetPerfectCircle(lua_toboolean(l, 1)); return 0; } - -#endif diff --git a/src/lua/LuaBit.cpp b/src/lua/LuaBit.cpp index 5dae78d3d..d5e1a98a8 100644 --- a/src/lua/LuaBit.cpp +++ b/src/lua/LuaBit.cpp @@ -1,5 +1,3 @@ -#include "Config.h" -#ifdef LUACONSOLE /* ** Lua BitOp -- a bit operations library for Lua 5.1/5.2. ** http://bitop.luajit.org/ @@ -189,4 +187,3 @@ int luaopen_bit(lua_State *L) //#endif return 1; } -#endif diff --git a/src/lua/LuaButton.cpp b/src/lua/LuaButton.cpp index eb766bc21..352895f26 100644 --- a/src/lua/LuaButton.cpp +++ b/src/lua/LuaButton.cpp @@ -1,10 +1,6 @@ #include "Config.h" -#ifdef LUACONSOLE - #include "LuaButton.h" - #include "LuaScriptInterface.h" - #include "gui/interface/Button.h" const char LuaButton::className[] = "Button"; @@ -88,4 +84,3 @@ void LuaButton::triggerAction() LuaButton::~LuaButton() { } -#endif diff --git a/src/lua/LuaCheckbox.cpp b/src/lua/LuaCheckbox.cpp index 5807d4a8e..c7cbee365 100644 --- a/src/lua/LuaCheckbox.cpp +++ b/src/lua/LuaCheckbox.cpp @@ -1,10 +1,6 @@ #include "Config.h" -#ifdef LUACONSOLE - #include "LuaCheckbox.h" - #include "LuaScriptInterface.h" - #include "gui/interface/Checkbox.h" const char LuaCheckbox::className[] = "Checkbox"; @@ -87,4 +83,3 @@ void LuaCheckbox::triggerAction() LuaCheckbox::~LuaCheckbox() { } -#endif diff --git a/src/lua/LuaComponent.cpp b/src/lua/LuaComponent.cpp index 886771f50..513a24ab9 100644 --- a/src/lua/LuaComponent.cpp +++ b/src/lua/LuaComponent.cpp @@ -1,6 +1,4 @@ #include "Config.h" -#ifdef LUACONSOLE - #include "LuaComponent.h" #include "LuaScriptInterface.h" @@ -94,4 +92,3 @@ LuaComponent::~LuaComponent() delete component; } } -#endif diff --git a/src/lua/LuaLabel.cpp b/src/lua/LuaLabel.cpp index 349c74e54..430590945 100644 --- a/src/lua/LuaLabel.cpp +++ b/src/lua/LuaLabel.cpp @@ -1,10 +1,6 @@ #include "Config.h" -#ifdef LUACONSOLE - #include "LuaScriptInterface.h" - #include "LuaLabel.h" - #include "gui/interface/Label.h" const char LuaLabel::className[] = "Label"; @@ -50,4 +46,3 @@ int LuaLabel::text(lua_State * l) LuaLabel::~LuaLabel() { } -#endif diff --git a/src/lua/LuaProgressBar.cpp b/src/lua/LuaProgressBar.cpp index f4faba654..c0c316b1a 100644 --- a/src/lua/LuaProgressBar.cpp +++ b/src/lua/LuaProgressBar.cpp @@ -1,10 +1,6 @@ #include "Config.h" -#ifdef LUACONSOLE - #include "LuaProgressBar.h" - #include "LuaScriptInterface.h" - #include "gui/interface/ProgressBar.h" const char LuaProgressBar::className[] = "ProgressBar"; @@ -66,4 +62,3 @@ int LuaProgressBar::status(lua_State * l) LuaProgressBar::~LuaProgressBar() { } -#endif diff --git a/src/lua/LuaSlider.cpp b/src/lua/LuaSlider.cpp index e79eb693f..3bcdcba53 100644 --- a/src/lua/LuaSlider.cpp +++ b/src/lua/LuaSlider.cpp @@ -1,10 +1,6 @@ #include "Config.h" -#ifdef LUACONSOLE - #include "LuaSlider.h" - #include "LuaScriptInterface.h" - #include "gui/interface/Slider.h" const char LuaSlider::className[] = "Slider"; @@ -87,4 +83,3 @@ void LuaSlider::triggerOnValueChanged() LuaSlider::~LuaSlider() { } -#endif diff --git a/src/lua/LuaSmartRef.cpp b/src/lua/LuaSmartRef.cpp index 4503a7f77..5c0afce18 100644 --- a/src/lua/LuaSmartRef.cpp +++ b/src/lua/LuaSmartRef.cpp @@ -1,5 +1,4 @@ #include "Config.h" -#ifdef LUACONSOLE #include "LuaSmartRef.h" void LuaSmartRef::Clear() @@ -37,5 +36,3 @@ int LuaSmartRef::Push(lua_State *l) lua_rawgeti(l, LUA_REGISTRYINDEX, ref); return lua_type(l, -1); } - -#endif diff --git a/src/lua/LuaTextbox.cpp b/src/lua/LuaTextbox.cpp index 16adcd466..97f12fb78 100644 --- a/src/lua/LuaTextbox.cpp +++ b/src/lua/LuaTextbox.cpp @@ -1,10 +1,6 @@ #include "Config.h" -#ifdef LUACONSOLE - #include "LuaTextbox.h" - #include "LuaScriptInterface.h" - #include "gui/interface/Textbox.h" const char LuaTextbox::className[] = "Textbox"; @@ -90,4 +86,3 @@ int LuaTextbox::text(lua_State * l) LuaTextbox::~LuaTextbox() { } -#endif diff --git a/src/lua/LuaWindow.cpp b/src/lua/LuaWindow.cpp index d88cd76ef..a13be35a7 100644 --- a/src/lua/LuaWindow.cpp +++ b/src/lua/LuaWindow.cpp @@ -1,6 +1,4 @@ #include "Config.h" -#ifdef LUACONSOLE - #include "LuaWindow.h" #include "LuaScriptInterface.h" @@ -511,4 +509,3 @@ LuaWindow::~LuaWindow() window->CloseActiveWindow(); delete window; } -#endif