replace large, arbitrary numbers with limit constants
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "PlayerState.h"
|
||||
#include "GameState.h"
|
||||
#include "Style.h"
|
||||
#include <float.h>
|
||||
|
||||
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( iEndCol, 0, pStyle->m_iColsPerPlayer-1 );
|
||||
|
||||
float fMinX = +100000;
|
||||
float fMaxX = -100000;
|
||||
float fMinX = FLT_MAX;
|
||||
float fMaxX = FLT_MIN;
|
||||
|
||||
// TODO: Don't index by PlayerNumber.
|
||||
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||
|
||||
@@ -1069,7 +1069,7 @@ void Song::AddAutoGenNotes()
|
||||
|
||||
// look for closest match
|
||||
StepsType stBestMatch = (StepsType)-1;
|
||||
int iBestTrackDifference = 10000; // inf
|
||||
int iBestTrackDifference = INT_MAX;
|
||||
|
||||
FOREACH_StepsType( st )
|
||||
{
|
||||
|
||||
@@ -63,12 +63,12 @@ public:
|
||||
|
||||
// Lookup
|
||||
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<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 ) 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 );
|
||||
Course *FindCourse( CString sName );
|
||||
int GetNumSongs() const;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "IniFile.h"
|
||||
#include "GameState.h"
|
||||
#include "NoteData.h"
|
||||
#include <float.h>
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
fMixXOut = +100000;
|
||||
fMaxXOut = -100000;
|
||||
fMixXOut = FLT_MAX;
|
||||
fMaxXOut = FLT_MIN;
|
||||
for( int i=0; i<m_iColsPerPlayer; i++ )
|
||||
{
|
||||
fMixXOut = min( fMixXOut, m_ColumnInfo[pn][i].fXOffset );
|
||||
|
||||
@@ -124,7 +124,7 @@ void TimingData::MultiplyBPMInBeatRange( int iStartIndex, int iEndIndex, float f
|
||||
{
|
||||
const int iStartIndexThisSegment = m_BPMSegments[i].m_iStartIndex;
|
||||
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 )
|
||||
continue;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "ProfileManager.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "Foreach.h"
|
||||
#include <float.h>
|
||||
|
||||
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];
|
||||
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++ )
|
||||
if( m_UnlockEntries[a].m_fRequired[t] > fScores[t] )
|
||||
fSmallestPoints = min( fSmallestPoints, m_UnlockEntries[a].m_fRequired[t] );
|
||||
|
||||
if( fSmallestPoints == 400000000 )
|
||||
if( fSmallestPoints == FLT_MAX )
|
||||
return 0; // no match found
|
||||
return fSmallestPoints - fScores[t];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user