Add getGeometryLevel to scripting engine

This commit is contained in:
Benau 2023-01-22 14:47:40 +08:00
parent d0bbf8f5f4
commit be0c83e9a8

View File

@ -19,6 +19,7 @@
#include "script_track.hpp" #include "script_track.hpp"
#include "animations/three_d_animation.hpp" #include "animations/three_d_animation.hpp"
#include "config/user_config.hpp"
#include "font/digit_face.hpp" #include "font/digit_face.hpp"
#include "font/font_manager.hpp" #include "font/font_manager.hpp"
#include "graphics/central_settings.hpp" #include "graphics/central_settings.hpp"
@ -200,6 +201,11 @@ namespace Scripting
return RaceManager::get()->getMinorMode(); return RaceManager::get()->getMinorMode();
} }
int getGeometryLevel()
{
return UserConfigParams::m_geometry_level;
}
bool isDuringDay() bool isDuringDay()
{ {
return ::Track::getCurrentTrack()->getIsDuringDay(); return ::Track::getCurrentTrack()->getIsDuringDay();
@ -597,7 +603,11 @@ namespace Scripting
r = engine->RegisterGlobalFunction("int getMinorRaceMode()", r = engine->RegisterGlobalFunction("int getMinorRaceMode()",
mp ? WRAP_FN(getMinorRaceMode) : asFUNCTION(getMinorRaceMode), mp ? WRAP_FN(getMinorRaceMode) : asFUNCTION(getMinorRaceMode),
call_conv); assert(r >= 0); 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()", r = engine->RegisterGlobalFunction("bool isDuringDay()",
mp ? WRAP_FN(isDuringDay) : asFUNCTION(isDuringDay), mp ? WRAP_FN(isDuringDay) : asFUNCTION(isDuringDay),
call_conv); assert(r >= 0); call_conv); assert(r >= 0);