fix, simplify

This commit is contained in:
Glenn Maynard
2003-07-08 04:35:25 +00:00
parent b3776b9c8a
commit 1583d3be81
+9 -9
View File
@@ -50,6 +50,9 @@ bool UnlockSystem::SongIsRoulette( CString sSongName )
return false; return false;
} }
/* These don't appear to be used. If you need them, I'd suggest making them
* members. They also need return types. */
#if 0
operator == (const SongEntry &a, const SongEntry &b) operator == (const SongEntry &a, const SongEntry &b)
{ {
return a.m_sSongName == b.m_sSongName; return a.m_sSongName == b.m_sSongName;
@@ -79,6 +82,7 @@ operator < (const SongEntry &a, const SongEntry &b)
{ {
return a.m_sSongName <= b.m_sSongName; return a.m_sSongName <= b.m_sSongName;
} }
#endif
SongEntry::SongEntry() SongEntry::SongEntry()
{ {
@@ -273,21 +277,17 @@ bool SongEntry::SelectableRoulette()
float UnlockSystem::NumPointsUntilNextUnlock() float UnlockSystem::NumPointsUntilNextUnlock()
{ {
float fSmallestPoints; float fSmallestPoints = 400000000; // or an arbitrarily large value
fSmallestPoints = 4000000000; // or an arbitrarily large value for( unsigned a=0; a<m_SongEntries.size(); a++ )
for( unsigned a=0; a<100; a++ )
{ {
// old line: if( m_SongEntries[a].m_fDancePointsRequired >= fSmallestPoints ) // old line: if( m_SongEntries[a].m_fDancePointsRequired >= fSmallestPoints )
// new: it makes sure the number of points to the song is positive, AND it is less than // new: it makes sure the number of points to the song is positive, AND it is less than
// the currently smallest one. (cure) // the currently smallest one. (cure)
if( m_SongEntries[a].m_fDancePointsRequired < fSmallestPoints && m_SongEntries[a].m_fDancePointsRequired > PREFSMAN->m_fDancePointsAccumulated) if( m_SongEntries[a].m_fDancePointsRequired > PREFSMAN->m_fDancePointsAccumulated)
{ fSmallestPoints = min(fSmallestPoints, m_SongEntries[a].m_fDancePointsRequired);
fSmallestPoints = m_SongEntries[a].m_fDancePointsRequired;
}
} }
float fResults = (fSmallestPoints - PREFSMAN->m_fDancePointsAccumulated); return fSmallestPoints - PREFSMAN->m_fDancePointsAccumulated;
return fResults;
} }