From be0c83e9a8a5451501c9b2877757c88c20bd09c0 Mon Sep 17 00:00:00 2001 From: Benau Date: Sun, 22 Jan 2023 14:47:40 +0800 Subject: [PATCH] Add getGeometryLevel to scripting engine --- src/scriptengine/script_track.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/scriptengine/script_track.cpp b/src/scriptengine/script_track.cpp index c2a27b53c..53fb32c1e 100644 --- a/src/scriptengine/script_track.cpp +++ b/src/scriptengine/script_track.cpp @@ -19,6 +19,7 @@ #include "script_track.hpp" #include "animations/three_d_animation.hpp" +#include "config/user_config.hpp" #include "font/digit_face.hpp" #include "font/font_manager.hpp" #include "graphics/central_settings.hpp" @@ -200,6 +201,11 @@ namespace Scripting return RaceManager::get()->getMinorMode(); } + int getGeometryLevel() + { + return UserConfigParams::m_geometry_level; + } + bool isDuringDay() { return ::Track::getCurrentTrack()->getIsDuringDay(); @@ -597,7 +603,11 @@ namespace Scripting r = engine->RegisterGlobalFunction("int getMinorRaceMode()", mp ? WRAP_FN(getMinorRaceMode) : asFUNCTION(getMinorRaceMode), call_conv); assert(r >= 0); - + + r = engine->RegisterGlobalFunction("int getGeometryLevel()", + mp ? WRAP_FN(getGeometryLevel) : asFUNCTION(getGeometryLevel), + call_conv); assert(r >= 0); + r = engine->RegisterGlobalFunction("bool isDuringDay()", mp ? WRAP_FN(isDuringDay) : asFUNCTION(isDuringDay), call_conv); assert(r >= 0);