aboutsummaryrefslogtreecommitdiff
path: root/src/script/common
diff options
context:
space:
mode:
authorLars Müller <34514239+appgurueu@users.noreply.github.com>2020-08-12 11:51:50 +0200
committerGitHub <noreply@github.com>2020-08-12 11:51:50 +0200
commit1c38027c3a72402d752a8150701a44753e22990e (patch)
tree90aae232237d8ee167cdd7e9ad5e103897b3269e /src/script/common
parentcd0e213a3640e980e15735f97dd874754f0dc679 (diff)
downloadminetest-1c38027c3a72402d752a8150701a44753e22990e.tar.gz
minetest-1c38027c3a72402d752a8150701a44753e22990e.tar.bz2
minetest-1c38027c3a72402d752a8150701a44753e22990e.zip
Fix precision not working in hud_change (#10186)
Diffstat (limited to 'src/script/common')
-rw-r--r--src/script/common/c_content.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index 3dfd7ce61..774b6a326 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -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: