aboutsummaryrefslogtreecommitdiff
path: root/src/script/common
diff options
context:
space:
mode:
authorLars Müller <34514239+appgurueu@users.noreply.github.com>2020-04-11 23:09:46 +0200
committerGitHub <noreply@github.com>2020-04-11 22:09:46 +0100
commitaf2e6a6a10121cf971d4ce4c33d523b6dc037d31 (patch)
tree19776d03803bf383476d629202aafdc1ed7107c4 /src/script/common
parentf780bae05cc2fdd23a6d7326c770783da8d94ea3 (diff)
downloadminetest-af2e6a6a10121cf971d4ce4c33d523b6dc037d31.tar.gz
minetest-af2e6a6a10121cf971d4ce4c33d523b6dc037d31.tar.bz2
minetest-af2e6a6a10121cf971d4ce4c33d523b6dc037d31.zip
Improve waypoints and add image variant (#9480)
Diffstat (limited to 'src/script/common')
-rw-r--r--src/script/common/c_content.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index c8cd7539f..ff9ceec6d 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -1850,7 +1850,11 @@ void read_hud_element(lua_State *L, HudElement *elem)
elem->name = getstringfield_default(L, 2, "name", "");
elem->text = getstringfield_default(L, 2, "text", "");
elem->number = getintfield_default(L, 2, "number", 0);
- elem->item = getintfield_default(L, 2, "item", 0);
+ if (elem->type == HUD_ELEM_WAYPOINT)
+ // waypoints reuse the item field to store precision, item = precision + 1
+ elem->item = getintfield_default(L, 2, "precision", -1) + 1;
+ else
+ elem->item = getintfield_default(L, 2, "item", 0);
elem->dir = getintfield_default(L, 2, "direction", 0);
elem->z_index = MYMAX(S16_MIN, MYMIN(S16_MAX,
getintfield_default(L, 2, "z_index", 0)));