replace large, arbitrary numbers with limit constants

This commit is contained in:
Chris Danford
2005-03-29 19:10:42 +00:00
parent d0ee7921ed
commit afb2c2efb4
6 changed files with 14 additions and 11 deletions
+3 -2
View File
@@ -12,6 +12,7 @@
#include "PlayerState.h" #include "PlayerState.h"
#include "GameState.h" #include "GameState.h"
#include "Style.h" #include "Style.h"
#include <float.h>
const float ARROW_SPACING = ARROW_SIZE;// + 2; const float ARROW_SPACING = ARROW_SIZE;// + 2;
@@ -195,8 +196,8 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float
CLAMP( iStartCol, 0, pStyle->m_iColsPerPlayer-1 ); CLAMP( iStartCol, 0, pStyle->m_iColsPerPlayer-1 );
CLAMP( iEndCol, 0, pStyle->m_iColsPerPlayer-1 ); CLAMP( iEndCol, 0, pStyle->m_iColsPerPlayer-1 );
float fMinX = +100000; float fMinX = FLT_MAX;
float fMaxX = -100000; float fMaxX = FLT_MIN;
// TODO: Don't index by PlayerNumber. // TODO: Don't index by PlayerNumber.
PlayerNumber pn = pPlayerState->m_PlayerNumber; PlayerNumber pn = pPlayerState->m_PlayerNumber;
+1 -1
View File
@@ -1069,7 +1069,7 @@ void Song::AddAutoGenNotes()
// look for closest match // look for closest match
StepsType stBestMatch = (StepsType)-1; StepsType stBestMatch = (StepsType)-1;
int iBestTrackDifference = 10000; // inf int iBestTrackDifference = INT_MAX;
FOREACH_StepsType( st ) FOREACH_StepsType( st )
{ {
+3 -3
View File
@@ -63,12 +63,12 @@ public:
// Lookup // Lookup
const vector<Song*> &GetAllSongs() const { return m_pSongs; } const vector<Song*> &GetAllSongs() const { return m_pSongs; }
void GetBestSongs( vector<Song*> &AddTo, CString sGroupName, int iMaxStages = 100000 /*inf*/, ProfileSlot slot=PROFILE_SLOT_MACHINE ) const; void GetBestSongs( vector<Song*> &AddTo, CString sGroupName, int iMaxStages = INT_MAX, ProfileSlot slot=PROFILE_SLOT_MACHINE ) const;
const vector<Song*> &GetBestSongs( ProfileSlot slot=PROFILE_SLOT_MACHINE ) const { return m_pBestSongs[slot]; } const vector<Song*> &GetBestSongs( ProfileSlot slot=PROFILE_SLOT_MACHINE ) const { return m_pBestSongs[slot]; }
const vector<Course*> &GetBestCourses( ProfileSlot slot=PROFILE_SLOT_MACHINE ) const { return m_pBestCourses[slot]; } const vector<Course*> &GetBestCourses( ProfileSlot slot=PROFILE_SLOT_MACHINE ) const { return m_pBestCourses[slot]; }
void GetSongs( vector<Song*> &AddTo, CString sGroupName, int iMaxStages = 100000 /*inf*/ ) const; void GetSongs( vector<Song*> &AddTo, CString sGroupName, int iMaxStages = INT_MAX ) const;
void GetSongs( vector<Song*> &AddTo, int iMaxStages ) const { GetSongs(AddTo,GROUP_ALL_MUSIC,iMaxStages); } void GetSongs( vector<Song*> &AddTo, int iMaxStages ) const { GetSongs(AddTo,GROUP_ALL_MUSIC,iMaxStages); }
void GetSongs( vector<Song*> &AddTo ) const { GetSongs(AddTo,GROUP_ALL_MUSIC,100000 /*inf*/ ); } void GetSongs( vector<Song*> &AddTo ) const { GetSongs(AddTo,GROUP_ALL_MUSIC,INT_MAX); }
Song *FindSong( CString sPath ); Song *FindSong( CString sPath );
Course *FindCourse( CString sName ); Course *FindCourse( CString sName );
int GetNumSongs() const; int GetNumSongs() const;
+3 -2
View File
@@ -20,6 +20,7 @@
#include "IniFile.h" #include "IniFile.h"
#include "GameState.h" #include "GameState.h"
#include "NoteData.h" #include "NoteData.h"
#include <float.h>
void Style::GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData& original, NoteData& noteDataOut ) const void Style::GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData& original, NoteData& noteDataOut ) const
@@ -95,8 +96,8 @@ bool Style::MatchesStepsType( StepsType type ) const
void Style::GetMinAndMaxColX( PlayerNumber pn, float& fMixXOut, float& fMaxXOut ) const void Style::GetMinAndMaxColX( PlayerNumber pn, float& fMixXOut, float& fMaxXOut ) const
{ {
fMixXOut = +100000; fMixXOut = FLT_MAX;
fMaxXOut = -100000; fMaxXOut = FLT_MIN;
for( int i=0; i<m_iColsPerPlayer; i++ ) for( int i=0; i<m_iColsPerPlayer; i++ )
{ {
fMixXOut = min( fMixXOut, m_ColumnInfo[pn][i].fXOffset ); fMixXOut = min( fMixXOut, m_ColumnInfo[pn][i].fXOffset );
+1 -1
View File
@@ -124,7 +124,7 @@ void TimingData::MultiplyBPMInBeatRange( int iStartIndex, int iEndIndex, float f
{ {
const int iStartIndexThisSegment = m_BPMSegments[i].m_iStartIndex; const int iStartIndexThisSegment = m_BPMSegments[i].m_iStartIndex;
const bool bIsLastBPMSegment = i==m_BPMSegments.size()-1; const bool bIsLastBPMSegment = i==m_BPMSegments.size()-1;
const int iStartIndexNextSegment = bIsLastBPMSegment ? 40000/*inf*/ : m_BPMSegments[i+1].m_iStartIndex; const int iStartIndexNextSegment = bIsLastBPMSegment ? INT_MAX : m_BPMSegments[i+1].m_iStartIndex;
if( iStartIndexThisSegment <= iStartIndex && iStartIndexNextSegment <= iStartIndex ) if( iStartIndexThisSegment <= iStartIndex && iStartIndexNextSegment <= iStartIndex )
continue; continue;
+3 -2
View File
@@ -10,6 +10,7 @@
#include "ProfileManager.h" #include "ProfileManager.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "Foreach.h" #include "Foreach.h"
#include <float.h>
UnlockManager* UNLOCKMAN = NULL; // global and accessable from anywhere in our program UnlockManager* UNLOCKMAN = NULL; // global and accessable from anywhere in our program
@@ -330,12 +331,12 @@ float UnlockManager::PointsUntilNextUnlock( UnlockType t ) const
float fScores[NUM_UNLOCK_TYPES]; float fScores[NUM_UNLOCK_TYPES];
UNLOCKMAN->GetPoints( PROFILEMAN->GetMachineProfile(), fScores ); UNLOCKMAN->GetPoints( PROFILEMAN->GetMachineProfile(), fScores );
float fSmallestPoints = 400000000; // or an arbitrarily large value float fSmallestPoints = FLT_MAX; // or an arbitrarily large value
for( unsigned a=0; a<m_UnlockEntries.size(); a++ ) for( unsigned a=0; a<m_UnlockEntries.size(); a++ )
if( m_UnlockEntries[a].m_fRequired[t] > fScores[t] ) if( m_UnlockEntries[a].m_fRequired[t] > fScores[t] )
fSmallestPoints = min( fSmallestPoints, m_UnlockEntries[a].m_fRequired[t] ); fSmallestPoints = min( fSmallestPoints, m_UnlockEntries[a].m_fRequired[t] );
if( fSmallestPoints == 400000000 ) if( fSmallestPoints == FLT_MAX )
return 0; // no match found return 0; // no match found
return fSmallestPoints - fScores[t]; return fSmallestPoints - fScores[t];
} }