Fix a bug which potentially could cause a crash if the layout() func is ever called without widgets, and the text positions are now recalculated after calling the argument-less layout() func.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1355 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
e07116d262
commit
908fa88d85
@ -329,6 +329,16 @@ bool WidgetManager::layout()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int NUM_WIDGETS = (int)m_widgets.size();
|
||||||
|
for( int i = 0; i < NUM_WIDGETS; ++i )
|
||||||
|
{
|
||||||
|
m_widgets[i].widget->m_scroll_pos_x =
|
||||||
|
m_widgets[i].last_preset_scroll_x;
|
||||||
|
|
||||||
|
m_widgets[i].widget->m_scroll_pos_y =
|
||||||
|
m_widgets[i].last_preset_scroll_y;
|
||||||
|
}
|
||||||
|
|
||||||
return layout(prev_layout_pos);
|
return layout(prev_layout_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,10 +350,11 @@ bool WidgetManager::layout(const WidgetArea POSITION)
|
|||||||
std::cerr << "WARNING: called layout with WGT_AREA_NONE.\n";
|
std::cerr << "WARNING: called layout with WGT_AREA_NONE.\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
prev_layout_pos = POSITION;
|
prev_layout_pos = POSITION;
|
||||||
|
|
||||||
const int NUM_WIDGETS = (int)m_widgets.size();
|
const int NUM_WIDGETS = (int)m_widgets.size();
|
||||||
if( NUM_WIDGETS < 0 ) return true;
|
if( NUM_WIDGETS < 1 ) return true;
|
||||||
|
|
||||||
int SCREEN_WIDTH = user_config->m_width;
|
int SCREEN_WIDTH = user_config->m_width;
|
||||||
int SCREEN_HEIGHT = user_config->m_height;
|
int SCREEN_HEIGHT = user_config->m_height;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user