diff options
author | Herman Semenov <GermanAizek@yandex.ru> | 2022-09-06 13:21:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-06 11:21:09 +0100 |
commit | 038da00e799b4bf3af824075a260083c56392964 (patch) | |
tree | 8c0e3218455073684c2521cec41b7df06fff8598 /src/client/hud.cpp | |
parent | ff6dcfea82974df6db5a557e31aaddb6bdb7a71f (diff) | |
download | minetest-038da00e799b4bf3af824075a260083c56392964.tar.xz |
Code optimizations / refactor (#12704)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
Co-authored-by: sfan5 <sfan5@live.de>
Diffstat (limited to 'src/client/hud.cpp')
-rw-r--r-- | src/client/hud.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/client/hud.cpp b/src/client/hud.cpp index 3455908ce..e8ccdbb2b 100644 --- a/src/client/hud.cpp +++ b/src/client/hud.cpp @@ -411,7 +411,7 @@ void Hud::drawLuaElements(const v3s16 &camera_offset) case HUD_ELEM_WAYPOINT: { if (!calculateScreenPos(camera_offset, e, &pos)) break; - v3f p_pos = player->getPosition() / BS; + pos += v2s32(e->offset.X, e->offset.Y); video::SColor color(255, (e->number >> 16) & 0xFF, (e->number >> 8) & 0xFF, @@ -429,6 +429,7 @@ void Hud::drawLuaElements(const v3s16 &camera_offset) font->draw(text.c_str(), bounds + v2s32((e->align.X - 1.0) * bounds.getWidth() / 2, 0), color); if (draw_precision) { std::ostringstream os; + v3f p_pos = player->getPosition() / BS; float distance = std::floor(precision * p_pos.getDistanceFrom(e->world_pos)) / precision; os << distance << unit; text = unescape_translate(utf8_to_wide(os.str())); |