prefer standard find() over Find

This commit is contained in:
Glenn Maynard
2005-12-21 08:27:00 +00:00
parent 8f4496685e
commit 443e80551f
6 changed files with 21 additions and 21 deletions
+6 -6
View File
@@ -133,7 +133,7 @@ void BGAnimationLayer::LoadFromAniLayerFile( const CString& sPath )
Effect effect = EFFECT_CENTER;
for( int i=0; i<NUM_EFFECTS; i++ )
if( lcPath.Find(EFFECT_STRING[i]) != -1 )
if( lcPath.find(EFFECT_STRING[i]) != string::npos )
effect = (Effect)i;
switch( effect )
@@ -315,23 +315,23 @@ void BGAnimationLayer::LoadFromAniLayerFile( const CString& sPath )
CString sHint = sPath;
sHint.MakeLower();
if( sHint.Find("cyclecolor") != -1 )
if( sHint.find("cyclecolor") != CString::npos )
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetEffectRainbow( 5 );
if( sHint.Find("cyclealpha") != -1 )
if( sHint.find("cyclealpha") != CString::npos )
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetEffectDiffuseShift( 2, RageColor(1,1,1,1), RageColor(1,1,1,0) );
if( sHint.Find("startonrandomframe") != -1 )
if( sHint.find("startonrandomframe") != CString::npos )
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetState( rand()%m_SubActors[i]->GetNumStates() );
if( sHint.Find("dontanimate") != -1 )
if( sHint.find("dontanimate") != CString::npos )
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->StopAnimating();
if( sHint.Find("add") != -1 )
if( sHint.find("add") != CString::npos )
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetBlendMode( BLEND_ADD );
}
+2 -2
View File
@@ -30,7 +30,7 @@ void GradeDisplay::Load( RageTextureID ID )
Sprite::StopAnimating();
bool bWarn = Sprite::GetNumStates() != 8 && Sprite::GetNumStates() != 16;
if( ID.filename.Find("_blank") != -1 )
if( ID.filename.find("_blank") != CString::npos )
bWarn = false;
if( bWarn )
{
@@ -74,7 +74,7 @@ void GradeDisplay::Update( float fDeltaTime )
int GradeDisplay::GetFrameIndex( PlayerNumber pn, Grade g )
{
if( this->m_pTexture->GetID().filename.Find("_blank") != -1 )
if( this->m_pTexture->GetID().filename.find("_blank") != string::npos )
return 0;
// either 8, or 16 states
+2 -2
View File
@@ -31,8 +31,8 @@ void AnimatedTexture::Load( CString sTexOrIniPath )
{
ASSERT( vFrames.empty() ); // don't load more than once
m_bSphereMapped = sTexOrIniPath.Find("sphere") != -1;
if( sTexOrIniPath.Find("add") != -1 )
m_bSphereMapped = sTexOrIniPath.find("sphere") != CString::npos;
if( sTexOrIniPath.find("add") != string::npos )
m_BlendMode = BLEND_ADD;
else
m_BlendMode = BLEND_NORMAL;
+2 -2
View File
@@ -125,8 +125,8 @@ void NetworkSyncManager::PostStartUp(const CString& ServerIP)
CString sAddress;
short iPort;
int cLoc = ServerIP.Find( ":" );
if ( ServerIP.Find( ":" ) > 0 )
size_t cLoc = ServerIP.find( ':' );
if( ServerIP.find( ':' ) != CString::npos )
{
iPort = (short) atoi( ServerIP.substr( cLoc + 1 ).c_str() );
sAddress = ServerIP.substr( 0, cLoc );
+8 -8
View File
@@ -94,21 +94,21 @@ void RageBitmapTexture::Create()
CString sHintString = GetID().filename + actualID.AdditionalTextureHints;
sHintString.MakeLower();
if( sHintString.Find("32bpp") != -1 ) actualID.iColorDepth = 32;
else if( sHintString.Find("16bpp") != -1 ) actualID.iColorDepth = 16;
if( sHintString.Find("dither") != -1 ) actualID.bDither = true;
if( sHintString.Find("stretch") != -1 ) actualID.bStretch = true;
if( sHintString.Find("mipmaps") != -1 ) actualID.bMipMaps = true;
if( sHintString.Find("nomipmaps") != -1 ) actualID.bMipMaps = false; // check for "nomipmaps" after "mipmaps"
if( sHintString.find("32bpp") != string::npos ) actualID.iColorDepth = 32;
else if( sHintString.find("16bpp") != string::npos ) actualID.iColorDepth = 16;
if( sHintString.find("dither") != string::npos ) actualID.bDither = true;
if( sHintString.find("stretch") != string::npos ) actualID.bStretch = true;
if( sHintString.find("mipmaps") != string::npos ) actualID.bMipMaps = true;
if( sHintString.find("nomipmaps") != string::npos ) actualID.bMipMaps = false; // check for "nomipmaps" after "mipmaps"
/* If the image is marked grayscale, then use all bits not used for alpha
* for the intensity. This way, if an image has no alpha, you get an 8-bit
* grayscale; if it only has boolean transparency, you get a 7-bit grayscale. */
if( sHintString.Find("grayscale") != -1 ) actualID.iGrayscaleBits = 8-actualID.iAlphaBits;
if( sHintString.find("grayscale") != string::npos ) actualID.iGrayscaleBits = 8-actualID.iAlphaBits;
/* This indicates that the only component in the texture is alpha; assume all
* color is white. */
if( sHintString.Find("alphamap") != -1 ) actualID.iGrayscaleBits = 0;
if( sHintString.find("alphamap") != string::npos ) actualID.iGrayscaleBits = 0;
/* No iGrayscaleBits for images that are already paletted. We don't support
* that; and that hint is intended for use on images that are already grayscale,
+1 -1
View File
@@ -897,7 +897,7 @@ RageSoundParams::StopMode_t RageSound::GetStopMode() const
if( m_Param.StopMode != RageSoundParams::M_AUTO )
return m_Param.StopMode;
if( m_sFilePath.Find("loop") != -1 )
if( m_sFilePath.find("loop") != string::npos )
return RageSoundParams::M_LOOP;
else
return RageSoundParams::M_STOP;