Delete duplicated code in karts selection screen + fix bogus assertion failure

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8308 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-04-12 20:23:52 +00:00
parent 02f252951c
commit 13ed204b56
3 changed files with 4 additions and 35 deletions

View File

@ -121,13 +121,12 @@ void LabelWidget::add()
void LabelWidget::setText(const wchar_t *text, bool expandIfNeeded)
{
// This method can only be called AFTER the widget was add()ed
assert(m_element != NULL);
m_scroll_offset = 0;
if (expandIfNeeded)
{
assert(m_element != NULL);
const int fwidth = (m_title_font ? GUIEngine::getTitleFont() : GUIEngine::getFont())->getDimension(text).Width;
core::rect<s32> rect = m_element->getRelativePosition();

View File

@ -76,7 +76,8 @@ namespace GUIEngine
*
* \param text The string to use as text for this widget.
* \param expandAsNeeded If true, the label will resize itself in case that it's
* too small to contain \c text.
* too small to contain \c text. Note that this option may
* only be passed after the widget has been add()ed.
*/
virtual void setText(const wchar_t *text, bool expandAsNeeded);

View File

@ -856,37 +856,6 @@ void KartSelectionScreen::loadedFromFile()
assert( tabs != NULL );
m_last_widget = tabs;
tabs->clearAllChildren();
const std::vector<std::string>& groups = kart_properties_manager->getAllGroups();
const int group_amount = groups.size();
// add default group first
for (int n=0; n<group_amount; n++)
{
if (groups[n] == DEFAULT_GROUP_NAME)
{
//FIXME: group name not translated
tabs->addTextChild( stringw(groups[n].c_str()).c_str() , groups[n]);
break;
}
} // for n<group_amount
// add others after
for (int n=0; n<group_amount; n++)
{
if (groups[n] != DEFAULT_GROUP_NAME)
{
//FIXME: group name not translated
tabs->addTextChild( stringw(groups[n].c_str()).c_str() , groups[n]);
}
} // for n<group_amount
if (group_amount > 1)
{
//I18N: name of the tab that will show tracks from all groups
tabs->addTextChild( _("All") , ALL_KART_GROUPS_ID);
}
} // loadedFromFile
// -----------------------------------------------------------------------------