Simplify getGameTime function usage (#15187)

This commit is contained in:
Erich Schubert 2024-09-20 15:05:51 +02:00 committed by GitHub
parent 811adf5d42
commit 4ac86db8e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -749,10 +749,7 @@ int ModApiEnv::l_get_timeofday(lua_State *L)
{ {
GET_PLAIN_ENV_PTR; GET_PLAIN_ENV_PTR;
// Do it lua_pushnumber(L, env->getTimeOfDayF());
int timeofday_mh = env->getTimeOfDay();
float timeofday_f = (float)timeofday_mh / 24000.0f;
lua_pushnumber(L, timeofday_f);
return 1; return 1;
} }
@ -770,8 +767,7 @@ int ModApiEnv::l_get_gametime(lua_State *L)
{ {
GET_ENV_PTR; GET_ENV_PTR;
int game_time = env->getGameTime(); lua_pushnumber(L, env->getGameTime());
lua_pushnumber(L, game_time);
return 1; return 1;
} }