restrict ambientAirTemp to valid limits when set from Lua

This commit is contained in:
jacob1 2021-06-18 23:37:04 -04:00
parent 3c9882598c
commit 6bd1289bdd
No known key found for this signature in database
GPG Key ID: 4E58A32D510E1995

View File

@ -1935,7 +1935,7 @@ int LuaScriptInterface::simulation_ambientAirTemp(lua_State * l)
lua_pushnumber(l, luacon_sim->air->ambientAirTemp);
return 1;
}
float ambientAirTemp = luaL_optnumber(l, 1, 295.15f);
float ambientAirTemp = restrict_flt(luaL_optnumber(l, 1, R_TEMP + 273.15f), MIN_TEMP, MAX_TEMP);
luacon_model->SetAmbientAirTemperature(ambientAirTemp);
return 0;
}