ARRAYSIZE -> ARRAYLEN
This commit is contained in:
@@ -1151,7 +1151,7 @@ bool Actor::TweenState::operator==( const TweenState &other ) const
|
||||
COMPARE( fSkewX );
|
||||
COMPARE( crop );
|
||||
COMPARE( fade );
|
||||
for( unsigned i=0; i<ARRAYSIZE(diffuse); i++ )
|
||||
for( unsigned i=0; i<ARRAYLEN(diffuse); i++ )
|
||||
COMPARE( diffuse[i] );
|
||||
COMPARE( glow );
|
||||
COMPARE( aux );
|
||||
|
||||
@@ -61,7 +61,7 @@ static const RString EMPTY_STRING;
|
||||
as_##X##Name[i] = ap; \
|
||||
} \
|
||||
} \
|
||||
ASSERT( CNT == ARRAYSIZE(X##Names) ); \
|
||||
ASSERT( CNT == ARRAYLEN(X##Names) ); \
|
||||
if( x == CNT+1 ) \
|
||||
return EMPTY_STRING; \
|
||||
ASSERT( x < CNT ); \
|
||||
@@ -88,7 +88,7 @@ static const RString EMPTY_STRING;
|
||||
RString s2 = s; \
|
||||
s2.MakeLower(); \
|
||||
unsigned i; \
|
||||
for( i = 0; i < ARRAYSIZE(X##Names); ++i ) \
|
||||
for( i = 0; i < ARRAYLEN(X##Names); ++i ) \
|
||||
if( !s2.CompareNoCase(X##Names[i]) ) \
|
||||
return (X)i; \
|
||||
return (X)(i+1); /*invalid*/ \
|
||||
|
||||
@@ -275,7 +275,7 @@ const glyph &Font::GetGlyph( wchar_t c ) const
|
||||
ASSERT(c >= 0 && c <= 0xFFFFFF);
|
||||
|
||||
/* Fast path: */
|
||||
if( c < (int) ARRAYSIZE(m_iCharToGlyphCache) && m_iCharToGlyphCache[c] )
|
||||
if( c < (int) ARRAYLEN(m_iCharToGlyphCache) && m_iCharToGlyphCache[c] )
|
||||
return *m_iCharToGlyphCache[c];
|
||||
|
||||
/* Try the regular character. */
|
||||
@@ -767,7 +767,7 @@ void Font::Load( const RString &sIniPath, RString sChars )
|
||||
ZERO( m_iCharToGlyphCache );
|
||||
map<longchar,glyph*>::iterator it;
|
||||
for( it = m_iCharToGlyph.begin(); it != m_iCharToGlyph.end(); ++it )
|
||||
if( it->first < (int) ARRAYSIZE(m_iCharToGlyphCache) )
|
||||
if( it->first < (int) ARRAYLEN(m_iCharToGlyphCache) )
|
||||
m_iCharToGlyphCache[it->first] = it->second;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2644,7 +2644,7 @@ static Style g_Styles[] =
|
||||
},
|
||||
};
|
||||
|
||||
#define NUM_STYLES ARRAYSIZE(g_Styles)
|
||||
#define NUM_STYLES ARRAYLEN(g_Styles)
|
||||
|
||||
void GameManager::GetStylesForGame( const Game *pGame, vector<const Style*>& aStylesAddTo, bool editor ) const
|
||||
{
|
||||
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
Actor::SetTextureRenderStates();
|
||||
|
||||
DISPLAY->SetTextureModeModulate();
|
||||
DISPLAY->DrawQuadStrip( m_Slices, ARRAYSIZE(m_Slices) );
|
||||
DISPLAY->DrawQuadStrip( m_Slices, ARRAYLEN(m_Slices) );
|
||||
}
|
||||
|
||||
RageSpriteVertex m_Slices[2*VALUE_RESOLUTION];
|
||||
@@ -192,7 +192,7 @@ void GraphDisplay::LoadFromStageStats( const StageStats &ss, const PlayerStageSt
|
||||
|
||||
m_Values.resize( VALUE_RESOLUTION );
|
||||
pss.GetLifeRecord( &m_Values[0], VALUE_RESOLUTION, ss.GetTotalPossibleStepsSeconds() );
|
||||
for( unsigned i=0; i<ARRAYSIZE(m_Values); i++ )
|
||||
for( unsigned i=0; i<ARRAYLEN(m_Values); i++ )
|
||||
CLAMP( m_Values[i], 0.f, 1.f );
|
||||
|
||||
//
|
||||
|
||||
@@ -504,7 +504,7 @@ void InputMapper::AutoMapJoysticksForCurrentGame()
|
||||
{
|
||||
InputDevice id = vDevices[i].id;
|
||||
const RString &sDescription = vDevices[i].sDesc;
|
||||
for( unsigned j=0; j<ARRAYSIZE(g_AutoJoyMappings); j++ )
|
||||
for( unsigned j=0; j<ARRAYLEN(g_AutoJoyMappings); j++ )
|
||||
{
|
||||
const AutoJoyMapping& mapping = g_AutoJoyMappings[j];
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ static int g_iNumStackCounts = 0;
|
||||
Lua *LuaManager::Get()
|
||||
{
|
||||
m_pLock->Lock();
|
||||
if( size_t(g_iNumStackCounts) < ARRAYSIZE(g_iStackCounts) )
|
||||
if( size_t(g_iNumStackCounts) < ARRAYLEN(g_iStackCounts) )
|
||||
{
|
||||
g_iStackCounts[g_iNumStackCounts] = lua_gettop(L);
|
||||
}
|
||||
@@ -221,7 +221,7 @@ void LuaManager::Release( Lua *&p )
|
||||
ASSERT( p == L );
|
||||
ASSERT( g_iNumStackCounts != 0 );
|
||||
--g_iNumStackCounts;
|
||||
if( size_t(g_iNumStackCounts) < ARRAYSIZE(g_iStackCounts) )
|
||||
if( size_t(g_iNumStackCounts) < ARRAYLEN(g_iStackCounts) )
|
||||
{
|
||||
ASSERT( g_iStackCounts[g_iNumStackCounts] == lua_gettop(L) );
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ static const SortOrder g_SongSortOrders[] =
|
||||
SORT_ARTIST,
|
||||
SORT_GENRE,
|
||||
};
|
||||
const vector<SortOrder> SONG_SORT_ORDERS( g_SongSortOrders, g_SongSortOrders + ARRAYSIZE(g_SongSortOrders) );
|
||||
const vector<SortOrder> SONG_SORT_ORDERS( g_SongSortOrders, g_SongSortOrders + ARRAYLEN(g_SongSortOrders) );
|
||||
|
||||
static SortOrder ForceAppropriateSort( PlayMode pm, SortOrder so )
|
||||
{
|
||||
|
||||
@@ -1816,7 +1816,7 @@ const ValidRow g_ValidRows[] =
|
||||
void NoteDataUtil::RemoveStretch( NoteData &inout, StepsType st, int iStartIndex, int iEndIndex )
|
||||
{
|
||||
vector<const ValidRow*> vpValidRowsToCheck;
|
||||
for( unsigned i=0; i<ARRAYSIZE(g_ValidRows); i++ )
|
||||
for( unsigned i=0; i<ARRAYLEN(g_ValidRows); i++ )
|
||||
{
|
||||
if( g_ValidRows[i].st == st )
|
||||
vpValidRowsToCheck.push_back( &g_ValidRows[i] );
|
||||
@@ -1954,7 +1954,7 @@ void NoteDataUtil::AddTapAttacks( NoteData &nd, Song* pSong )
|
||||
TapNote::attack,
|
||||
TapNote::SubType_invalid,
|
||||
TapNote::original,
|
||||
szAttacks[RandomInt(ARRAYSIZE(szAttacks))],
|
||||
szAttacks[RandomInt(ARRAYLEN(szAttacks))],
|
||||
15.0f,
|
||||
-1 );
|
||||
nd.SetTapNote( iTrack, BeatToNoteRow(fBeat), tn );
|
||||
|
||||
@@ -20,7 +20,7 @@ void NotesLoader::GetMainAndSubTitlesFromFullTitle( const RString &sFullTitle, R
|
||||
{
|
||||
const RString sLeftSeps[] = { " -", " ~", " (", " [", "\t" };
|
||||
|
||||
for( unsigned i=0; i<ARRAYSIZE(sLeftSeps); i++ )
|
||||
for( unsigned i=0; i<ARRAYLEN(sLeftSeps); i++ )
|
||||
{
|
||||
size_t iBeginIndex = sFullTitle.find( sLeftSeps[i] );
|
||||
if( iBeginIndex == string::npos )
|
||||
|
||||
@@ -882,7 +882,7 @@ void BMSLoader::SetTimeSigAdjustments( const MeasureToTimeSig_t &sigs, Song *pOu
|
||||
};
|
||||
|
||||
bool bValidTimeSignature = false;
|
||||
for( unsigned i = 0; i < ARRAYSIZE(ValidFactors); ++i )
|
||||
for( unsigned i = 0; i < ARRAYLEN(ValidFactors); ++i )
|
||||
if( fabsf(fFactor-ValidFactors[i]) < 0.001 )
|
||||
bValidTimeSignature = true;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ void OptionIcon::Set( PlayerNumber pn, const RString &_sText, bool bHeader )
|
||||
"OFF",
|
||||
};
|
||||
|
||||
for( unsigned i=0; i<ARRAYSIZE(sStopWords); i++ )
|
||||
for( unsigned i=0; i<ARRAYLEN(sStopWords); i++ )
|
||||
if( 0==stricmp(sText,sStopWords[i]) )
|
||||
sText = "";
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ int OptionToPreferredColumn( RString sOptionText )
|
||||
return 0;
|
||||
}
|
||||
|
||||
for( unsigned i=0; i<ARRAYSIZE(g_OptionColumnEntries); i++ )
|
||||
for( unsigned i=0; i<ARRAYLEN(g_OptionColumnEntries); i++ )
|
||||
if( g_OptionColumnEntries[i].szString == sOptionText )
|
||||
return g_OptionColumnEntries[i].iSlotIndex;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
#include <float.h>
|
||||
|
||||
#define ONE( arr ) { for( unsigned Z = 0; Z < ARRAYSIZE(arr); ++Z ) arr[Z]=1.0f; }
|
||||
#define ONE( arr ) { for( unsigned Z = 0; Z < ARRAYLEN(arr); ++Z ) arr[Z]=1.0f; }
|
||||
|
||||
void PlayerOptions::Init()
|
||||
{
|
||||
|
||||
@@ -710,7 +710,7 @@ static bool PathUsesSlowFlush( const RString &sPath )
|
||||
"Save/"
|
||||
};
|
||||
|
||||
for( unsigned i = 0; i < ARRAYSIZE(FlushPaths); ++i )
|
||||
for( unsigned i = 0; i < ARRAYLEN(FlushPaths); ++i )
|
||||
if( !strncmp( sPath, FlushPaths[i], strlen(FlushPaths[i]) ) )
|
||||
return true;
|
||||
return false;
|
||||
|
||||
@@ -275,7 +275,7 @@ int RageSoundReader_Chain::ReadBlock( int16_t *pBuffer, int iFrames )
|
||||
{
|
||||
ActiveSound &s = m_apActiveSounds[i];
|
||||
SoundReader *pSound = s.pSound;
|
||||
int iSamples = min( iFramesToRead * pSound->GetNumChannels(), ARRAYSIZE(Buffer) );
|
||||
int iSamples = min( iFramesToRead * pSound->GetNumChannels(), ARRAYLEN(Buffer) );
|
||||
int iBytesRead = pSound->Read( (char *) Buffer, iSamples*sizeof(int16_t) );
|
||||
if( iBytesRead == -1 || iBytesRead == 0 )
|
||||
{
|
||||
|
||||
@@ -1244,7 +1244,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
|
||||
|
||||
const float fSpeeds[] = { 1.0f, 1.5f, 2.0f, 3.0f, 4.0f, 6.0f, 8.0f };
|
||||
int iSpeed = 0;
|
||||
for( unsigned i = 0; i < ARRAYSIZE(fSpeeds); ++i )
|
||||
for( unsigned i = 0; i < ARRAYLEN(fSpeeds); ++i )
|
||||
{
|
||||
if( fSpeeds[i] == fScrollSpeed )
|
||||
{
|
||||
@@ -1257,7 +1257,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
|
||||
--iSpeed;
|
||||
else if( EditB == EDIT_BUTTON_SCROLL_SPEED_UP )
|
||||
++iSpeed;
|
||||
iSpeed = clamp( iSpeed, 0, (int) ARRAYSIZE(fSpeeds)-1 );
|
||||
iSpeed = clamp( iSpeed, 0, (int) ARRAYLEN(fSpeeds)-1 );
|
||||
|
||||
if( fSpeeds[iSpeed] != fScrollSpeed )
|
||||
{
|
||||
@@ -3668,7 +3668,7 @@ void ScreenEdit::DoHelp()
|
||||
{
|
||||
g_EditHelp.rows.clear();
|
||||
|
||||
for( unsigned i=0; i<ARRAYSIZE(g_EditHelpLines); ++i )
|
||||
for( unsigned i=0; i<ARRAYLEN(g_EditHelpLines); ++i )
|
||||
{
|
||||
const EditHelpLine &hl = g_EditHelpLines[i];
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ void ScreenEvaluation::Init()
|
||||
{
|
||||
const int ScoreBonuses[] = { 10000000, 10000000, 1000000, 100000, 10000, 1000, 100 };
|
||||
Grade g = STATSMAN->m_CurStageStats.m_player[p].GetGrade();
|
||||
if( g < (int) ARRAYSIZE(ScoreBonuses) )
|
||||
if( g < (int) ARRAYLEN(ScoreBonuses) )
|
||||
{
|
||||
STATSMAN->m_CurStageStats.m_player[p].iBonus += ScoreBonuses[(int)g];
|
||||
STATSMAN->m_CurStageStats.m_player[p].iBonus += ScoreBonuses[(int)g];
|
||||
|
||||
@@ -57,7 +57,7 @@ const char NAME_CHARS[] =
|
||||
{
|
||||
' ',' ',' ',' ','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
|
||||
};
|
||||
#define NUM_NAME_CHARS (ARRAYSIZE(NAME_CHARS))
|
||||
#define NUM_NAME_CHARS (ARRAYLEN(NAME_CHARS))
|
||||
#define HEIGHT_OF_ALL_CHARS (NUM_NAME_CHARS * g_fCharsSpacingY)
|
||||
|
||||
|
||||
|
||||
@@ -609,7 +609,7 @@ bool CheckVideoDefaultSettings()
|
||||
|
||||
VideoCardDefaults defaults;
|
||||
|
||||
for( unsigned i=0; i<ARRAYSIZE(g_VideoCardDefaults); i++ )
|
||||
for( unsigned i=0; i<ARRAYLEN(g_VideoCardDefaults); i++ )
|
||||
{
|
||||
defaults = g_VideoCardDefaults[i];
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ static void InitEntities()
|
||||
{ '>', "gt", }
|
||||
};
|
||||
|
||||
for( unsigned i = 0; i < ARRAYSIZE(EntityTable); ++i )
|
||||
for( unsigned i = 0; i < ARRAYLEN(EntityTable); ++i )
|
||||
{
|
||||
const Entity &ent = EntityTable[i];
|
||||
g_mapEntitiesToChars[ent.pEntity] = RString(1, ent.c);
|
||||
|
||||
Reference in New Issue
Block a user