From a0d0ab1730f993c33344bd8e3b24ea2ea0df59ef Mon Sep 17 00:00:00 2001 From: T1ti <40864460+T1ti@users.noreply.github.com> Date: Sun, 28 Jul 2024 02:06:22 +0200 Subject: [PATCH] display liquid oapcities value on tooltip define the values instead of using magic numbers --- src/noggit/ui/Water.cpp | 8 +++++--- src/noggit/ui/Water.h | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/noggit/ui/Water.cpp b/src/noggit/ui/Water.cpp index be94d0f9..87f58e6f 100755 --- a/src/noggit/ui/Water.cpp +++ b/src/noggit/ui/Water.cpp @@ -36,7 +36,7 @@ namespace Noggit , _override_liquid_id(true) , _override_height(true) , _opacity_mode(river_opacity) - , _custom_opacity_factor(0.0337f) + , _custom_opacity_factor(RIVER_OPACITY_VALUE) , _lock_pos(glm::vec3(0.0f, 0.0f, 0.0f)) , tile(0, 0) { @@ -182,7 +182,9 @@ namespace Noggit auto opacity_layout (new QFormLayout (opacity_group)); river_button = new QRadioButton ("River", this); + river_button->setToolTip(std::to_string(RIVER_OPACITY_VALUE).c_str()); ocean_button = new QRadioButton ("Ocean", this); + ocean_button->setToolTip(std::to_string(OCEAN_OPACITY_VALUE).c_str()); custom_button = new QRadioButton ("Custom factor:", this); transparency_toggle = new QButtonGroup (this); @@ -360,8 +362,8 @@ namespace Noggit switch (_opacity_mode) { default: // values found by experimenting - case river_opacity: return 0.0337f; - case ocean_opacity: return 0.007f; + case river_opacity: return RIVER_OPACITY_VALUE; + case ocean_opacity: return OCEAN_OPACITY_VALUE; case custom_opacity: return _custom_opacity_factor; } } diff --git a/src/noggit/ui/Water.h b/src/noggit/ui/Water.h index 5406157c..da246902 100755 --- a/src/noggit/ui/Water.h +++ b/src/noggit/ui/Water.h @@ -60,6 +60,9 @@ namespace Noggit void crop_water(); private: + static constexpr float RIVER_OPACITY_VALUE = 0.0337f; + static constexpr float OCEAN_OPACITY_VALUE = 0.007f; + float get_opacity_factor() const; int _liquid_id;