Fixed empty highscore entries being written to the hgihscore file
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5507 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
b4af729e73
commit
c97361058a
@ -107,10 +107,14 @@ void Highscores::writeEntry(std::ofstream &writer)
|
|||||||
|
|
||||||
for(int i=0; i<HIGHSCORE_LEN; i++)
|
for(int i=0; i<HIGHSCORE_LEN; i++)
|
||||||
{
|
{
|
||||||
writer << " <entry time =\""<<m_time[i]<<"\"\n";
|
if (m_time[i] > 0.0f)
|
||||||
writer << " name =\""<<m_name[i]<<"\"\n";
|
{
|
||||||
writer << " kartname=\""<<m_kart_name[i]
|
assert(m_kart_name[i].size() > 0);
|
||||||
<< "\"/>\n";
|
writer << " <entry time =\""<<m_time[i]<<"\"\n";
|
||||||
|
writer << " name =\""<<m_name[i]<<"\"\n";
|
||||||
|
writer << " kartname=\""<<m_kart_name[i]
|
||||||
|
<< "\"/>\n";
|
||||||
|
}
|
||||||
} // for i
|
} // for i
|
||||||
writer << " </highscore>\n";
|
writer << " </highscore>\n";
|
||||||
} // writeEntry
|
} // writeEntry
|
||||||
@ -151,6 +155,8 @@ int Highscores::addData(const std::string& kart_name,
|
|||||||
{
|
{
|
||||||
for(int j=HIGHSCORE_LEN-2;j>=i;j--)
|
for(int j=HIGHSCORE_LEN-2;j>=i;j--)
|
||||||
{
|
{
|
||||||
|
assert(m_kart_name[j].size() > 0);
|
||||||
|
assert(m_time[j] > 0);
|
||||||
m_name[j+1] = m_name[j];
|
m_name[j+1] = m_name[j];
|
||||||
m_kart_name[j+1] = m_kart_name[j];
|
m_kart_name[j+1] = m_kart_name[j];
|
||||||
m_time[j+1] = m_time[j];
|
m_time[j+1] = m_time[j];
|
||||||
|
Loading…
Reference in New Issue
Block a user