1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix precision not working in hud_change (#10186)

This commit is contained in:
Lars Müller 2020-08-12 11:51:50 +02:00 committed by GitHub
parent cd0e213a36
commit 1c38027c3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 1 deletions

View file

@ -1959,9 +1959,10 @@ void push_hud_element(lua_State *L, HudElement *elem)
HudElementStat read_hud_change(lua_State *L, HudElement *elem, void **value)
{
HudElementStat stat = HUD_STAT_NUMBER;
std::string statstr;
if (lua_isstring(L, 3)) {
int statint;
std::string statstr = lua_tostring(L, 3);
statstr = lua_tostring(L, 3);
stat = string_to_enum(es_HudElementStat, statint, statstr) ?
(HudElementStat)statint : stat;
}
@ -1989,6 +1990,8 @@ HudElementStat read_hud_change(lua_State *L, HudElement *elem, void **value)
break;
case HUD_STAT_ITEM:
elem->item = luaL_checknumber(L, 4);
if (elem->type == HUD_ELEM_WAYPOINT && statstr == "precision")
elem->item++;
*value = &elem->item;
break;
case HUD_STAT_DIR: