Make tooltip_show_delay=0 work

This commit is contained in:
Zefram 2014-07-02 14:32:54 +01:00 committed by sapier
parent 07f444ed85
commit 7d72ac6a69
1 changed files with 6 additions and 4 deletions

View File

@ -2350,16 +2350,19 @@ void GUIFormSpecMenu::drawMenu()
if (hovered != NULL) { if (hovered != NULL) {
s32 id = hovered->getID(); s32 id = hovered->getID();
u32 delta;
if (id == -1) { if (id == -1) {
m_old_tooltip_id = id; m_old_tooltip_id = id;
m_old_tooltip = ""; m_old_tooltip = "";
delta = 0;
} else if (id != m_old_tooltip_id) { } else if (id != m_old_tooltip_id) {
m_hoovered_time = getTimeMs(); m_hoovered_time = getTimeMs();
m_old_tooltip_id = id; m_old_tooltip_id = id;
delta = 0;
} else if (id == m_old_tooltip_id) { } else if (id == m_old_tooltip_id) {
u32 delta = porting::getDeltaMs(m_hoovered_time, getTimeMs()); delta = porting::getDeltaMs(m_hoovered_time, getTimeMs());
if (delta <= m_tooltip_show_delay) }
goto skip_tooltip; if (id != -1 && delta >= m_tooltip_show_delay) {
for(std::vector<FieldSpec>::iterator iter = m_fields.begin(); for(std::vector<FieldSpec>::iterator iter = m_fields.begin();
iter != m_fields.end(); iter++) { iter != m_fields.end(); iter++) {
if ( (iter->fid == id) && (m_tooltips[iter->fname].tooltip != "") ){ if ( (iter->fid == id) && (m_tooltips[iter->fname].tooltip != "") ){
@ -2392,7 +2395,6 @@ void GUIFormSpecMenu::drawMenu()
} }
} }
skip_tooltip:
/* /*
Draw dragged item stack Draw dragged item stack
*/ */