More tweaks to the code that determines number of ribbon rows

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8713 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-05-26 00:55:33 +00:00
parent 6103921a51
commit 9b4df89d2e

View File

@ -242,6 +242,14 @@ void DynamicRibbonWidget::add()
// will be penalized. A configuration that makes items much smaller than
// requested in the XML file will also be penalized.
float ratio = (float)item_height / (float)m_child_height;
// huge icons not so good either
if (ratio > 1.0f)
{
ratio = 1.0 - ratio/5.0f;
if (ratio < 0.0f) ratio = 0.0f;
}
float total_area = (float)(m_w * m_h);
const float score = log(2.0f*visible_items) *
std::min(ratio, 1.0f) * std::min(taken_area/total_area, 1.0f);