aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-10-30 02:53:20 -0400
committerkwolekr <kwolekr@minetest.net>2014-10-30 02:53:20 -0400
commitf0ae2da89e0c549b7551227069456c8a474f6d90 (patch)
tree6bf10411771a50264bc1cd2efd94dee1addd654c /src
parent6b4307791af9aab362029883c1cbee207e748af1 (diff)
downloadminetest-f0ae2da89e0c549b7551227069456c8a474f6d90.tar.gz
minetest-f0ae2da89e0c549b7551227069456c8a474f6d90.tar.bz2
minetest-f0ae2da89e0c549b7551227069456c8a474f6d90.zip
Fix uninitialized variable warning
Diffstat (limited to 'src')
-rw-r--r--src/guiFormSpecMenu.cpp19
-rw-r--r--src/guiFormSpecMenu.h2
2 files changed, 12 insertions, 9 deletions
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index e82ea829c..edbb595c2 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -83,6 +83,7 @@ GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
m_selected_amount(0),
m_selected_dragging(false),
m_tooltip_element(NULL),
+ m_hovered_time(0),
m_old_tooltip_id(-1),
m_allowclose(true),
m_lock(false),
@@ -2346,18 +2347,20 @@ void GUIFormSpecMenu::drawMenu()
if (hovered != NULL) {
s32 id = hovered->getID();
- u32 delta;
+
+ u32 delta = 0;
if (id == -1) {
m_old_tooltip_id = id;
m_old_tooltip = "";
- delta = 0;
- } else if (id != m_old_tooltip_id) {
- m_hoovered_time = getTimeMs();
- m_old_tooltip_id = id;
- delta = 0;
- } else if (id == m_old_tooltip_id) {
- delta = porting::getDeltaMs(m_hoovered_time, getTimeMs());
+ } else {
+ if (id == m_old_tooltip_id) {
+ delta = porting::getDeltaMs(m_hovered_time, getTimeMs());
+ } else {
+ m_hovered_time = getTimeMs();
+ m_old_tooltip_id = id;
+ }
}
+
if (id != -1 && delta >= m_tooltip_show_delay) {
for(std::vector<FieldSpec>::iterator iter = m_fields.begin();
iter != m_fields.end(); iter++) {
diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h
index d38e9ec46..d5bd112cc 100644
--- a/src/guiFormSpecMenu.h
+++ b/src/guiFormSpecMenu.h
@@ -324,7 +324,7 @@ protected:
gui::IGUIStaticText *m_tooltip_element;
u32 m_tooltip_show_delay;
- s32 m_hoovered_time;
+ s32 m_hovered_time;
s32 m_old_tooltip_id;
std::string m_old_tooltip;