War on -Werror, part 12: explicit bool usage.

It may save a few cycles, but it's best to be
explicit on boolean operations, especially with
ASSERT.
This commit is contained in:
Jason Felds
2012-12-27 11:38:53 -05:00
parent bddbed7e7e
commit 1fc16698ba
46 changed files with 122 additions and 122 deletions
+3 -3
View File
@@ -9,7 +9,7 @@
void Attack::GetAttackBeats( const Song *pSong, float &fStartBeat, float &fEndBeat ) const
{
ASSERT( pSong );
ASSERT( pSong != NULL );
ASSERT_M( fStartSecond >= 0, ssprintf("StartSecond: %f",fStartSecond) );
const TimingData &timing = pSong->m_SongTiming;
@@ -28,8 +28,8 @@ void Attack::GetRealtimeAttackBeats( const Song *pSong, const PlayerState* pPlay
return;
}
ASSERT( pPlayerState );
ASSERT( pSong );
ASSERT( pPlayerState != NULL );
ASSERT( pSong != NULL );
/* If reasonable, push the attack forward 8 beats so that notes on screen don't change suddenly. */
fStartBeat = min( GAMESTATE->m_Position.m_fSongBeat+8, pPlayerState->m_fLastDrawnBeat );
+1 -1
View File
@@ -46,7 +46,7 @@ void AttackDisplay::Init( const PlayerState* pPlayerState )
for( int al=0; al<NUM_ATTACK_LEVELS; al++ )
{
const Character *ch = GAMESTATE->m_pCurCharacters[pn];
ASSERT( ch );
ASSERT( ch != NULL );
const RString* asAttacks = ch->m_sAttacks[al];
for( int att = 0; att < NUM_ATTACKS_PER_LEVEL; ++att )
attacks.insert( asAttacks[att] );
+1 -1
View File
@@ -278,7 +278,7 @@ void AutoKeysounds::FinishLoading()
delete pChain;
}
}
ASSERT_M( m_pSharedSound, ssprintf("No keysounds were loaded for the song %s!", pSong->m_sMainTitle.c_str() ));
ASSERT_M( m_pSharedSound != NULL, ssprintf("No keysounds were loaded for the song %s!", pSong->m_sMainTitle.c_str() ));
m_pSharedSound = new RageSoundReader_PitchChange( m_pSharedSound );
m_pSharedSound = new RageSoundReader_PostBuffering( m_pSharedSound );
+5 -5
View File
@@ -179,7 +179,7 @@ void BPMDisplay::NoBPM()
void BPMDisplay::SetBpmFromSong( const Song* pSong )
{
ASSERT( pSong );
ASSERT( pSong != NULL );
switch( pSong->m_DisplayBPMType )
{
case DISPLAY_BPM_ACTUAL:
@@ -201,7 +201,7 @@ void BPMDisplay::SetBpmFromSong( const Song* pSong )
void BPMDisplay::SetBpmFromSteps( const Steps* pSteps )
{
ASSERT( pSteps );
ASSERT( pSteps != NULL );
DisplayBpms bpms;
float fMinBPM, fMaxBPM;
pSteps->m_Timing.GetActualBPM( fMinBPM, fMaxBPM );
@@ -212,13 +212,13 @@ void BPMDisplay::SetBpmFromSteps( const Steps* pSteps )
void BPMDisplay::SetBpmFromCourse( const Course* pCourse )
{
ASSERT( pCourse );
ASSERT( GAMESTATE->GetCurrentStyle() );
ASSERT( pCourse != NULL );
ASSERT( GAMESTATE->GetCurrentStyle() != NULL );
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
Trail *pTrail = pCourse->GetTrail( st );
// GetTranslitFullTitle because "Crashinfo.txt is garbled because of the ANSI output as usual." -f
ASSERT_M( pTrail, ssprintf("Course '%s' has no trail for StepsType '%s'", pCourse->GetTranslitFullTitle().c_str(), StringConversion::ToString(st).c_str() ) );
ASSERT_M( pTrail != NULL, ssprintf("Course '%s' has no trail for StepsType '%s'", pCourse->GetTranslitFullTitle().c_str(), StringConversion::ToString(st).c_str() ) );
m_fCycleTime = (float)COURSE_CYCLE_SPEED;
+1 -1
View File
@@ -373,7 +373,7 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
Actor *pActor = ActorUtil::MakeActor( sEffectFile );
ASSERT( pActor );
ASSERT( pActor != NULL );
m_BGAnimations[bd] = pActor;
for( unsigned i=0; i<vsResolvedRef.size(); i++ )
+2 -2
View File
@@ -195,7 +195,7 @@ void CourseUtil::SortCoursePointerArrayByNumPlays( vector<Course*> &vpCoursesInO
void CourseUtil::SortCoursePointerArrayByNumPlays( vector<Course*> &vpCoursesInOut, const Profile* pProfile, bool bDescending )
{
ASSERT( pProfile );
ASSERT( pProfile != NULL );
for(unsigned i = 0; i < vpCoursesInOut.size(); ++i)
course_sort_val[vpCoursesInOut[i]] = ssprintf( "%09i", pProfile->GetCourseNumTimesPlayed(vpCoursesInOut[i]) );
stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), bDescending ? CompareCoursePointersBySortValueDescending : CompareCoursePointersBySortValueAscending );
@@ -448,7 +448,7 @@ bool EditCourseUtil::ValidateEditCourseName( const RString &sAnswer, RString &sE
void EditCourseUtil::UpdateAndSetTrail()
{
ASSERT( GAMESTATE->m_pCurStyle );
ASSERT( GAMESTATE->m_pCurStyle != NULL );
StepsType st = GAMESTATE->m_pCurStyle->m_StepsType;
Trail *pTrail = NULL;
if( GAMESTATE->m_pCurCourse )
+1 -1
View File
@@ -166,7 +166,7 @@ void DancingCharacters::LoadNextSong()
m_fThisCameraStartBeat = 0;
m_fThisCameraEndBeat = 0;
ASSERT( GAMESTATE->m_pCurSong );
ASSERT( GAMESTATE->m_pCurSong != NULL );
m_fThisCameraEndBeat = GAMESTATE->m_pCurSong->GetFirstBeat();
FOREACH_PlayerNumber( p )
+8 -8
View File
@@ -278,7 +278,7 @@ void GameState::Reset()
FOREACH_PlayerNumber( pn )
UnjoinPlayer( pn );
ASSERT( THEME );
ASSERT( THEME != NULL );
m_timeGameStarted.SetZero();
SetCurrentStyle( NULL );
@@ -339,7 +339,7 @@ void GameState::Reset()
m_pCurCharacters[p] = CHARMAN->GetRandomCharacter();
else
m_pCurCharacters[p] = CHARMAN->GetDefaultCharacter();
ASSERT( m_pCurCharacters[p] );
ASSERT( m_pCurCharacters[p] != NULL );
}
m_bTemporaryEventMode = false;
@@ -626,7 +626,7 @@ int GameState::GetNumStagesMultiplierForSong( const Song* pSong )
{
int iNumStages = 1;
ASSERT( pSong );
ASSERT( pSong != NULL );
if( pSong->IsMarathon() )
iNumStages *= 3;
if( pSong->IsLong() )
@@ -1458,7 +1458,7 @@ void GameState::GetAllUsedNoteSkins( vector<RString> &out ) const
if( IsCourseMode() )
{
const Trail *pTrail = m_pCurTrail[pn];
ASSERT( pTrail );
ASSERT( pTrail != NULL );
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
{
@@ -1587,11 +1587,11 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
SongAndSteps sas;
ASSERT( !STATSMAN->m_vPlayedStageStats[i].m_vpPlayedSongs.empty() );
sas.pSong = STATSMAN->m_vPlayedStageStats[i].m_vpPlayedSongs[0];
ASSERT( sas.pSong );
ASSERT( sas.pSong != NULL );
if( STATSMAN->m_vPlayedStageStats[i].m_player[pn].m_vpPossibleSteps.empty() )
continue;
sas.pSteps = STATSMAN->m_vPlayedStageStats[i].m_player[pn].m_vpPossibleSteps[0];
ASSERT( sas.pSteps );
ASSERT( sas.pSteps != NULL );
vSongAndSteps.push_back( sas );
}
CHECKPOINT;
@@ -1729,9 +1729,9 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
{
CHECKPOINT;
Course* pCourse = m_pCurCourse;
ASSERT( pCourse );
ASSERT( pCourse != NULL );
Trail *pTrail = m_pCurTrail[pn];
ASSERT( pTrail );
ASSERT( pTrail != NULL );
CourseDifficulty cd = pTrail->m_CourseDifficulty;
// Find Machine Records
+1 -1
View File
@@ -90,7 +90,7 @@ void LifeMeterTime::OnLoadSong()
return;
Course* pCourse = GAMESTATE->m_pCurCourse;
ASSERT( pCourse );
ASSERT( pCourse != NULL );
float fOldLife = m_fLifeTotalLostSeconds;
float fGainSeconds = pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].fGainSeconds;
+1 -1
View File
@@ -151,7 +151,7 @@ void MusicWheel::BeginScreen()
const vector<MusicWheelItemData *> &from = getWheelItemsData(SORT_MODE_MENU);
for( unsigned i=0; i<from.size(); i++ )
{
ASSERT( &*from[i]->m_pAction );
ASSERT( &*from[i]->m_pAction != NULL );
if( from[i]->m_pAction->DescribesCurrentModeForAllPlayers() )
{
m_sLastModeMenuItem = from[i]->m_pAction->m_sName;
+1 -1
View File
@@ -145,7 +145,7 @@ static NoteResource *MakeNoteResource( const RString &sButton, const RString &sE
NoteResource *pRes = new NoteResource( nsap );
pRes->m_pActor = NOTESKIN->LoadActor( sButton, sElement, NULL, bSpriteOnly );
ASSERT( pRes->m_pActor );
ASSERT( pRes->m_pActor != NULL );
g_NoteResource[nsap] = pRes;
it = g_NoteResource.find( nsap );
+2 -2
View File
@@ -175,7 +175,7 @@ void NoteField::Load(
int iDrawDistanceAfterTargetsPixels,
int iDrawDistanceBeforeTargetsPixels )
{
ASSERT( pNoteData );
ASSERT( pNoteData != NULL );
m_pNoteData = pNoteData;
m_iDrawDistanceAfterTargetsPixels = iDrawDistanceAfterTargetsPixels;
m_iDrawDistanceBeforeTargetsPixels = iDrawDistanceBeforeTargetsPixels;
@@ -915,7 +915,7 @@ void NoteField::DrawPrimitives()
if( GAMESTATE->IsEditing() && pTiming != NULL )
{
ASSERT(GAMESTATE->m_pCurSong);
ASSERT(GAMESTATE->m_pCurSong != NULL);
const TimingData &timing = *pTiming;
+1 -1
View File
@@ -1268,7 +1268,7 @@ bool BMSLoader::LoadFromDir( const RString &sDir, Song &out )
/* We should have at least one; if we had none, we shouldn't have been
* called to begin with. */
ASSERT( arrayBMSFileNames.size() );
ASSERT( arrayBMSFileNames.size() != 0 );
BMSSongLoader loader( sDir, &out );
for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
+1 -1
View File
@@ -744,7 +744,7 @@ bool KSFLoader::LoadFromDir( const RString &sDir, Song &out )
GetDirListing( sDir + RString("*.ksf"), arrayKSFFileNames );
// We shouldn't have been called to begin with if there were no KSFs.
ASSERT( arrayKSFFileNames.size() );
ASSERT( arrayKSFFileNames.size() != 0 );
bool bKIUCompliant = false;
/* With Split Timing, there has to be a backup Song Timing in case
+1 -1
View File
@@ -216,7 +216,7 @@ RString OptionRow::GetRowTitle() const
const Course *pCourse = GAMESTATE->m_pCurCourse;
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
const Trail* pTrail = pCourse->GetTrail( st );
ASSERT( pTrail );
ASSERT( pTrail != NULL );
pTrail->GetDisplayBpms( bpms );
}
+7 -7
View File
@@ -141,7 +141,7 @@ public:
const Command &command = cmds.v[0];
RString sParam = command.GetArg(1).s;
ASSERT( command.m_vsArgs.size() == 2 );
ASSERT( sParam.size() );
ASSERT( sParam.size() != 0 );
m_bUseModNameForIcon = true;
@@ -526,7 +526,7 @@ public:
const Command &command = cmds.v[0];
RString sParam = command.GetArg(1).s;
ASSERT( command.m_vsArgs.size() == 2 );
ASSERT( sParam.size() );
ASSERT( sParam.size() != 0 );
if( sParam == "EditSteps" )
{
@@ -707,7 +707,7 @@ class OptionRowHandlerListStyles: public OptionRowHandlerList
vector<const Style*> vStyles;
GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, vStyles );
ASSERT( vStyles.size() );
ASSERT( vStyles.size() != 0 );
FOREACH_CONST( const Style*, vStyles, s )
{
m_Def.m_vsChoices.push_back( GAMEMAN->StyleToLocalizedString(*s) );
@@ -731,7 +731,7 @@ class OptionRowHandlerListGroups: public OptionRowHandlerList
vector<RString> vSongGroups;
SONGMAN->GetSongGroupNames( vSongGroups );
ASSERT( vSongGroups.size() );
ASSERT( vSongGroups.size() != 0 );
{
m_Def.m_vsChoices.push_back( "AllGroups" );
@@ -861,7 +861,7 @@ public:
const Command &command = cmds.v[0];
ASSERT( command.m_vsArgs.size() == 2 );
RString sLuaFunction = command.m_vsArgs[1];
ASSERT( sLuaFunction.size() );
ASSERT( sLuaFunction.size() != 0 );
m_Def.m_bAllowThemeItems = false; // Lua options are always dynamic and can theme themselves.
@@ -1115,7 +1115,7 @@ public:
const Command &command = cmds.v[0];
RString sParam = command.GetArg(1).s;
ASSERT( command.m_vsArgs.size() == 2 );
ASSERT( sParam.size() );
ASSERT( sParam.size() != 0 );
Init();
@@ -1199,7 +1199,7 @@ public:
const Command &command = cmds.v[0];
RString sParam = command.GetArg(1).s;
ASSERT( command.m_vsArgs.size() == 2 );
ASSERT( sParam.size() );
ASSERT( sParam.size() != 0 );
if( sParam == "EditStepsType" )
{
+1 -1
View File
@@ -101,7 +101,7 @@ void OptionListRow::SetFromHandler( const OptionRowHandler *pHandler )
void OptionListRow::SetTextFromHandler( const OptionRowHandler *pHandler )
{
ASSERT( pHandler );
ASSERT( pHandler != NULL );
for( unsigned i = 0; i < pHandler->m_Def.m_vsChoices.size(); ++i )
{
// init text
+3 -3
View File
@@ -415,12 +415,12 @@ void Player::Init(
if( GAMESTATE->IsCourseMode() )
{
ASSERT( GAMESTATE->m_pCurTrail[pn] );
ASSERT( GAMESTATE->m_pCurTrail[pn] != NULL );
GAMESTATE->m_pCurTrail[pn]->GetDisplayBpms( bpms );
}
else
{
ASSERT( GAMESTATE->m_pCurSong );
ASSERT( GAMESTATE->m_pCurSong != NULL );
GAMESTATE->m_pCurSong->GetDisplayBpms( bpms );
}
@@ -931,7 +931,7 @@ void Player::Update( float fDeltaTime )
ASSERT_M( iNumCols <= MAX_COLS_PER_PLAYER, ssprintf("%i > %i", iNumCols, MAX_COLS_PER_PLAYER) );
for( int col=0; col < iNumCols; ++col )
{
ASSERT( m_pPlayerState );
ASSERT( m_pPlayerState != NULL );
// TODO: Remove use of PlayerNumber.
GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( col, m_pPlayerState->m_PlayerNumber );
+3 -3
View File
@@ -281,7 +281,7 @@ void PlayerOptions::FromString( const RString &sMultipleMods )
bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut )
{
ASSERT_M( NOTESKIN, "The Noteskin Manager must be loaded in order to process mods." );
ASSERT_M( NOTESKIN != NULL, "The Noteskin Manager must be loaded in order to process mods." );
RString sBit = sOneMod;
sBit.MakeLower();
@@ -763,8 +763,8 @@ bool PlayerOptions::IsEasierForSongAndSteps( Song* pSong, Steps* pSteps, PlayerN
bool PlayerOptions::IsEasierForCourseAndTrail( Course* pCourse, Trail* pTrail ) const
{
ASSERT( pCourse );
ASSERT( pTrail );
ASSERT( pCourse != NULL );
ASSERT( pTrail != NULL );
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
{
+7 -7
View File
@@ -1383,7 +1383,7 @@ XNode* Profile::SaveSongScoresCreateNode() const
CHECKPOINT;
const Profile* pProfile = this;
ASSERT( pProfile );
ASSERT( pProfile != NULL );
XNode* pNode = new XNode( "SongScores" );
@@ -1464,7 +1464,7 @@ XNode* Profile::SaveCourseScoresCreateNode() const
CHECKPOINT;
const Profile* pProfile = this;
ASSERT( pProfile );
ASSERT( pProfile != NULL );
XNode* pNode = new XNode( "CourseScores" );
@@ -1572,7 +1572,7 @@ XNode* Profile::SaveCategoryScoresCreateNode() const
CHECKPOINT;
const Profile* pProfile = this;
ASSERT( pProfile );
ASSERT( pProfile != NULL );
XNode* pNode = new XNode( "CategoryScores" );
@@ -1644,7 +1644,7 @@ void Profile::LoadCategoryScoresFromNode( const XNode* pCategoryScores )
void Profile::SaveStatsWebPageToDir( RString sDir ) const
{
ASSERT( PROFILEMAN );
ASSERT( PROFILEMAN != NULL );
}
void Profile::SaveMachinePublicKeyToDir( RString sDir ) const
@@ -1680,7 +1680,7 @@ XNode* Profile::SaveScreenshotDataCreateNode() const
CHECKPOINT;
const Profile* pProfile = this;
ASSERT( pProfile );
ASSERT( pProfile != NULL );
XNode* pNode = new XNode( "ScreenshotData" );
@@ -1722,7 +1722,7 @@ XNode* Profile::SaveCalorieDataCreateNode() const
CHECKPOINT;
const Profile* pProfile = this;
ASSERT( pProfile );
ASSERT( pProfile != NULL );
XNode* pNode = new XNode( "CalorieData" );
@@ -1845,7 +1845,7 @@ XNode* Profile::SaveCoinDataCreateNode() const
CHECKPOINT;
const Profile* pProfile = this;
ASSERT( pProfile );
ASSERT( pProfile != NULL );
XNode* pNode = new XNode( "CoinData" );
+6 -6
View File
@@ -114,12 +114,12 @@ void ProfileManager::Init()
{
RString sCharacterID = FIXED_PROFILE_CHARACTER_ID( i );
Character *pCharacter = CHARMAN->GetCharacterFromID( sCharacterID );
ASSERT_M( pCharacter, sCharacterID );
ASSERT_M( pCharacter != NULL, sCharacterID );
RString sProfileID;
bool b = CreateLocalProfile( pCharacter->GetDisplayName(), sProfileID );
ASSERT( b );
Profile* pProfile = GetLocalProfile( sProfileID );
ASSERT_M( pProfile, sProfileID );
ASSERT_M( pProfile != NULL, sProfileID );
pProfile->m_sCharacterID = sCharacterID;
SaveLocalProfile( sProfileID );
}
@@ -473,7 +473,7 @@ bool ProfileManager::RenameLocalProfile( RString sProfileID, RString sNewName )
ASSERT( !sProfileID.empty() );
Profile *pProfile = ProfileManager::GetLocalProfile( sProfileID );
ASSERT( pProfile );
ASSERT( pProfile != NULL );
pProfile->m_sDisplayName = sNewName;
RString sProfileDir = LocalProfileIDToDir( sProfileID );
@@ -483,7 +483,7 @@ bool ProfileManager::RenameLocalProfile( RString sProfileID, RString sNewName )
bool ProfileManager::DeleteLocalProfile( RString sProfileID )
{
Profile *pProfile = ProfileManager::GetLocalProfile( sProfileID );
ASSERT( pProfile );
ASSERT( pProfile != NULL );
RString sProfileDir = LocalProfileIDToDir( sProfileID );
// flush directory cache in an attempt to get this working
@@ -820,7 +820,7 @@ class LunaProfileManager: public Luna<ProfileManager>
{
public:
static int IsPersistentProfile( T* p, lua_State *L ) { lua_pushboolean(L, p->IsPersistentProfile(Enum::Check<PlayerNumber>(L, 1)) ); return 1; }
static int GetProfile( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1); Profile* pP = p->GetProfile(pn); ASSERT(pP); pP->PushSelf(L); return 1; }
static int GetProfile( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1); Profile* pP = p->GetProfile(pn); ASSERT(pP != NULL); pP->PushSelf(L); return 1; }
static int GetMachineProfile( T* p, lua_State *L ) { p->GetMachineProfile()->PushSelf(L); return 1; }
static int SaveMachineProfile( T* p, lua_State *L ) { p->SaveMachineProfile(); return 0; }
static int GetLocalProfile( T* p, lua_State *L )
@@ -832,7 +832,7 @@ public:
lua_pushnil(L);
return 1;
}
static int GetLocalProfileFromIndex( T* p, lua_State *L ) { Profile *pProfile = p->GetLocalProfileFromIndex(IArg(1)); ASSERT(pProfile); pProfile->PushSelf(L); return 1; }
static int GetLocalProfileFromIndex( T* p, lua_State *L ) { Profile *pProfile = p->GetLocalProfileFromIndex(IArg(1)); ASSERT(pProfile != NULL); pProfile->PushSelf(L); return 1; }
static int GetLocalProfileIDFromIndex( T* p, lua_State *L ) { lua_pushstring(L, p->GetLocalProfileIDFromIndex(IArg(1)) ); return 1; }
static int GetLocalProfileIndexFromID( T* p, lua_State *L ) { lua_pushnumber(L, p->GetLocalProfileIndexFromID(SArg(1)) ); return 1; }
static int GetNumLocalProfiles( T* p, lua_State *L ) { lua_pushnumber(L, p->GetNumLocalProfiles() ); return 1; }
+2 -2
View File
@@ -101,9 +101,9 @@ void ScoreKeeperNormal::Load(
for( unsigned i=0; i<apSteps.size(); i++ )
{
Song* pSong = apSongs[i];
ASSERT( pSong );
ASSERT( pSong != NULL );
Steps* pSteps = apSteps[i];
ASSERT( pSteps );
ASSERT( pSteps != NULL );
const AttackArray &aa = asModifiers[i];
NoteData ndTemp;
pSteps->GetNoteData( ndTemp );
+8 -8
View File
@@ -1099,8 +1099,8 @@ void ScreenEdit::Init()
SubscribeToMessage( "Judgment" );
ASSERT( GAMESTATE->m_pCurSong );
ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] );
ASSERT( GAMESTATE->m_pCurSong != NULL );
ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] != NULL );
EDIT_MODE.Load( m_sName, "EditMode" );
ScreenWithMenuElements::Init();
@@ -2106,7 +2106,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
// save current steps
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
ASSERT( pSteps );
ASSERT( pSteps != NULL );
pSteps->SetNoteData( m_NoteDataEdit );
// Get all Steps of this StepsType
@@ -3072,7 +3072,7 @@ void ScreenEdit::TransitionEditState( EditState em )
/* FirstBeat affects backgrounds, so commit changes to memory (not to disk)
* and recalc it. */
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
ASSERT( pSteps );
ASSERT( pSteps != NULL );
pSteps->SetNoteData( m_NoteDataEdit );
m_pSong->ReCalculateRadarValuesAndLastSecond();
@@ -3455,7 +3455,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
GAMESTATE->m_pCurCourse.Set( pCourse );
GAMESTATE->m_iEditCourseEntryIndex.Set( iCourseEntryIndex );
ASSERT( GAMESTATE->m_pCurCourse );
ASSERT( GAMESTATE->m_pCurCourse != NULL );
}
}
else if (SM == SM_BackFromKeysoundTrack)
@@ -5487,8 +5487,8 @@ void ScreenEdit::SetupCourseAttacks()
void ScreenEdit::CopyToLastSave()
{
ASSERT( GAMESTATE->m_pCurSong );
ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] );
ASSERT( GAMESTATE->m_pCurSong != NULL );
ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] != NULL );
m_SongLastSave = *GAMESTATE->m_pCurSong;
m_vStepsLastSave.clear();
const vector<Steps*> &vSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( GAMESTATE->m_pCurSteps[PLAYER_1]->m_StepsType );
@@ -5510,7 +5510,7 @@ void ScreenEdit::CopyFromLastSave()
void ScreenEdit::RevertFromDisk()
{
ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] );
ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] != NULL );
StepsID id;
id.FromSteps( GAMESTATE->m_pCurSteps[PLAYER_1] );
ASSERT( id.IsValid() );
+3 -3
View File
@@ -216,7 +216,7 @@ void ScreenEditMenu::MenuStart( const InputEventPlus & )
{
case EditMenuAction_Delete:
{
ASSERT( pSteps );
ASSERT( pSteps != NULL );
if( pSteps->IsAutogen() )
{
SCREENMAN->PlayInvalidSound();
@@ -234,7 +234,7 @@ void ScreenEditMenu::MenuStart( const InputEventPlus & )
case EditMenuAction_Practice:
break;
case EditMenuAction_Delete:
ASSERT( pSteps );
ASSERT( pSteps != NULL );
ScreenPrompt::Prompt( SM_None, STEPS_WILL_BE_LOST.GetValue() + "\n\n" + CONTINUE_WITH_DELETE.GetValue(),
PROMPT_YES_NO, ANSWER_NO );
break;
@@ -294,7 +294,7 @@ void ScreenEditMenu::MenuStart( const InputEventPlus & )
case EditMenuAction_Practice:
{
// Prepare for ScreenEdit
ASSERT( pSteps );
ASSERT( pSteps != NULL );
bool bPromptToNameSteps = (action == EditMenuAction_Create && dc == Difficulty_Edit);
if( bPromptToNameSteps )
{
+8 -8
View File
@@ -428,7 +428,7 @@ void ScreenGameplay::Init()
GAMESTATE->m_pCurSteps[p].Set( GAMESTATE->m_pCurSteps[ GAMESTATE->GetFirstHumanPlayer() ] );
FOREACH_EnabledPlayer(p)
ASSERT( GAMESTATE->m_pCurSteps[p].Get() );
ASSERT( GAMESTATE->m_pCurSteps[p].Get() != NULL );
}
/* Increment the course play count. */
@@ -814,28 +814,28 @@ void ScreenGameplay::InitSongQueues()
if( GAMESTATE->IsCourseMode() )
{
Course* pCourse = GAMESTATE->m_pCurCourse;
ASSERT( pCourse );
ASSERT( pCourse != NULL );
m_apSongsQueue.clear();
PlayerNumber pnMaster = GAMESTATE->GetMasterPlayerNumber();
Trail *pTrail = GAMESTATE->m_pCurTrail[pnMaster];
ASSERT( pTrail );
ASSERT( pTrail != NULL );
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
{
ASSERT( e->pSong );
ASSERT( e->pSong != NULL );
m_apSongsQueue.push_back( e->pSong );
}
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{
Trail *lTrail = GAMESTATE->m_pCurTrail[ pi->GetStepsAndTrailIndex() ];
ASSERT( lTrail );
ASSERT( lTrail != NULL );
pi->m_vpStepsQueue.clear();
pi->m_asModifiersQueue.clear();
FOREACH_CONST( TrailEntry, lTrail->m_vEntries, e )
{
ASSERT( e->pSteps );
ASSERT( e->pSteps != NULL );
pi->m_vpStepsQueue.push_back( e->pSteps );
AttackArray a;
e->GetAttackArray( a );
@@ -1094,7 +1094,7 @@ void ScreenGameplay::LoadNextSong()
Steps* pSteps = GAMESTATE->m_pCurSteps[ pi->GetStepsAndTrailIndex() ];
++pi->GetPlayerStageStats()->m_iStepsPlayed;
ASSERT( GAMESTATE->m_pCurSteps[ pi->GetStepsAndTrailIndex() ] );
ASSERT( GAMESTATE->m_pCurSteps[ pi->GetStepsAndTrailIndex() ] != NULL );
if( pi->m_ptextStepsDescription )
pi->m_ptextStepsDescription->SetText( pSteps->GetDescription() );
@@ -1285,7 +1285,7 @@ void ScreenGameplay::LoadLights()
// First, check if the song has explicit lights
m_CabinetLightsNoteData.Init();
ASSERT( GAMESTATE->m_pCurSong );
ASSERT( GAMESTATE->m_pCurSong != NULL );
const Steps *pSteps = SongUtil::GetClosestNotes( GAMESTATE->m_pCurSong, StepsType_lights_cabinet, Difficulty_Medium );
if( pSteps != NULL )
+2 -2
View File
@@ -15,8 +15,8 @@ ScreenGameplayLesson::ScreenGameplayLesson()
void ScreenGameplayLesson::Init()
{
ASSERT( GAMESTATE->GetCurrentStyle() );
ASSERT( GAMESTATE->m_pCurSong );
ASSERT( GAMESTATE->GetCurrentStyle() != NULL );
ASSERT( GAMESTATE->m_pCurSong != NULL );
/* Now that we've set up, init the base class. */
ScreenGameplayNormal::Init();
+2 -2
View File
@@ -152,7 +152,7 @@ void ScreenJukebox::SetSong()
FOREACH_PlayerNumber( p )
{
GAMESTATE->m_pCurTrail[p].Set( lCourse->GetTrail( GAMESTATE->GetCurrentStyle()->m_StepsType ) );
ASSERT( GAMESTATE->m_pCurTrail[p] );
ASSERT( GAMESTATE->m_pCurTrail[p] != NULL );
}
}
}
@@ -172,7 +172,7 @@ ScreenJukebox::ScreenJukebox()
void ScreenJukebox::Init()
{
// ScreenJukeboxMenu must set this
ASSERT( GAMESTATE->GetCurrentStyle() );
ASSERT( GAMESTATE->GetCurrentStyle() != NULL );
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
SetSong();
+1 -1
View File
@@ -128,7 +128,7 @@ ScreenNameEntry::ScreenNameEntry()
ss.m_vpPossibleSongs = ss.m_vpPlayedSongs;
ss.m_pStyle = GAMESTATE->GetCurrentStyle();
ss.m_playMode = GAMESTATE->m_PlayMode;
ASSERT( ss.m_vpPlayedSongs[0]->GetAllSteps().size() );
ASSERT( ss.m_vpPlayedSongs[0]->GetAllSteps().size() != 0 );
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
FOREACH_PlayerNumber( p )
+1 -1
View File
@@ -33,7 +33,7 @@ void ScreenNameEntryTraditional::Init()
ss.m_vpPossibleSongs = ss.m_vpPlayedSongs;
ss.m_pStyle = GAMESTATE->GetCurrentStyle();
ss.m_playMode = GAMESTATE->m_PlayMode;
ASSERT( ss.m_vpPlayedSongs[0]->GetAllSteps().size() );
ASSERT( ss.m_vpPlayedSongs[0]->GetAllSteps().size() != 0 );
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
FOREACH_PlayerNumber( p )
+1 -1
View File
@@ -197,7 +197,7 @@ void ScreenNetSelectBase::UpdateUsers()
/** ColorBitmapText ***********************************************************/
void ColorBitmapText::SetText( const RString& _sText, const RString& _sAlternateText, int iWrapWidthPixels )
{
ASSERT( m_pFont );
ASSERT( m_pFont != NULL );
RString sNewText = StringWillUseAlternate(_sText,_sAlternateText) ? _sAlternateText : _sText;
+1 -1
View File
@@ -1135,7 +1135,7 @@ bool ScreenOptions::MoveRowRelative( PlayerNumber pn, int iDir, bool bRepeat )
//LOG->Trace( "MoveRowRelative(pn %i, dir %i, rep %i)", pn, iDir, bRepeat );
int iDest = -1;
ASSERT( m_pRows.size() );
ASSERT( m_pRows.size() != 0 );
for( int r=1; r<(int)m_pRows.size(); r++ )
{
int iDelta = r*iDir;
+1 -1
View File
@@ -140,7 +140,7 @@ void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
else // a Steps
{
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
ASSERT( pSteps );
ASSERT( pSteps != NULL );
const Style *pStyle = GAMEMAN->GetEditorStyleForStepsType( pSteps->m_StepsType );
GAMESTATE->SetCurrentStyle( pStyle );
// do base behavior
+2 -2
View File
@@ -111,7 +111,7 @@ void ScreenOptionsManageProfiles::BeginScreen()
FOREACH_CONST( RString, m_vsLocalProfileID, s )
{
Profile *pProfile = PROFILEMAN->GetLocalProfile( *s );
ASSERT( pProfile );
ASSERT( pProfile != NULL );
RString sCommand = ssprintf( "gamecommand;screen,ScreenOptionsEditProfile;profileid,%s;name,dummy", s->c_str() );
OptionRowHandler *pHand = OptionRowHandlerUtil::Make( ParseCommands(sCommand) );
@@ -259,7 +259,7 @@ void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM )
if( !ScreenMiniMenu::s_bCancelled )
{
Profile *pProfile = PROFILEMAN->GetLocalProfile( GAMESTATE->m_sEditLocalProfileID );
ASSERT( pProfile );
ASSERT( pProfile != NULL );
switch( ScreenMiniMenu::s_iLastRowCode )
{
+1 -1
View File
@@ -101,7 +101,7 @@ static void MoveMap( int &sel, IPreference &opt, bool ToSel, const T *mapping, u
template <class T>
static void MoveMap( int &sel, const ConfOption *pConfOption, bool ToSel, const T *mapping, unsigned cnt )
{
ASSERT( pConfOption );
ASSERT( pConfOption != NULL );
IPreference *pPref = IPreference::GetPreferenceByName( pConfOption->m_sPrefName );
ASSERT_M( pPref != NULL, pConfOption->m_sPrefName );
+4 -4
View File
@@ -1248,7 +1248,7 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
SOUND->PlayOnceFromAnnouncer( "select course comment general" );
Course *pCourse = m_MusicWheel.GetSelectedCourse();
ASSERT( pCourse );
ASSERT( pCourse != NULL );
GAMESTATE->m_PlayMode.Set( pCourse->GetPlayMode() );
// apply #LIVES
@@ -1323,7 +1323,7 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
{
/* Since m_vpSteps is sorted by Difficulty, the first
* entry should be the easiest. */
ASSERT( m_vpSteps.size() );
ASSERT( m_vpSteps.size() != 0 );
Steps *pSteps = m_vpSteps[0];
FOREACH_PlayerNumber( p )
@@ -1438,12 +1438,12 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
PlayerNumber pn = GAMESTATE->GetMasterPlayerNumber();
if( GAMESTATE->IsCourseMode() )
{
ASSERT( GAMESTATE->m_pCurTrail[pn] );
ASSERT( GAMESTATE->m_pCurTrail[pn] != NULL );
stCurrent = GAMESTATE->m_pCurTrail[pn]->m_StepsType;
}
else
{
ASSERT( GAMESTATE->m_pCurSteps[pn] );
ASSERT( GAMESTATE->m_pCurSteps[pn] != NULL );
stCurrent = GAMESTATE->m_pCurSteps[pn]->m_StepsType;
}
vector<StepsType> vst;
+1 -1
View File
@@ -425,7 +425,7 @@ void ScreenServiceAction::BeginScreen()
else if( *s == "SyncEditsMachineToMemoryCard" ) pfn = SyncEditsMachineToMemoryCard;
else if( *s == "ResetPreferences" ) pfn = ResetPreferences;
ASSERT_M( pfn, *s );
ASSERT_M( pfn != NULL, *s );
RString sResult = pfn();
vsResults.push_back( sResult );
+2 -2
View File
@@ -105,7 +105,7 @@ void ScreenUnlockStatus::Init()
case UnlockRewardType_Song:
{
const Song *pSong = entry.m_Song.ToSong();
ASSERT( pSong );
ASSERT( pSong != NULL );
RString title = pSong->GetDisplayMainTitle();
RString subtitle = pSong->GetDisplaySubTitle();
@@ -118,7 +118,7 @@ void ScreenUnlockStatus::Init()
case UnlockRewardType_Course:
{
const Course *pCourse = entry.m_Course.ToCourse();
ASSERT( pCourse );
ASSERT( pCourse != NULL );
text->SetMaxWidth( MaxWidth );
text->SetText( pCourse->GetDisplayFullTitle() );
+5 -5
View File
@@ -481,7 +481,7 @@ RageColor SongManager::GetSongGroupColor( const RString &sSongGroup ) const
RageColor SongManager::GetSongColor( const Song* pSong ) const
{
ASSERT( pSong );
ASSERT( pSong != NULL );
// protected by royal freem corporation. any modification/removal of
// this code will result in prosecution.
@@ -1129,7 +1129,7 @@ void SongManager::GetStepsLoadedFromProfile( vector<Steps*> &AddTo, ProfileSlot
Song *SongManager::GetSongFromSteps( Steps *pSteps ) const
{
ASSERT( pSteps );
ASSERT( pSteps != NULL );
const vector<Song*> &vSongs = GetAllSongs();
FOREACH_CONST( Song*, vSongs, song )
{
@@ -1512,7 +1512,7 @@ void SongManager::UpdateShuffled()
void SongManager::UpdatePreferredSort(RString sPreferredSongs, RString sPreferredCourses)
{
ASSERT( UNLOCKMAN );
ASSERT( UNLOCKMAN != NULL );
{
m_vPreferredSongSort.clear();
@@ -1615,7 +1615,7 @@ void SongManager::UpdatePreferredSort(RString sPreferredSongs, RString sPreferre
FOREACH( PreferredSortSection, m_vPreferredSongSort, i )
FOREACH( Song*, i->vpSongs, j )
ASSERT( *j );
ASSERT( *j != NULL );
}
{
@@ -1689,7 +1689,7 @@ void SongManager::UpdatePreferredSort(RString sPreferredSongs, RString sPreferre
FOREACH( CoursePointerVector, m_vPreferredCourseSort, i )
FOREACH( Course*, *i, j )
ASSERT( *j );
ASSERT( *j != NULL );
}
}
+2 -2
View File
@@ -477,7 +477,7 @@ void SongUtil::SortSongPointerArrayByGrades( vector<Song*> &vpSongsInOut, bool b
int iCounts[NUM_Grade];
const Profile *pProfile = PROFILEMAN->GetMachineProfile();
ASSERT( pProfile );
ASSERT( pProfile != NULL );
pProfile->GetGrades( pSong, GAMESTATE->GetCurrentStyle()->m_StepsType, iCounts );
RString foo;
@@ -554,7 +554,7 @@ void SongUtil::SortSongPointerArrayByNumPlays( vector<Song*> &vpSongsInOut, Prof
void SongUtil::SortSongPointerArrayByNumPlays( vector<Song*> &vpSongsInOut, const Profile* pProfile, bool bDescending )
{
ASSERT( pProfile );
ASSERT( pProfile != NULL );
for(unsigned i = 0; i < vpSongsInOut.size(); ++i)
g_mapSongSortVal[vpSongsInOut[i]] = ssprintf("%9i", pProfile->GetSongNumTimesPlayed(vpSongsInOut[i]));
stable_sort( vpSongsInOut.begin(), vpSongsInOut.end(), bDescending ? CompareSongPointersBySortValueDescending : CompareSongPointersBySortValueAscending );
+8 -8
View File
@@ -43,8 +43,8 @@ void StageStats::AssertValid( PlayerNumber pn ) const
if( m_vpPlayedSongs[0] )
CHECKPOINT_M( m_vpPlayedSongs[0]->GetTranslitFullTitle() );
ASSERT( m_player[pn].m_iStepsPlayed > 0 );
ASSERT( m_player[pn].m_vpPossibleSteps.size() );
ASSERT( m_player[pn].m_vpPossibleSteps[0] );
ASSERT( m_player[pn].m_vpPossibleSteps.size() != 0 );
ASSERT( m_player[pn].m_vpPossibleSteps[0] != NULL );
ASSERT_M( m_playMode < NUM_PlayMode, ssprintf("playmode %i", m_playMode) );
ASSERT( m_pStyle != NULL );
ASSERT_M( m_player[pn].m_vpPossibleSteps[0]->GetDifficulty() < NUM_Difficulty, ssprintf("Invalid Difficulty %i", m_player[pn].m_vpPossibleSteps[0]->GetDifficulty()) );
@@ -58,8 +58,8 @@ void StageStats::AssertValid( MultiPlayer pn ) const
ASSERT( m_vpPossibleSongs.size() != 0 );
if( m_vpPlayedSongs[0] )
CHECKPOINT_M( m_vpPlayedSongs[0]->GetTranslitFullTitle() );
ASSERT( m_multiPlayer[pn].m_vpPossibleSteps.size() );
ASSERT( m_multiPlayer[pn].m_vpPossibleSteps[0] );
ASSERT( m_multiPlayer[pn].m_vpPossibleSteps.size() != 0 );
ASSERT( m_multiPlayer[pn].m_vpPossibleSteps[0] != NULL );
ASSERT_M( m_playMode < NUM_PlayMode, ssprintf("playmode %i", m_playMode) );
ASSERT( m_pStyle != NULL );
ASSERT_M( m_player[pn].m_vpPossibleSteps[0]->GetDifficulty() < NUM_Difficulty, ssprintf("difficulty %i", m_player[pn].m_vpPossibleSteps[0]->GetDifficulty()) );
@@ -239,14 +239,14 @@ void StageStats::FinalizeScores( bool bSummary )
{
// Save this stage to recent scores
Course* pCourse = GAMESTATE->m_pCurCourse;
ASSERT( pCourse );
ASSERT( pCourse != NULL );
Trail* pTrail = GAMESTATE->m_pCurTrail[p];
PROFILEMAN->AddCourseScore( pCourse, pTrail, p, hs, m_player[p].m_iPersonalHighScoreIndex, m_player[p].m_iMachineHighScoreIndex );
}
else
{
ASSERT( pSteps );
ASSERT( pSteps != NULL );
PROFILEMAN->AddStepsScore( pSong, pSteps, p, hs, m_player[p].m_iPersonalHighScoreIndex, m_player[p].m_iMachineHighScoreIndex );
}
@@ -272,9 +272,9 @@ void StageStats::FinalizeScores( bool bSummary )
else if( GAMESTATE->IsCourseMode() )
{
Course* pCourse = GAMESTATE->m_pCurCourse;
ASSERT( pCourse );
ASSERT( pCourse != NULL );
Trail *pTrail = GAMESTATE->m_pCurTrail[p];
ASSERT( pTrail );
ASSERT( pTrail != NULL );
pHSL = &pProfile->GetCourseHighScoreList( pCourse, pTrail );
}
else
+4 -4
View File
@@ -808,10 +808,10 @@ static void SwitchToLastPlayedGame()
void StepMania::ChangeCurrentGame( const Game* g )
{
ASSERT( g );
ASSERT( GAMESTATE );
ASSERT( ANNOUNCER );
ASSERT( THEME );
ASSERT( g != NULL );
ASSERT( GAMESTATE != NULL );
ASSERT( ANNOUNCER != NULL );
ASSERT( THEME != NULL );
GAMESTATE->SetCurGame( g );
+1 -1
View File
@@ -130,7 +130,7 @@ void StepsUtil::SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers,
}
}
ASSERT( pProfile );
ASSERT( pProfile != NULL );
for(unsigned i = 0; i < vStepsPointers.size(); ++i)
{
Steps* pSteps = vStepsPointers[i];
+2 -2
View File
@@ -108,7 +108,7 @@ const RadarValues &Trail::GetRadarValues() const
FOREACH_CONST( TrailEntry, m_vEntries, e )
{
const Steps *pSteps = e->pSteps;
ASSERT( pSteps );
ASSERT( pSteps != NULL );
// Hack: don't calculate for autogen entries
if( !pSteps->IsAutogen() && e->ContainsTransformOrTurn() )
{
@@ -187,7 +187,7 @@ void Trail::GetDisplayBpms( DisplayBpms &AddTo ) const
}
Song *pSong = e->pSong;
ASSERT( pSong );
ASSERT( pSong != NULL );
switch( pSong->m_DisplayBPMType )
{
case DISPLAY_BPM_ACTUAL:
+1 -1
View File
@@ -39,7 +39,7 @@ void TrailID::FromTrail( const Trail *p )
Trail *TrailID::ToTrail( const Course *p, bool bAllowNull ) const
{
ASSERT( p );
ASSERT( p != NULL );
Trail *pRet = NULL;
if( !m_Cache.Get(&pRet) )
+1 -1
View File
@@ -459,7 +459,7 @@ void WheelBase::RebuildWheelItems( int iDist )
// find the first wheel item shown
iFirstVisibleIndex -= NUM_WHEEL_ITEMS/2;
ASSERT(data.size());
ASSERT(data.size() != 0);
wrap( iFirstVisibleIndex, data.size() );
// iIndex is now the index of the lowest WheelItem to draw
+1 -1
View File
@@ -62,7 +62,7 @@ void WorkoutGraph::SetInternal( int iMinSongsPlayed )
vector<int> viMeters;
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
{
ASSERT( e->pSteps );
ASSERT( e->pSteps != NULL );
viMeters.push_back( e->pSteps->GetMeter() );
}