Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix uninitialized variable warning
  • Loading branch information
kwolekr committed Oct 30, 2014
1 parent 6b43077 commit f0ae2da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions src/guiFormSpecMenu.cpp
Expand Up @@ -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),
Expand Down Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion src/guiFormSpecMenu.h
Expand Up @@ -324,7 +324,7 @@ class GUIFormSpecMenu : public GUIModalMenu
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;

Expand Down

0 comments on commit f0ae2da

Please sign in to comment.