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]) != CString::npos )
effect = (Effect)i;
switch( effect )
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 );
}
//When we're cutting out text, we need to maintain the last
//color, so our text at the top doesn't become colorless.
- RageColor LastColor;
+ RageColor LastColor(0, 0, 0, 0);
for ( unsigned i = 0; i < m_vColors.size(); i++ )
{
const Game* pGame = GAMESTATE->GetCurrentGame();
CStringArray asButtonNames;
- bool bHasAPlus = sButtonsNames.find( '+' ) != -1;
- bool bHasADash = sButtonsNames.find( '-' ) != -1;
+ bool bHasAPlus = sButtonsNames.find( '+' ) != CString::npos;
+ bool bHasADash = sButtonsNames.find( '-' ) != CString::npos;
if( bHasAPlus )
{
{
CString str = sParams[1];
str.MakeLower();
- if( str.find("yes") != -1 )
+ if( str.find("yes") != CString::npos )
m_bRepeat = true;
}
Sprite::Load( sPath );
int iStates = GetNumStates();
bool bWarn = iStates != NUM_DIFFICULTIES && iStates != NUM_DIFFICULTIES*2;
- if( sPath.find("_blank") != -1 )
+ if( sPath.find("_blank") != CString::npos )
bWarn = false;
if( bWarn )
{
const int PNM9_COL_SPACING = 32;
struct {
- char *name;
+ const char *name;
int NumTracks;
} const StepsTypes[NUM_STEPS_TYPES] = {
{ "dance-single", 4 },
m_iCoins = 0;
m_timeGameStarted.SetZero();
+ m_bDemonstrationOrJukebox = false;
+ m_bTemporaryEventMode = false;
+
ReloadCharacters();
m_iNumTimesThroughAttract = -1; // initial screen will bump this up to 0
}
line.MakeUpper();
- if( !line.empty() && name.find(line) != -1 ) // name contains a bad word
+ if( !line.empty() && name.find(line) != CString::npos ) // name contains a bad word
{
LOG->Trace( "entered '%s' matches blacklisted item '%s'", name.c_str(), line.c_str() );
name = "";
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 )
{
int GradeDisplay::GetFrameIndex( PlayerNumber pn, Grade g )
{
- if( this->m_pTexture->GetID().filename.find("_blank") != -1 )
+ if( this->m_pTexture->GetID().filename.find("_blank") != CString::npos )
return 0;
// either 8, or 16 states
iRangeFGC[0] = iRangeFEC[1];
iRangeFGC[1] = m_iPulseStopPoint;
}
+ else
+ {
+ iRangeFFC[0] = iRangeFFC[1] = 0;
+ iRangeFEC[0] = iRangeFEC[1] = 0;
+ iRangeFGC[0] = iRangeFGC[1] = 0;
+ }
#undef COMPARE_POINT
for( int i = 0; i < NumSlices; ++i )
#include "ScreenManager.h"
#include "CodeDetector.h"
+#ifdef MSVC
/* It's going to be a pain to fix these. Disable for now. */
#pragma warning( disable : 4018 ) // signed/unsigned mismatch
#pragma warning( disable : 4244 ) // conversion, possible loss of data
+#endif
void LinkedOptionsMenu::Load( LinkedOptionsMenu *prev, LinkedOptionsMenu *next )
{
}
// show first page of choices
- for( unsigned i = 0; i < asChoices.size() && i < ROWS_PER_PAGE; i++ )
+ for( unsigned i = 0; i < asChoices.size() && i < (unsigned)ROWS_PER_PAGE; i++ )
{
m_Rows[i]->PlayCommand("TweenOn");
}
m_iCurPage = 0;
- if ( asChoices.size() > ROWS_PER_PAGE )
+ if ( asChoices.size() > (unsigned)ROWS_PER_PAGE )
{
m_sprIndicatorDown.PlayCommand("TweenOn");
m_bIndTweenedOn[1] = true;
CString LinkedOptionsMenu::GetCurrentSelection()
{
ASSERT( m_iCurrentSelection >= 0 );
- ASSERT( m_iCurrentSelection < m_Rows.size() );
+ ASSERT( (unsigned)m_iCurrentSelection < m_Rows.size() );
return m_Rows[m_iCurrentSelection]->GetText();
}
ASSERT( iDirection != 0 );
iDirection = iDirection / abs(iDirection);
int iNewSelection = m_iCurrentSelection + iDirection;
- if (iNewSelection >= m_Rows.size() && iNewSelection > 0) // user chose beyond last option
+ if (iNewSelection > 0 && (unsigned)iNewSelection >= m_Rows.size()) // user chose beyond last option
{
if ( GetNextMenu() != this && MENU_WRAPPING )
{
void LinkedOptionsMenu::SetChoiceIndex( int iNewSelection )
{
ASSERT( iNewSelection >= 0 );
- ASSERT( iNewSelection < m_Rows.size() );
+ ASSERT( (unsigned)iNewSelection < m_Rows.size() );
int iSavedSelection = m_iCurrentSelection;
m_iCurrentSelection = iNewSelection;
if (iNewSelection / ROWS_PER_PAGE != m_iCurPage) // new page
void LinkedOptionsMenu::SetPage(int iPage)
{
int iSavedPage = m_iCurPage;
- for( unsigned i = m_iCurPage*ROWS_PER_PAGE; i < (m_iCurPage+1)*ROWS_PER_PAGE && i < m_Rows.size(); i++ )
+ for( unsigned i = m_iCurPage*ROWS_PER_PAGE; i < (unsigned)(m_iCurPage+1)*ROWS_PER_PAGE && i < m_Rows.size(); i++ )
{
m_Rows[i]->PlayCommand("TweenOff");
}
m_iCurPage = iPage;
- for( unsigned i = m_iCurPage*ROWS_PER_PAGE; i < (m_iCurPage+1)*ROWS_PER_PAGE && i < m_Rows.size(); i++ )
+ for( unsigned i = m_iCurPage*ROWS_PER_PAGE; i < (unsigned)(m_iCurPage+1)*ROWS_PER_PAGE && i < m_Rows.size(); i++ )
{
m_Rows[i]->PlayCommand("TweenOn");
}
{
m_sprIndicatorUp.PlayCommand("TweenOn");
m_bIndTweenedOn[0] = true;
- if ( m_iCurPage+1 == m_Rows.size()/ROWS_PER_PAGE + ( (m_Rows.size()%ROWS_PER_PAGE > 0) ? 1 : 0 ) ) // on last page
+ if ( (unsigned)m_iCurPage+1 == m_Rows.size()/ROWS_PER_PAGE + ( (m_Rows.size()%ROWS_PER_PAGE > 0) ? 1 : 0 ) ) // on last page
{
m_sprIndicatorDown.PlayCommand("TweenOff");
m_bIndTweenedOn[1] = false;
{
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") != CString::npos )
m_BlendMode = BLEND_ADD;
else
m_BlendMode = BLEND_NORMAL;
void PacketFunctions::WriteNT(const CString& data)
{
- int index=0;
+ CString::size_type index=0;
while ((Position<NETMAXBUFFERSIZE)&&(index<data.length()))
Data[Position++] = (unsigned char)(data.c_str()[index++]);
Data[Position++] = 0;
out.SetNumTracks( iNumTracks );
// strip comments out of sSMNoteData
- while( sSMNoteData.find("//") != -1 )
+ while( sSMNoteData.find("//") != CString::npos )
{
- int iIndexCommentStart = sSMNoteData.find("//");
- int iIndexCommentEnd = sSMNoteData.find("\n", iIndexCommentStart);
- if( iIndexCommentEnd == -1 ) // comment doesn't have an end?
+ CString::size_type iIndexCommentStart = sSMNoteData.find("//");
+ CString::size_type iIndexCommentEnd = sSMNoteData.find("\n", iIndexCommentStart);
+ if( iIndexCommentEnd == CString::npos ) // comment doesn't have an end?
sSMNoteData.erase( iIndexCommentStart, 2 );
else
sSMNoteData.erase( iIndexCommentStart, iIndexCommentEnd-iIndexCommentStart );
sData = sData.substr( iOpenBracket+1, iCloseBracket-iOpenBracket-1 );
// if there's a 6 in the description, it's probably part of "6panel" or "6-panel"
- if( sData.find("6") != -1 )
+ if( sData.find("6") != CString::npos )
out.m_StepsType = STEPS_TYPE_DANCE_SOLO;
}
const CString &sNoteData = it->second;
vector<TapNote> vTapNotes;
- for( int i=0; i+1<sNoteData.length(); i+=2 )
+ for( CString::size_type i=0; i+1<sNoteData.length(); i+=2 )
{
CString sNoteId = sNoteData.substr(i,2);
if( sNoteId != "00" )
double fCurrentBeat = 0;
double fCurrentIncrementer = 1.0/8 * BEATS_PER_MEASURE;
- for( int i=0; i<sStepData.length(); )
+ for( CString::size_type i=0; i<sStepData.length(); )
{
char c = sStepData[i++];
switch( c )
}
}
else
+ {
// do nothing. We don't care about this value name
- ;
+ }
}
return true;
sFName.MakeLower();
out.SetDescription(sFName);
- if( sFName.find("crazy")!=-1 )
+ if( sFName.find("crazy")!=CString::npos )
{
out.SetDifficulty(DIFFICULTY_HARD);
if(!out.GetMeter()) out.SetMeter(8);
}
- else if( sFName.find("hard")!=-1 )
+ else if( sFName.find("hard")!=CString::npos )
{
out.SetDifficulty(DIFFICULTY_MEDIUM);
if(!out.GetMeter()) out.SetMeter(5);
}
- else if( sFName.find("easy")!=-1 )
+ else if( sFName.find("easy")!=CString::npos )
{
out.SetDifficulty(DIFFICULTY_EASY);
if(!out.GetMeter()) out.SetMeter(2);
out.m_StepsType = STEPS_TYPE_PUMP_SINGLE;
/* Check for "halfdouble" before "double". */
- if( sFName.find("halfdouble") != -1 || sFName.find("h_double") != -1 )
+ if( sFName.find("halfdouble") != CString::npos || sFName.find("h_double") != CString::npos )
out.m_StepsType = STEPS_TYPE_PUMP_HALFDOUBLE;
- else if( sFName.find("double") != -1 )
+ else if( sFName.find("double") != CString::npos )
out.m_StepsType = STEPS_TYPE_PUMP_DOUBLE;
- else if( sFName.find("_1") != -1 )
+ else if( sFName.find("_1") != CString::npos )
out.m_StepsType = STEPS_TYPE_PUMP_SINGLE;
- else if( sFName.find("_2") != -1 )
+ else if( sFName.find("_2") != CString::npos )
out.m_StepsType = STEPS_TYPE_PUMP_COUPLE;
}
CString HintString = GetID().filename + actualID.AdditionalTextureHints;
HintString.MakeLower();
- if( HintString.find("32bpp") != -1 ) actualID.iColorDepth = 32;
- else if( HintString.find("16bpp") != -1 ) actualID.iColorDepth = 16;
- if( HintString.find("dither") != -1 ) actualID.bDither = true;
- if( HintString.find("stretch") != -1 ) actualID.bStretch = true;
- if( HintString.find("mipmaps") != -1 ) actualID.bMipMaps = true;
- if( HintString.find("nomipmaps") != -1 ) actualID.bMipMaps = false; // check for "nomipmaps" after "mipmaps"
+ if( HintString.find("32bpp") != CString::npos ) actualID.iColorDepth = 32;
+ else if( HintString.find("16bpp") != CString::npos ) actualID.iColorDepth = 16;
+ if( HintString.find("dither") != CString::npos ) actualID.bDither = true;
+ if( HintString.find("stretch") != CString::npos ) actualID.bStretch = true;
+ if( HintString.find("mipmaps") != CString::npos ) actualID.bMipMaps = true;
+ if( HintString.find("nomipmaps") != CString::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( HintString.find("grayscale") != -1 ) actualID.iGrayscaleBits = 8-actualID.iAlphaBits;
+ if( HintString.find("grayscale") != CString::npos ) actualID.iGrayscaleBits = 8-actualID.iAlphaBits;
/* This indicates that the only component in the texture is alpha; assume all
* color is white. */
- if( HintString.find("alphamap") != -1 ) actualID.iGrayscaleBits = 0;
+ if( HintString.find("alphamap") != CString::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,
// seek to the file location and read it into the buffer
this->SeekInternal( m_iHeaderSize + startpos );
- this->ReadDirect( crbuf, bufsize );
+ unsigned bytes_read = this->ReadDirect( crbuf, bufsize );
+ if(bytes_read<bufsize)
+ memset(crbuf+bytes_read, 0, bufsize-bytes_read);
// TODO (for Mark at least :P): understand this.
for (unsigned i = 0; i < bufsize/16; i++)
DeviceInput(): device(DEVICE_NONE), button(-1), level(0), bDown(false), ts(RageZeroTimer) { }
DeviceInput( InputDevice d, int b, float l=0 ): device(d), button(b), level(l), bDown(l > 0.5f), ts(RageZeroTimer) { }
DeviceInput( InputDevice d, int b, float l, const RageTimer &t ):
- device(d), button(b), level(l), ts(t) { }
+ device(d), button(b), level(l), bDown(l > 0.5f), ts(t) { }
bool operator==( const DeviceInput &other ) const
{
if( m_Param.StopMode != RageSoundParams::M_AUTO )
return m_Param.StopMode;
- if( m_sFilePath.find("loop") != -1 )
+ if( m_sFilePath.find("loop") != CString::npos )
return RageSoundParams::M_LOOP;
else
return RageSoundParams::M_STOP;
start += i;
return false;
}
- ch = (ch << 6) | byte & 0x3F;
+ ch = (ch << 6) | (byte & 0x3F);
}
bool bValid = true;
int numdigits = 0;
while(p < Text.size() &&
- (hex && isxdigit(Text[p])) || (!hex && isdigit(Text[p])))
+ ((hex && isxdigit(Text[p])) || (!hex && isdigit(Text[p]))))
{
p++;
numdigits++;
{
m_textTimeRemaining.SetText( SecondsToMMSSMsMs(m_fCountdownSecs) );
if( !m_bExiting )
+ {
if(m_fCountdownSecs <= 0)
{
m_bExiting = true;
//m_fCountdownSecs--;
m_fCountdownSecs = (m_fCountdownSecs - fDeltaTime);
Screen::Update( fDeltaTime );
+ }
}
void ScreenEndlessBreak::DrawPrimitives()
CString sGroup = GAMESTATE->m_pCurSong->m_sGroupName;\r
sGroup.MakeLower();\r
\r
- if( sGroup.find("dance dance revolution") != -1 || sGroup.find("ddr") != -1 )\r
+ if( sGroup.find("dance dance revolution") != CString::npos || sGroup.find("ddr") != CString::npos )\r
{\r
m_bEasterEgg = true;\r
pSteps = GAMESTATE->m_pCurSong->GetClosestNotes( STEPS_TYPE_DANCE_SINGLE, DIFFICULTY_MEDIUM );\r
\r
/* Mark failure. This hasn't been done yet if m_bTwoPlayerRecovery is set. */\r
if( GAMESTATE->GetPlayerFailType(p) != SongOptions::FAIL_OFF &&\r
- (m_pLifeMeter[p] && m_pLifeMeter[p]->IsFailing()) || \r
- (m_pCombinedLifeMeter && m_pCombinedLifeMeter->IsFailing(p)) )\r
+ ((m_pLifeMeter[p] && m_pLifeMeter[p]->IsFailing()) || \r
+ (m_pCombinedLifeMeter && m_pCombinedLifeMeter->IsFailing(p))) )\r
STATSMAN->m_CurStageStats.m_player[p].bFailed = true;\r
\r
if( !STATSMAN->m_CurStageStats.m_player[p].bFailed )\r
{
CString s = a->sModifiers;
s.MakeLower();
- if( s.find("dark") != -1 ||
- s.find("stealth") != -1 )
+ if( s.find("dark") != CString::npos ||
+ s.find("stealth") != CString::npos )
{
bModsAreOkToShow = false;
break;
bool bLeftAndRightPressed = bLeftPressed && bRightPressed;
if ( type == IET_FIRST_PRESS )
+ {
if ( bLeftAndRightPressed )
m_MusicWheel.ChangeSort( SORT_MODE_MENU );
else
m_MusicWheel.Move( -1 );
+ }
}
void ScreenNetSelectMusic::MenuRight( PlayerNumber pn, const InputEventType type )
bool bLeftAndRightPressed = bLeftPressed && bRightPressed;
if ( type == IET_FIRST_PRESS )
+ {
if ( bLeftAndRightPressed )
m_MusicWheel.ChangeSort( SORT_MODE_MENU );
else
m_MusicWheel.Move( +1 );
+ }
}
void ScreenNetSelectMusic::MenuUp( PlayerNumber pn, const InputEventType type )
INCLUDE_DOUBLE_IN_JP == 0 &&
(
GAMESTATE->GetNumSidesJoined() == SidesJoinedToPlay ||
- (modename.substr(0, 6) == "DOUBLE" || modename.substr(0, 13) == "ARCADE-DOUBLE" ||
+ ((modename.substr(0, 6) == "DOUBLE" || modename.substr(0, 13) == "ARCADE-DOUBLE" ||
modename.substr(0, 10) == "HALFDOUBLE" || modename.substr(0, 17) == "ARCADE-HALFDOUBLE") &&
- GAMESTATE->GetNumSidesJoined() != 2
+ GAMESTATE->GetNumSidesJoined() != 2)
)
)
)
unsigned long iPercent = iCurrent / (iTotal/100);\r
\r
// XXX: kind of voodoo\r
- CString sMessage = ssprintf( "\n\n%s\n%i%%\n%s",\r
+ CString sMessage = ssprintf( "\n\n%s\n%lu%%\n%s",\r
CUSTOM_SONG_WAIT_TEXT.GetValue().c_str(), \r
iPercent,\r
CUSTOM_SONG_CANCEL_TEXT.GetValue().c_str() );\r
/* Please note: displaying banners if CustomSongPreviews\r
* is for testing only and is not intended behaviour. */\r
if ( PREFSMAN->m_bShowBanners )\r
+ {\r
if( pSong->IsCustomSong() && !PREFSMAN->m_bCustomSongPreviews )\r
g_sBannerPath = THEME->GetPathG("Banner","custom");\r
else\r
g_sBannerPath = pSong->GetBannerPath();\r
+ }\r
\r
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )\r
{\r
/* If there's no path in the file, the file is in the same directory
* as the song. (This is the preferred configuration.) */
- if( sPath.find('/') == -1 )
+ if( sPath.find('/') == CString::npos )
return sSongPath+sPath;
/* The song contains a path; treat it as relative to the top SM directory. */
if( iNewState < 0 || iNewState >= (int)m_States.size() )
{
// Don't warn about number of states in "_blank".
- if( !m_pTexture || m_pTexture->GetID().filename.find("_blank") == -1 )
+ if( !m_pTexture || m_pTexture->GetID().filename.find("_blank") == CString::npos )
{
CString sError;
if( m_pTexture )
bool UnlockEntry::IsLocked() const
{
- float fScores[NUM_UNLOCK_TYPES];
+ float fScores[NUM_UNLOCK_TYPES] = {};
UNLOCKMAN->GetPoints( PROFILEMAN->GetMachineProfile(), fScores );
for( int i = 0; i < NUM_UNLOCK_TYPES; ++i )
/* Any packs containing these folders will be rejected from addition
* due to possible conflicts, problems, or stability issues, */
-static const int NUM_BLACKLISTED_FOLDERS = 4;
+static const unsigned NUM_BLACKLISTED_FOLDERS = 4;
static const char *BLACKLISTED_FOLDERS[] = { "Data", "Program", "Themes/default", "Themes/home" };
bool UserPackManager::IsPackMountable( const CString &sPack, CString &sError )
if( LIGHTS_API_VERSION_MAJOR != info->mi_api_ver_major ||
LIGHTS_API_VERSION_MINOR != info->mi_api_ver_minor )
{
- LOG->Warn( "LightsDriver \"%s\" uses API version %d%.%d, binary uses %d%.%d. Disabled.",
+ LOG->Warn( "LightsDriver \"%s\" uses API version %d.%d, binary uses %d.%d. Disabled.",
info->mi_name, info->mi_api_ver_major, info->mi_api_ver_minor,
LIGHTS_API_VERSION_MAJOR, LIGHTS_API_VERSION_MINOR );
return false;
static bool pApplyMasks()
{
- if( X11Helper::Dpy == NULL | !g_bHaveWin )
+ if( X11Helper::Dpy == NULL || !g_bHaveWin )
return true;
LOG->Trace("X11Helper: Reapplying event masks.");