The big NULL replacement party part 1.

This is meant to be a safer alternative since
NULL can often be 0. Let's not rely on that.

And yes, I know this is a lot of files. This is
a safer thing to do in big commits vs for loops.
This commit is contained in:
Jason Felds
2013-05-03 23:01:54 -04:00
parent b22a3bd3c4
commit 9f24627bf9
167 changed files with 31932 additions and 31932 deletions
+2 -2
View File
@@ -1249,7 +1249,7 @@ void Actor::AddCommand( const RString &sCmdName, apActorCommands apac )
bool Actor::HasCommand( const RString &sCmdName ) const bool Actor::HasCommand( const RString &sCmdName ) const
{ {
return GetCommand(sCmdName) != NULL; return GetCommand(sCmdName) != nullptr;
} }
const apActorCommands *Actor::GetCommand( const RString &sCommandName ) const const apActorCommands *Actor::GetCommand( const RString &sCommandName ) const
@@ -1268,7 +1268,7 @@ void Actor::HandleMessage( const Message &msg )
void Actor::PlayCommandNoRecurse( const Message &msg ) void Actor::PlayCommandNoRecurse( const Message &msg )
{ {
const apActorCommands *pCmd = GetCommand( msg.GetName() ); const apActorCommands *pCmd = GetCommand( msg.GetName() );
if( pCmd != NULL ) if( pCmd != nullptr )
RunCommands( *pCmd, &msg.GetParamTable() ); RunCommands( *pCmd, &msg.GetParamTable() );
} }
+3 -3
View File
@@ -145,7 +145,7 @@ void ActorFrame::AddChild( Actor *pActor )
Dialog::OK( ssprintf("Actor \"%s\" adds child \"%s\" more than once", GetLineage().c_str(), pActor->GetName().c_str()) ); Dialog::OK( ssprintf("Actor \"%s\" adds child \"%s\" more than once", GetLineage().c_str(), pActor->GetName().c_str()) );
#endif #endif
ASSERT( pActor != NULL ); ASSERT( pActor != nullptr );
ASSERT( (void*)pActor != (void*)0xC0000005 ); ASSERT( (void*)pActor != (void*)0xC0000005 );
m_SubActors.push_back( pActor ); m_SubActors.push_back( pActor );
@@ -285,14 +285,14 @@ void ActorFrame::PushChildrenTable( lua_State *L )
void ActorFrame::PlayCommandOnChildren( const RString &sCommandName, const LuaReference *pParamTable ) void ActorFrame::PlayCommandOnChildren( const RString &sCommandName, const LuaReference *pParamTable )
{ {
const apActorCommands *pCmd = GetCommand( sCommandName ); const apActorCommands *pCmd = GetCommand( sCommandName );
if( pCmd != NULL ) if( pCmd != nullptr )
RunCommandsOnChildren( *pCmd, pParamTable ); RunCommandsOnChildren( *pCmd, pParamTable );
} }
void ActorFrame::PlayCommandOnLeaves( const RString &sCommandName, const LuaReference *pParamTable ) void ActorFrame::PlayCommandOnLeaves( const RString &sCommandName, const LuaReference *pParamTable )
{ {
const apActorCommands *pCmd = GetCommand( sCommandName ); const apActorCommands *pCmd = GetCommand( sCommandName );
if( pCmd != NULL ) if( pCmd != nullptr )
RunCommandsOnLeaves( **pCmd, pParamTable ); RunCommandsOnLeaves( **pCmd, pParamTable );
} }
+1 -1
View File
@@ -65,7 +65,7 @@ void ActorMultiTexture::ClearTextures()
int ActorMultiTexture::AddTexture( RageTexture *pTexture ) int ActorMultiTexture::AddTexture( RageTexture *pTexture )
{ {
ASSERT( pTexture != NULL ); ASSERT( pTexture != nullptr );
LOG->Trace( "ActorMultiTexture::AddTexture( %s )", pTexture->GetID().filename.c_str() ); LOG->Trace( "ActorMultiTexture::AddTexture( %s )", pTexture->GetID().filename.c_str() );
m_aTextureUnits.push_back( TextureUnitState() ); m_aTextureUnits.push_back( TextureUnitState() );
+2 -2
View File
@@ -16,7 +16,7 @@ bool ActorProxy::EarlyAbortDraw() const
void ActorProxy::DrawPrimitives() void ActorProxy::DrawPrimitives()
{ {
if( m_pActorTarget != NULL ) if( m_pActorTarget != nullptr )
{ {
bool bVisible = m_pActorTarget->GetVisible(); bool bVisible = m_pActorTarget->GetVisible();
m_pActorTarget->SetVisible( true ); m_pActorTarget->SetVisible( true );
@@ -47,7 +47,7 @@ public:
static int GetTarget( T* p, lua_State *L ) static int GetTarget( T* p, lua_State *L )
{ {
Actor *pTarget = p->GetTarget(); Actor *pTarget = p->GetTarget();
if( pTarget != NULL ) if( pTarget != nullptr )
pTarget->PushSelf( L ); pTarget->PushSelf( L );
else else
lua_pushnil( L ); lua_pushnil( L );
+1 -1
View File
@@ -103,7 +103,7 @@ bool ActorUtil::ResolvePath( RString &sPath, const RString &sName )
Actor* ActorUtil::LoadFromNode( const XNode* pNode, Actor *pParentActor ) Actor* ActorUtil::LoadFromNode( const XNode* pNode, Actor *pParentActor )
{ {
ASSERT( pNode != NULL ); ASSERT( pNode != nullptr );
// Remove this in favor of using conditionals in Lua. -Chris // Remove this in favor of using conditionals in Lua. -Chris
// There are a number of themes out there that depend on this (including // There are a number of themes out there that depend on this (including
+1 -1
View File
@@ -120,7 +120,7 @@ RString AnnouncerManager::GetPathTo( RString sAnnouncerName, RString sFolderName
/* Search for the announcer folder in the list of aliases. */ /* Search for the announcer folder in the list of aliases. */
int i; int i;
for(i = 0; aliases[i][0] != NULL; ++i) for(i = 0; aliases[i][0] != nullptr; ++i)
{ {
if(!sFolderName.EqualsNoCase(aliases[i][0])) if(!sFolderName.EqualsNoCase(aliases[i][0]))
continue; /* no match */ continue; /* no match */
+3 -3
View File
@@ -9,7 +9,7 @@
void Attack::GetAttackBeats( const Song *pSong, float &fStartBeat, float &fEndBeat ) const void Attack::GetAttackBeats( const Song *pSong, float &fStartBeat, float &fEndBeat ) const
{ {
ASSERT( pSong != NULL ); ASSERT( pSong != nullptr );
ASSERT_M( fStartSecond >= 0, ssprintf("StartSecond: %f",fStartSecond) ); ASSERT_M( fStartSecond >= 0, ssprintf("StartSecond: %f",fStartSecond) );
const TimingData &timing = pSong->m_SongTiming; const TimingData &timing = pSong->m_SongTiming;
@@ -28,8 +28,8 @@ void Attack::GetRealtimeAttackBeats( const Song *pSong, const PlayerState* pPlay
return; return;
} }
ASSERT( pPlayerState != NULL ); ASSERT( pPlayerState != nullptr );
ASSERT( pSong != NULL ); ASSERT( pSong != nullptr );
/* If reasonable, push the attack forward 8 beats so that notes on screen don't change suddenly. */ /* 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 ); 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++ ) for( int al=0; al<NUM_ATTACK_LEVELS; al++ )
{ {
const Character *ch = GAMESTATE->m_pCurCharacters[pn]; const Character *ch = GAMESTATE->m_pCurCharacters[pn];
ASSERT( ch != NULL ); ASSERT( ch != nullptr );
const RString* asAttacks = ch->m_sAttacks[al]; const RString* asAttacks = ch->m_sAttacks[al];
for( int att = 0; att < NUM_ATTACKS_PER_LEVEL; ++att ) for( int att = 0; att < NUM_ATTACKS_PER_LEVEL; ++att )
attacks.insert( asAttacks[att] ); attacks.insert( asAttacks[att] );
+1 -1
View File
@@ -24,7 +24,7 @@ public:
/** /**
* @brief Determine if this actor is presently loaded. * @brief Determine if this actor is presently loaded.
* @return true if it is loaded, or false otherwise. */ * @return true if it is loaded, or false otherwise. */
bool IsLoaded() const { return m_pActor != NULL; } bool IsLoaded() const { return m_pActor != nullptr; }
void Load( Actor *pActor ); // transfer pointer void Load( Actor *pActor ); // transfer pointer
void Load( const RString &sPath ); void Load( const RString &sPath );
void LoadB( const RString &sMetricsGroup, const RString &sElement ); // load a background and set up LuaThreadVariables for recursive loading void LoadB( const RString &sMetricsGroup, const RString &sElement ); // load a background and set up LuaThreadVariables for recursive loading
+3 -3
View File
@@ -278,14 +278,14 @@ void AutoKeysounds::FinishLoading()
delete pChain; delete pChain;
} }
} }
ASSERT_M( m_pSharedSound != NULL, ssprintf("No keysounds were loaded for the song %s!", pSong->m_sMainTitle.c_str() )); ASSERT_M( m_pSharedSound != nullptr, 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_PitchChange( m_pSharedSound );
m_pSharedSound = new RageSoundReader_PostBuffering( m_pSharedSound ); m_pSharedSound = new RageSoundReader_PostBuffering( m_pSharedSound );
m_pSharedSound = new RageSoundReader_Pan( m_pSharedSound ); m_pSharedSound = new RageSoundReader_Pan( m_pSharedSound );
apSounds.push_back( m_pSharedSound ); apSounds.push_back( m_pSharedSound );
if( m_pPlayerSounds[0] != NULL ) if( m_pPlayerSounds[0] != nullptr )
{ {
m_pPlayerSounds[0] = new RageSoundReader_PitchChange( m_pPlayerSounds[0] ); m_pPlayerSounds[0] = new RageSoundReader_PitchChange( m_pPlayerSounds[0] );
m_pPlayerSounds[0] = new RageSoundReader_PostBuffering( m_pPlayerSounds[0] ); m_pPlayerSounds[0] = new RageSoundReader_PostBuffering( m_pPlayerSounds[0] );
@@ -293,7 +293,7 @@ void AutoKeysounds::FinishLoading()
apSounds.push_back( m_pPlayerSounds[0] ); apSounds.push_back( m_pPlayerSounds[0] );
} }
if( m_pPlayerSounds[1] != NULL ) if( m_pPlayerSounds[1] != nullptr )
{ {
m_pPlayerSounds[1] = new RageSoundReader_PitchChange( m_pPlayerSounds[1] ); m_pPlayerSounds[1] = new RageSoundReader_PitchChange( m_pPlayerSounds[1] );
m_pPlayerSounds[1] = new RageSoundReader_PostBuffering( m_pPlayerSounds[1] ); m_pPlayerSounds[1] = new RageSoundReader_PostBuffering( m_pPlayerSounds[1] );
+1 -1
View File
@@ -49,7 +49,7 @@ void BGAnimation::AddLayersFromAniDir( const RString &_sAniDir, const XNode *pNo
for (RString const &sLayer : vsLayerNames) for (RString const &sLayer : vsLayerNames)
{ {
const XNode* pKey = pNode->GetChild( sLayer ); const XNode* pKey = pNode->GetChild( sLayer );
ASSERT( pKey != NULL ); ASSERT( pKey != nullptr );
RString sImportDir; RString sImportDir;
if( pKey->GetAttrValue("Import", sImportDir) ) if( pKey->GetAttrValue("Import", sImportDir) )
+5 -5
View File
@@ -179,7 +179,7 @@ void BPMDisplay::NoBPM()
void BPMDisplay::SetBpmFromSong( const Song* pSong ) void BPMDisplay::SetBpmFromSong( const Song* pSong )
{ {
ASSERT( pSong != NULL ); ASSERT( pSong != nullptr );
switch( pSong->m_DisplayBPMType ) switch( pSong->m_DisplayBPMType )
{ {
case DISPLAY_BPM_ACTUAL: case DISPLAY_BPM_ACTUAL:
@@ -201,7 +201,7 @@ void BPMDisplay::SetBpmFromSong( const Song* pSong )
void BPMDisplay::SetBpmFromSteps( const Steps* pSteps ) void BPMDisplay::SetBpmFromSteps( const Steps* pSteps )
{ {
ASSERT( pSteps != NULL ); ASSERT( pSteps != nullptr );
DisplayBpms bpms; DisplayBpms bpms;
float fMinBPM, fMaxBPM; float fMinBPM, fMaxBPM;
pSteps->GetTimingData()->GetActualBPM( fMinBPM, fMaxBPM ); pSteps->GetTimingData()->GetActualBPM( fMinBPM, fMaxBPM );
@@ -212,13 +212,13 @@ void BPMDisplay::SetBpmFromSteps( const Steps* pSteps )
void BPMDisplay::SetBpmFromCourse( const Course* pCourse ) void BPMDisplay::SetBpmFromCourse( const Course* pCourse )
{ {
ASSERT( pCourse != NULL ); ASSERT( pCourse != nullptr );
ASSERT( GAMESTATE->GetCurrentStyle() != NULL ); ASSERT( GAMESTATE->GetCurrentStyle() != nullptr );
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
Trail *pTrail = pCourse->GetTrail( st ); Trail *pTrail = pCourse->GetTrail( st );
// GetTranslitFullTitle because "Crashinfo.txt is garbled because of the ANSI output as usual." -f // GetTranslitFullTitle because "Crashinfo.txt is garbled because of the ANSI output as usual." -f
ASSERT_M( pTrail != NULL, ssprintf("Course '%s' has no trail for StepsType '%s'", pCourse->GetTranslitFullTitle().c_str(), StringConversion::ToString(st).c_str() ) ); ASSERT_M( pTrail != nullptr, ssprintf("Course '%s' has no trail for StepsType '%s'", pCourse->GetTranslitFullTitle().c_str(), StringConversion::ToString(st).c_str() ) );
m_fCycleTime = (float)COURSE_CYCLE_SPEED; 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 ); Actor *pActor = ActorUtil::MakeActor( sEffectFile );
ASSERT( pActor != NULL ); ASSERT( pActor != nullptr );
m_BGAnimations[bd] = pActor; m_BGAnimations[bd] = pActor;
for( unsigned i=0; i<vsResolvedRef.size(); i++ ) for( unsigned i=0; i<vsResolvedRef.size(); i++ )
+3 -3
View File
@@ -203,7 +203,7 @@ struct BannerTexture: public RageTexture
void Create() void Create()
{ {
ASSERT( m_pImage != NULL ); ASSERT( m_pImage != nullptr );
/* The image is preprocessed; do as little work as possible. */ /* The image is preprocessed; do as little work as possible. */
@@ -239,7 +239,7 @@ struct BannerTexture: public RageTexture
ASSERT( DISPLAY->SupportsTextureFormat(pf) ); ASSERT( DISPLAY->SupportsTextureFormat(pf) );
ASSERT(m_pImage != NULL); ASSERT(m_pImage != nullptr);
m_uTexHandle = DISPLAY->CreateTexture( pf, m_pImage, false ); m_uTexHandle = DISPLAY->CreateTexture( pf, m_pImage, false );
CreateFrameRects(); CreateFrameRects();
@@ -290,7 +290,7 @@ RageTextureID BannerCache::LoadCachedBanner( RString sBannerPath )
* when converting; this way, the conversion will end up in the map so we * when converting; this way, the conversion will end up in the map so we
* only have to convert once. */ * only have to convert once. */
RageSurface *&pImage = g_BannerPathToImage[sBannerPath]; RageSurface *&pImage = g_BannerPathToImage[sBannerPath];
ASSERT( pImage != NULL ); ASSERT( pImage != nullptr );
int iSourceWidth = 0, iSourceHeight = 0; int iSourceWidth = 0, iSourceHeight = 0;
BannerData.GetValue( sBannerPath, "Width", iSourceWidth ); BannerData.GetValue( sBannerPath, "Width", iSourceWidth );
+2 -2
View File
@@ -149,7 +149,7 @@ bool BeginnerHelper::Init( int iDancePadType )
// Load character data // Load character data
const Character *Character = GAMESTATE->m_pCurCharacters[pl]; const Character *Character = GAMESTATE->m_pCurCharacters[pl];
ASSERT( Character != NULL ); ASSERT( Character != nullptr );
m_pDancer[pl]->SetName( ssprintf("PlayerP%d",pl+1) ); m_pDancer[pl]->SetName( ssprintf("PlayerP%d",pl+1) );
@@ -204,7 +204,7 @@ void BeginnerHelper::AddPlayer( PlayerNumber pn, const NoteData &ns )
return; return;
const Character *Character = GAMESTATE->m_pCurCharacters[pn]; const Character *Character = GAMESTATE->m_pCurCharacters[pn];
ASSERT( Character != NULL ); ASSERT( Character != nullptr );
if( !DoesFileExist(Character->GetModelPath()) ) if( !DoesFileExist(Character->GetModelPath()) )
return; return;
+4 -4
View File
@@ -95,7 +95,7 @@ BitmapText & BitmapText::operator=(const BitmapText &cpy)
if( m_pFont ) if( m_pFont )
FONT->UnloadFont( m_pFont ); FONT->UnloadFont( m_pFont );
if( cpy.m_pFont != NULL ) if( cpy.m_pFont != nullptr )
m_pFont = FONT->CopyFont( cpy.m_pFont ); m_pFont = FONT->CopyFont( cpy.m_pFont );
else else
m_pFont = NULL; m_pFont = NULL;
@@ -363,7 +363,7 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
* in sAlternateText, too, just use sText. */ * in sAlternateText, too, just use sText. */
void BitmapText::SetText( const RString& _sText, const RString& _sAlternateText, int iWrapWidthPixels ) void BitmapText::SetText( const RString& _sText, const RString& _sAlternateText, int iWrapWidthPixels )
{ {
ASSERT( m_pFont != NULL ); ASSERT( m_pFont != nullptr );
RString sNewText = StringWillUseAlternate(_sText,_sAlternateText) ? _sAlternateText : _sText; RString sNewText = StringWillUseAlternate(_sText,_sAlternateText) ? _sAlternateText : _sText;
@@ -505,7 +505,7 @@ void BitmapText::UpdateBaseZoom()
bool BitmapText::StringWillUseAlternate( const RString& sText, const RString& sAlternateText ) const bool BitmapText::StringWillUseAlternate( const RString& sText, const RString& sAlternateText ) const
{ {
ASSERT( m_pFont != NULL ); ASSERT( m_pFont != nullptr );
// Can't use the alternate if there isn't one. // Can't use the alternate if there isn't one.
if( !sAlternateText.size() ) if( !sAlternateText.size() )
@@ -711,7 +711,7 @@ void BitmapText::SetHorizAlign( float f )
void BitmapText::SetWrapWidthPixels( int iWrapWidthPixels ) void BitmapText::SetWrapWidthPixels( int iWrapWidthPixels )
{ {
ASSERT( m_pFont != NULL ); // always load a font first ASSERT( m_pFont != nullptr ); // always load a font first
if( m_iWrapWidthPixels == iWrapWidthPixels ) if( m_iWrapWidthPixels == iWrapWidthPixels )
return; return;
m_iWrapWidthPixels = iWrapWidthPixels; m_iWrapWidthPixels = iWrapWidthPixels;
+2 -2
View File
@@ -127,7 +127,7 @@ public:
static int GetCharacter( T* p, lua_State *L ) static int GetCharacter( T* p, lua_State *L )
{ {
Character *pCharacter = p->GetCharacterFromID(SArg(1)); Character *pCharacter = p->GetCharacterFromID(SArg(1));
if( pCharacter != NULL ) if( pCharacter != nullptr )
pCharacter->PushSelf( L ); pCharacter->PushSelf( L );
else else
lua_pushnil( L ); lua_pushnil( L );
@@ -137,7 +137,7 @@ public:
static int GetRandomCharacter( T* p, lua_State *L ) static int GetRandomCharacter( T* p, lua_State *L )
{ {
Character *pCharacter = p->GetRandomCharacter(); Character *pCharacter = p->GetRandomCharacter();
if( pCharacter != NULL ) if( pCharacter != nullptr )
pCharacter->PushSelf( L ); pCharacter->PushSelf( L );
else else
lua_pushnil( L ); lua_pushnil( L );
+3 -3
View File
@@ -690,7 +690,7 @@ int Course::GetMeter( StepsType st, CourseDifficulty cd ) const
if( m_iCustomMeter[cd] != -1 ) if( m_iCustomMeter[cd] != -1 )
return m_iCustomMeter[cd]; return m_iCustomMeter[cd];
const Trail* pTrail = GetTrail( st ); const Trail* pTrail = GetTrail( st );
if( pTrail != NULL ) if( pTrail != nullptr )
return pTrail->GetMeter(); return pTrail->GetMeter();
return 0; return 0;
} }
@@ -893,7 +893,7 @@ void Course::UpdateCourseStats( StepsType st )
for(unsigned i = 0; i < m_vEntries.size(); i++) for(unsigned i = 0; i < m_vEntries.size(); i++)
{ {
Song *pSong = m_vEntries[i].songID.ToSong(); Song *pSong = m_vEntries[i].songID.ToSong();
if( pSong != NULL ) if( pSong != nullptr )
continue; continue;
if ( m_SortOrder_Ranking == 2 ) if ( m_SortOrder_Ranking == 2 )
@@ -904,7 +904,7 @@ void Course::UpdateCourseStats( StepsType st )
const Trail* pTrail = GetTrail( st, Difficulty_Medium ); const Trail* pTrail = GetTrail( st, Difficulty_Medium );
m_SortOrder_TotalDifficulty += pTrail != NULL? pTrail->GetTotalMeter():0; m_SortOrder_TotalDifficulty += pTrail != nullptr? pTrail->GetTotalMeter():0;
// OPTIMIZATION: Ranking info isn't dependent on style, so call it // OPTIMIZATION: Ranking info isn't dependent on style, so call it
// sparingly. It's handled on startup and when themes change. // sparingly. It's handled on startup and when themes change.
+3 -3
View File
@@ -195,7 +195,7 @@ void CourseUtil::SortCoursePointerArrayByNumPlays( vector<Course*> &vpCoursesInO
void CourseUtil::SortCoursePointerArrayByNumPlays( vector<Course*> &vpCoursesInOut, const Profile* pProfile, bool bDescending ) void CourseUtil::SortCoursePointerArrayByNumPlays( vector<Course*> &vpCoursesInOut, const Profile* pProfile, bool bDescending )
{ {
ASSERT( pProfile != NULL ); ASSERT( pProfile != nullptr );
for(unsigned i = 0; i < vpCoursesInOut.size(); ++i) for(unsigned i = 0; i < vpCoursesInOut.size(); ++i)
course_sort_val[vpCoursesInOut[i]] = ssprintf( "%09i", pProfile->GetCourseNumTimesPlayed(vpCoursesInOut[i]) ); course_sort_val[vpCoursesInOut[i]] = ssprintf( "%09i", pProfile->GetCourseNumTimesPlayed(vpCoursesInOut[i]) );
stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), bDescending ? CompareCoursePointersBySortValueDescending : CompareCoursePointersBySortValueAscending ); stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), bDescending ? CompareCoursePointersBySortValueDescending : CompareCoursePointersBySortValueAscending );
@@ -422,7 +422,7 @@ bool EditCourseUtil::ValidateEditCourseName( const RString &sAnswer, RString &sE
} }
static const RString sInvalidChars = "\\/:*?\"<>|"; static const RString sInvalidChars = "\\/:*?\"<>|";
if( strpbrk(sAnswer, sInvalidChars) != NULL ) if( strpbrk(sAnswer, sInvalidChars) != nullptr )
{ {
sErrorOut = ssprintf( EDIT_NAME_CANNOT_CONTAIN.GetValue(), sInvalidChars.c_str() ); sErrorOut = ssprintf( EDIT_NAME_CANNOT_CONTAIN.GetValue(), sInvalidChars.c_str() );
return false; return false;
@@ -448,7 +448,7 @@ bool EditCourseUtil::ValidateEditCourseName( const RString &sAnswer, RString &sE
void EditCourseUtil::UpdateAndSetTrail() void EditCourseUtil::UpdateAndSetTrail()
{ {
ASSERT( GAMESTATE->m_pCurStyle != NULL ); ASSERT( GAMESTATE->m_pCurStyle != nullptr );
StepsType st = GAMESTATE->m_pCurStyle->m_StepsType; StepsType st = GAMESTATE->m_pCurStyle->m_StepsType;
Trail *pTrail = NULL; Trail *pTrail = NULL;
if( GAMESTATE->m_pCurCourse ) if( GAMESTATE->m_pCurCourse )
+1 -1
View File
@@ -631,7 +631,7 @@ unsigned TZip::swrite(void *param,const char *buf, unsigned size)
unsigned int TZip::write(const char *buf,unsigned int size) unsigned int TZip::write(const char *buf,unsigned int size)
{ {
const char *srcbuf=buf; const char *srcbuf=buf;
if (pfout != NULL) if (pfout != nullptr)
{ {
unsigned long writ = pfout->Write( srcbuf, size ); unsigned long writ = pfout->Write( srcbuf, size );
return writ; return writ;
+1 -1
View File
@@ -166,7 +166,7 @@ void DancingCharacters::LoadNextSong()
m_fThisCameraStartBeat = 0; m_fThisCameraStartBeat = 0;
m_fThisCameraEndBeat = 0; m_fThisCameraEndBeat = 0;
ASSERT( GAMESTATE->m_pCurSong != NULL ); ASSERT( GAMESTATE->m_pCurSong != nullptr );
m_fThisCameraEndBeat = GAMESTATE->m_pCurSong->GetFirstBeat(); m_fThisCameraEndBeat = GAMESTATE->m_pCurSong->GetFirstBeat();
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
+1 -1
View File
@@ -493,7 +493,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
if( dc != Difficulty_Edit ) if( dc != Difficulty_Edit )
{ {
Steps *pSteps = SongUtil::GetStepsByDifficulty( GetSelectedSong(), GetSelectedSourceStepsType(), dc ); Steps *pSteps = SongUtil::GetStepsByDifficulty( GetSelectedSong(), GetSelectedSourceStepsType(), dc );
if( pSteps != NULL ) if( pSteps != nullptr )
m_vpSourceSteps.push_back( StepsAndDifficulty(pSteps,dc) ); m_vpSourceSteps.push_back( StepsAndDifficulty(pSteps,dc) );
} }
else else
+5 -5
View File
@@ -26,7 +26,7 @@ void FontPage::Load( const FontPageSettings &cfg )
ID1.AdditionalTextureHints = cfg.m_sTextureHints; ID1.AdditionalTextureHints = cfg.m_sTextureHints;
m_FontPageTextures.m_pTextureMain = TEXTUREMAN->LoadTexture( ID1 ); m_FontPageTextures.m_pTextureMain = TEXTUREMAN->LoadTexture( ID1 );
ASSERT( m_FontPageTextures.m_pTextureMain != NULL ); ASSERT( m_FontPageTextures.m_pTextureMain != nullptr );
RageTextureID ID2 = ID1; RageTextureID ID2 = ID1;
// "arial 20 16x16 [main].png" => "arial 20 16x16 [main-stroke].png" // "arial 20 16x16 [main].png" => "arial 20 16x16 [main-stroke].png"
@@ -36,7 +36,7 @@ void FontPage::Load( const FontPageSettings &cfg )
if( IsAFile(ID2.filename) ) if( IsAFile(ID2.filename) )
{ {
m_FontPageTextures.m_pTextureStroke = TEXTUREMAN->LoadTexture( ID2 ); m_FontPageTextures.m_pTextureStroke = TEXTUREMAN->LoadTexture( ID2 );
ASSERT( m_FontPageTextures.m_pTextureStroke != NULL ); ASSERT( m_FontPageTextures.m_pTextureStroke != nullptr );
ASSERT_M( m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth() == m_FontPageTextures.m_pTextureStroke->GetSourceFrameWidth(), ssprintf("'%s' and '%s' must have the same frame widths", ID1.filename.c_str(), ID2.filename.c_str()) ); ASSERT_M( m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth() == m_FontPageTextures.m_pTextureStroke->GetSourceFrameWidth(), ssprintf("'%s' and '%s' must have the same frame widths", ID1.filename.c_str(), ID2.filename.c_str()) );
ASSERT_M( m_FontPageTextures.m_pTextureMain->GetNumFrames() == m_FontPageTextures.m_pTextureStroke->GetNumFrames(), ssprintf("'%s' and '%s' must have the same frame dimensions", ID1.filename.c_str(), ID2.filename.c_str()) ); ASSERT_M( m_FontPageTextures.m_pTextureMain->GetNumFrames() == m_FontPageTextures.m_pTextureStroke->GetNumFrames(), ssprintf("'%s' and '%s' must have the same frame dimensions", ID1.filename.c_str(), ID2.filename.c_str()) );
} }
@@ -187,12 +187,12 @@ void FontPage::SetExtraPixels( int iDrawExtraPixelsLeft, int iDrawExtraPixelsRig
FontPage::~FontPage() FontPage::~FontPage()
{ {
if( m_FontPageTextures.m_pTextureMain != NULL ) if( m_FontPageTextures.m_pTextureMain != nullptr )
{ {
TEXTUREMAN->UnloadTexture( m_FontPageTextures.m_pTextureMain ); TEXTUREMAN->UnloadTexture( m_FontPageTextures.m_pTextureMain );
m_FontPageTextures.m_pTextureMain = NULL; m_FontPageTextures.m_pTextureMain = NULL;
} }
if( m_FontPageTextures.m_pTextureStroke != NULL ) if( m_FontPageTextures.m_pTextureStroke != nullptr )
{ {
TEXTUREMAN->UnloadTexture( m_FontPageTextures.m_pTextureStroke ); TEXTUREMAN->UnloadTexture( m_FontPageTextures.m_pTextureStroke );
m_FontPageTextures.m_pTextureStroke = NULL; m_FontPageTextures.m_pTextureStroke = NULL;
@@ -346,7 +346,7 @@ void Font::CapsOnly()
void Font::SetDefaultGlyph( FontPage *pPage ) void Font::SetDefaultGlyph( FontPage *pPage )
{ {
ASSERT( pPage != NULL ); ASSERT( pPage != nullptr );
ASSERT( !pPage->m_aGlyphs.empty() ); ASSERT( !pPage->m_aGlyphs.empty() );
m_pDefault = pPage; m_pDefault = pPage;
} }
+11 -11
View File
@@ -258,7 +258,7 @@ void GameCommand::LoadOne( const Command& cmd )
// This must be processed after "song" and "style" commands. // This must be processed after "song" and "style" commands.
if( !m_bInvalid ) if( !m_bInvalid )
{ {
Song *pSong = (m_pSong != NULL)? m_pSong:GAMESTATE->m_pCurSong; Song *pSong = (m_pSong != nullptr)? m_pSong:GAMESTATE->m_pCurSong;
const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->GetCurrentStyle(); const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->GetCurrentStyle();
if( pSong == NULL || pStyle == NULL ) if( pSong == NULL || pStyle == NULL )
RageException::Throw( "Must set Song and Style to set Steps." ); RageException::Throw( "Must set Song and Style to set Steps." );
@@ -293,7 +293,7 @@ void GameCommand::LoadOne( const Command& cmd )
// This must be processed after "course" and "style" commands. // This must be processed after "course" and "style" commands.
if( !m_bInvalid ) if( !m_bInvalid )
{ {
Course *pCourse = (m_pCourse != NULL)? m_pCourse:GAMESTATE->m_pCurCourse; Course *pCourse = (m_pCourse != nullptr)? m_pCourse:GAMESTATE->m_pCurCourse;
const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->GetCurrentStyle(); const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->GetCurrentStyle();
if( pCourse == NULL || pStyle == NULL ) if( pCourse == NULL || pStyle == NULL )
RageException::Throw( "Must set Course and Style to set Steps." ); RageException::Throw( "Must set Course and Style to set Steps." );
@@ -464,10 +464,10 @@ bool GameCommand::IsPlayable( RString *why ) const
/* Don't allow a PlayMode that's incompatible with our current Style (if set), /* Don't allow a PlayMode that's incompatible with our current Style (if set),
* and vice versa. */ * and vice versa. */
if( m_pm != PlayMode_Invalid || m_pStyle != NULL ) if( m_pm != PlayMode_Invalid || m_pStyle != nullptr )
{ {
const PlayMode pm = (m_pm != PlayMode_Invalid) ? m_pm : GAMESTATE->m_PlayMode; const PlayMode pm = (m_pm != PlayMode_Invalid) ? m_pm : GAMESTATE->m_PlayMode;
const Style *style = (m_pStyle != NULL)? m_pStyle: GAMESTATE->GetCurrentStyle(); const Style *style = (m_pStyle != nullptr)? m_pStyle: GAMESTATE->GetCurrentStyle();
if( !AreStyleAndPlayModeCompatible( style, pm ) ) if( !AreStyleAndPlayModeCompatible( style, pm ) )
{ {
if( why ) if( why )
@@ -572,7 +572,7 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
if( m_pm != PlayMode_Invalid ) if( m_pm != PlayMode_Invalid )
GAMESTATE->m_PlayMode.Set( m_pm ); GAMESTATE->m_PlayMode.Set( m_pm );
if( m_pStyle != NULL ) if( m_pStyle != nullptr )
{ {
GAMESTATE->SetCurrentStyle( m_pStyle ); GAMESTATE->SetCurrentStyle( m_pStyle );
@@ -718,16 +718,16 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
bool GameCommand::IsZero() const bool GameCommand::IsZero() const
{ {
if( m_pm != PlayMode_Invalid || if( m_pm != PlayMode_Invalid ||
m_pStyle != NULL || m_pStyle != nullptr ||
m_dc != Difficulty_Invalid || m_dc != Difficulty_Invalid ||
m_sAnnouncer != "" || m_sAnnouncer != "" ||
m_sPreferredModifiers != "" || m_sPreferredModifiers != "" ||
m_sStageModifiers != "" || m_sStageModifiers != "" ||
m_pSong != NULL || m_pSong != nullptr ||
m_pSteps != NULL || m_pSteps != nullptr ||
m_pCourse != NULL || m_pCourse != nullptr ||
m_pTrail != NULL || m_pTrail != nullptr ||
m_pCharacter != NULL || m_pCharacter != nullptr ||
m_CourseDifficulty != Difficulty_Invalid || m_CourseDifficulty != Difficulty_Invalid ||
!m_sSongGroup.empty() || !m_sSongGroup.empty() ||
m_SortOrder != SortOrder_Invalid || m_SortOrder != SortOrder_Invalid ||
+1 -1
View File
@@ -281,7 +281,7 @@ void ConcurrentRenderer::Stop()
void ConcurrentRenderer::RenderThread() void ConcurrentRenderer::RenderThread()
{ {
ASSERT( SCREENMAN != NULL ); ASSERT( SCREENMAN != nullptr );
while( !m_bShutdown ) while( !m_bShutdown )
{ {
+1 -1
View File
@@ -410,7 +410,7 @@ int MusicThread_start( void *p )
GameSoundManager::GameSoundManager() GameSoundManager::GameSoundManager()
{ {
/* Init RageSoundMan first: */ /* Init RageSoundMan first: */
ASSERT( SOUNDMAN != NULL ); ASSERT( SOUNDMAN != nullptr );
g_Mutex = new RageEvent("GameSoundManager"); g_Mutex = new RageEvent("GameSoundManager");
g_Playing = new MusicPlaying( new RageSound ); g_Playing = new MusicPlaying( new RageSound );
+10 -10
View File
@@ -275,7 +275,7 @@ void GameState::Reset()
FOREACH_PlayerNumber( pn ) FOREACH_PlayerNumber( pn )
UnjoinPlayer( pn ); UnjoinPlayer( pn );
ASSERT( THEME != NULL ); ASSERT( THEME != nullptr );
m_timeGameStarted.SetZero(); m_timeGameStarted.SetZero();
SetCurrentStyle( NULL ); SetCurrentStyle( NULL );
@@ -335,7 +335,7 @@ void GameState::Reset()
m_pCurCharacters[p] = CHARMAN->GetRandomCharacter(); m_pCurCharacters[p] = CHARMAN->GetRandomCharacter();
else else
m_pCurCharacters[p] = CHARMAN->GetDefaultCharacter(); m_pCurCharacters[p] = CHARMAN->GetDefaultCharacter();
ASSERT( m_pCurCharacters[p] != NULL ); ASSERT( m_pCurCharacters[p] != nullptr );
} }
m_bTemporaryEventMode = false; m_bTemporaryEventMode = false;
@@ -375,7 +375,7 @@ void GameState::JoinPlayer( PlayerNumber pn )
} }
// Set the current style to something appropriate for the new number of joined players. // Set the current style to something appropriate for the new number of joined players.
if( ALLOW_LATE_JOIN && m_pCurStyle != NULL ) if( ALLOW_LATE_JOIN && m_pCurStyle != nullptr )
{ {
const Style *pStyle; const Style *pStyle;
// Only use one player for StyleType_OnePlayerTwoSides and StepsTypes // Only use one player for StyleType_OnePlayerTwoSides and StepsTypes
@@ -592,7 +592,7 @@ int GameState::GetNumStagesMultiplierForSong( const Song* pSong )
{ {
int iNumStages = 1; int iNumStages = 1;
ASSERT( pSong != NULL ); ASSERT( pSong != nullptr );
if( pSong->IsMarathon() ) if( pSong->IsMarathon() )
iNumStages *= 3; iNumStages *= 3;
if( pSong->IsLong() ) if( pSong->IsLong() )
@@ -1115,7 +1115,7 @@ int GameState::GetNumSidesJoined() const
const Game* GameState::GetCurrentGame() const Game* GameState::GetCurrentGame()
{ {
ASSERT( m_pCurGame != NULL ); // the game must be set before calling this ASSERT( m_pCurGame != nullptr ); // the game must be set before calling this
return m_pCurGame; return m_pCurGame;
} }
@@ -1424,7 +1424,7 @@ void GameState::GetAllUsedNoteSkins( vector<RString> &out ) const
if( IsCourseMode() ) if( IsCourseMode() )
{ {
const Trail *pTrail = m_pCurTrail[pn]; const Trail *pTrail = m_pCurTrail[pn];
ASSERT( pTrail != NULL ); ASSERT( pTrail != nullptr );
for (TrailEntry const &e : pTrail->m_vEntries) for (TrailEntry const &e : pTrail->m_vEntries)
{ {
@@ -1555,11 +1555,11 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
SongAndSteps sas; SongAndSteps sas;
ASSERT( !STATSMAN->m_vPlayedStageStats[i].m_vpPlayedSongs.empty() ); ASSERT( !STATSMAN->m_vPlayedStageStats[i].m_vpPlayedSongs.empty() );
sas.pSong = STATSMAN->m_vPlayedStageStats[i].m_vpPlayedSongs[0]; sas.pSong = STATSMAN->m_vPlayedStageStats[i].m_vpPlayedSongs[0];
ASSERT( sas.pSong != NULL ); ASSERT( sas.pSong != nullptr );
if( STATSMAN->m_vPlayedStageStats[i].m_player[pn].m_vpPossibleSteps.empty() ) if( STATSMAN->m_vPlayedStageStats[i].m_player[pn].m_vpPossibleSteps.empty() )
continue; continue;
sas.pSteps = STATSMAN->m_vPlayedStageStats[i].m_player[pn].m_vpPossibleSteps[0]; sas.pSteps = STATSMAN->m_vPlayedStageStats[i].m_player[pn].m_vpPossibleSteps[0];
ASSERT( sas.pSteps != NULL ); ASSERT( sas.pSteps != nullptr );
vSongAndSteps.push_back( sas ); vSongAndSteps.push_back( sas );
} }
CHECKPOINT; CHECKPOINT;
@@ -1697,9 +1697,9 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
{ {
CHECKPOINT; CHECKPOINT;
Course* pCourse = m_pCurCourse; Course* pCourse = m_pCurCourse;
ASSERT( pCourse != NULL ); ASSERT( pCourse != nullptr );
Trail *pTrail = m_pCurTrail[pn]; Trail *pTrail = m_pCurTrail[pn];
ASSERT( pTrail != NULL ); ASSERT( pTrail != nullptr );
CourseDifficulty cd = pTrail->m_CourseDifficulty; CourseDifficulty cd = pTrail->m_CourseDifficulty;
// Find Machine Records // Find Machine Records
+1 -1
View File
@@ -165,7 +165,7 @@ bool IniFile::DeleteKey(const RString &keyname)
bool IniFile::RenameKey(const RString &from, const RString &to) bool IniFile::RenameKey(const RString &from, const RString &to)
{ {
// If to already exists, do nothing. // If to already exists, do nothing.
if( GetChild(to) != NULL ) if( GetChild(to) != nullptr )
return false; return false;
XNode* pNode = GetChild( from ); XNode* pNode = GetChild( from );
+1 -1
View File
@@ -347,7 +347,7 @@ bool InputFilter::IsBeingPressed( const DeviceInput &di, const DeviceInputList *
if( pButtonState == NULL ) if( pButtonState == NULL )
pButtonState = &g_CurrentState; pButtonState = &g_CurrentState;
const DeviceInput *pDI = FindItemBinarySearch( pButtonState->begin(), pButtonState->end(), di ); const DeviceInput *pDI = FindItemBinarySearch( pButtonState->begin(), pButtonState->end(), di );
return pDI != NULL && pDI->bDown; return pDI != nullptr && pDI->bDown;
} }
float InputFilter::GetSecsHeld( const DeviceInput &di, const DeviceInputList *pButtonState ) const float InputFilter::GetSecsHeld( const DeviceInput &di, const DeviceInputList *pButtonState ) const
+1 -1
View File
@@ -1111,7 +1111,7 @@ void InputMappings::WriteMappings( const InputScheme *pInputScheme, RString sFil
ini.DeleteKey( pInputScheme->m_szName ); ini.DeleteKey( pInputScheme->m_szName );
XNode *pKey = ini.GetChild( pInputScheme->m_szName ); XNode *pKey = ini.GetChild( pInputScheme->m_szName );
if( pKey != NULL ) if( pKey != nullptr )
ini.RemoveChild( pKey ); ini.RemoveChild( pKey );
pKey = ini.AppendChild( pInputScheme->m_szName ); pKey = ini.AppendChild( pInputScheme->m_szName );
+1 -1
View File
@@ -38,7 +38,7 @@ bool InputQueue::WasPressedRecently( GameController c, const GameButton button,
if( iep.GameI.button != button ) if( iep.GameI.button != button )
continue; continue;
if( pIEP != NULL ) if( pIEP != nullptr )
*pIEP = iep; *pIEP = iep;
return true; return true;
+1 -1
View File
@@ -96,7 +96,7 @@ void LifeMeterTime::OnLoadSong()
return; return;
Course* pCourse = GAMESTATE->m_pCurCourse; Course* pCourse = GAMESTATE->m_pCurCourse;
ASSERT( pCourse != NULL ); ASSERT( pCourse != nullptr );
float fOldLife = m_fLifeTotalLostSeconds; float fOldLife = m_fLifeTotalLostSeconds;
float fGainSeconds = pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].fGainSeconds; float fGainSeconds = pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].fGainSeconds;
+5 -5
View File
@@ -86,12 +86,12 @@ namespace LuaHelpers
{ {
size_t iLen; size_t iLen;
const char *pStr = lua_tolstring( L, iOffset, &iLen ); const char *pStr = lua_tolstring( L, iOffset, &iLen );
if( pStr != NULL ) if( pStr != nullptr )
Object.assign( pStr, iLen ); Object.assign( pStr, iLen );
else else
Object.clear(); Object.clear();
return pStr != NULL; return pStr != nullptr;
} }
} }
@@ -174,7 +174,7 @@ static int GetLuaStack( lua_State *L )
if( !strcmp(ar.what, "C") ) if( !strcmp(ar.what, "C") )
{ {
for( int i = 1; i <= ar.nups && (name = lua_getupvalue(L, -1, i)) != NULL; ++i ) for( int i = 1; i <= ar.nups && (name = lua_getupvalue(L, -1, i)) != nullptr; ++i )
{ {
vArgs.push_back( ssprintf("%s = %s", name, lua_tostring(L, -1)) ); vArgs.push_back( ssprintf("%s = %s", name, lua_tostring(L, -1)) );
lua_pop( L, 1 ); // pop value lua_pop( L, 1 ); // pop value
@@ -182,7 +182,7 @@ static int GetLuaStack( lua_State *L )
} }
else else
{ {
for( int i = 1; (name = lua_getlocal(L, &ar, i)) != NULL; ++i ) for( int i = 1; (name = lua_getlocal(L, &ar, i)) != nullptr; ++i )
{ {
vArgs.push_back( ssprintf("%s = %s", name, lua_tostring(L, -1)) ); vArgs.push_back( ssprintf("%s = %s", name, lua_tostring(L, -1)) );
lua_pop( L, 1 ); // pop value lua_pop( L, 1 ); // pop value
@@ -243,7 +243,7 @@ LuaManager::LuaManager()
LUA = this; // so that LUA is available when we call the Register functions LUA = this; // so that LUA is available when we call the Register functions
lua_State *L = lua_open(); lua_State *L = lua_open();
ASSERT( L != NULL ); ASSERT( L != nullptr );
lua_atpanic( L, LuaPanic ); lua_atpanic( L, LuaPanic );
m_pLuaMain = L; m_pLuaMain = L;
+1 -1
View File
@@ -148,7 +148,7 @@ RString LuaReference::Serialize() const
/* The return value is a string, which we store in m_sSerializedData. */ /* The return value is a string, which we store in m_sSerializedData. */
const char *pString = lua_tostring( L, -1 ); const char *pString = lua_tostring( L, -1 );
ASSERT_M( pString != NULL, "Serialize() didn't return a string" ); ASSERT_M( pString != nullptr, "Serialize() didn't return a string" );
RString sRet = pString; RString sRet = pString;
lua_pop( L, 1 ); lua_pop( L, 1 );
+1 -1
View File
@@ -298,7 +298,7 @@ MemoryCardManager::~MemoryCardManager()
// Unregister with Lua. // Unregister with Lua.
LUA->UnsetGlobal( "MEMCARDMAN" ); LUA->UnsetGlobal( "MEMCARDMAN" );
ASSERT( g_pWorker != NULL ); ASSERT( g_pWorker != nullptr );
SAFE_DELETE(g_pWorker); SAFE_DELETE(g_pWorker);
FOREACH_PlayerNumber( pn ) FOREACH_PlayerNumber( pn )
+1 -1
View File
@@ -38,7 +38,7 @@ void MeterDisplay::LoadFromNode( const XNode* pNode )
this->AddChild( m_sprStream ); this->AddChild( m_sprStream );
const XNode* pChild = pNode->GetChild( "Tip" ); const XNode* pChild = pNode->GetChild( "Tip" );
if( pChild != NULL ) if( pChild != nullptr )
{ {
m_sprTip.LoadActorFromNode( pChild, this ); m_sprTip.LoadActorFromNode( pChild, this );
this->AddChild( m_sprTip ); this->AddChild( m_sprTip );
+2 -2
View File
@@ -620,7 +620,7 @@ void Model::SetBones( const msAnimation* pAnimation, float fFrame, vector<myBone
} }
RageVector3 vPos; RageVector3 vPos;
if( pLastPositionKey != NULL && pThisPositionKey != NULL ) if( pLastPositionKey != nullptr && pThisPositionKey != nullptr )
{ {
const float s = SCALE( fFrame, pLastPositionKey->fTime, pThisPositionKey->fTime, 0, 1 ); const float s = SCALE( fFrame, pLastPositionKey->fTime, pThisPositionKey->fTime, 0, 1 );
vPos = pLastPositionKey->Position + (pThisPositionKey->Position - pLastPositionKey->Position) * s; vPos = pLastPositionKey->Position + (pThisPositionKey->Position - pLastPositionKey->Position) * s;
@@ -644,7 +644,7 @@ void Model::SetBones( const msAnimation* pAnimation, float fFrame, vector<myBone
} }
RageVector4 vRot; RageVector4 vRot;
if( pLastRotationKey != NULL && pThisRotationKey != NULL ) if( pLastRotationKey != nullptr && pThisRotationKey != nullptr )
{ {
const float s = SCALE( fFrame, pLastRotationKey->fTime, pThisRotationKey->fTime, 0, 1 ); const float s = SCALE( fFrame, pLastRotationKey->fTime, pThisRotationKey->fTime, 0, 1 );
RageQuatSlerp( &vRot, pLastRotationKey->Rotation, pThisRotationKey->Rotation, s ); RageQuatSlerp( &vRot, pLastRotationKey->Rotation, pThisRotationKey->Rotation, s );
+6 -6
View File
@@ -151,7 +151,7 @@ void MusicWheel::BeginScreen()
const vector<MusicWheelItemData *> &from = getWheelItemsData(SORT_MODE_MENU); const vector<MusicWheelItemData *> &from = getWheelItemsData(SORT_MODE_MENU);
for( unsigned i=0; i<from.size(); i++ ) for( unsigned i=0; i<from.size(); i++ )
{ {
ASSERT( &*from[i]->m_pAction != NULL ); ASSERT( &*from[i]->m_pAction != nullptr );
if( from[i]->m_pAction->DescribesCurrentModeForAllPlayers() ) if( from[i]->m_pAction->DescribesCurrentModeForAllPlayers() )
{ {
m_sLastModeMenuItem = from[i]->m_pAction->m_sName; m_sLastModeMenuItem = from[i]->m_pAction->m_sName;
@@ -184,7 +184,7 @@ void MusicWheel::BeginScreen()
/* Invalidate current Song if it can't be played /* Invalidate current Song if it can't be played
* because there are not enough stages remaining. */ * because there are not enough stages remaining. */
if( GAMESTATE->m_pCurSong != NULL && if( GAMESTATE->m_pCurSong != nullptr &&
GameState::GetNumStagesMultiplierForSong( GAMESTATE->m_pCurSong ) > GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() ) GameState::GetNumStagesMultiplierForSong( GAMESTATE->m_pCurSong ) > GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() )
{ {
GAMESTATE->m_pCurSong.Set( NULL ); GAMESTATE->m_pCurSong.Set( NULL );
@@ -194,10 +194,10 @@ void MusicWheel::BeginScreen()
* because there are not enough stages remaining. */ * because there are not enough stages remaining. */
FOREACH_ENUM( PlayerNumber, p ) FOREACH_ENUM( PlayerNumber, p )
{ {
if( GAMESTATE->m_pCurSteps[p] != NULL ) if( GAMESTATE->m_pCurSteps[p] != nullptr )
{ {
vector<Steps*> vpPossibleSteps; vector<Steps*> vpPossibleSteps;
if( GAMESTATE->m_pCurSong != NULL ) if( GAMESTATE->m_pCurSong != nullptr )
SongUtil::GetPlayableSteps( GAMESTATE->m_pCurSong, vpPossibleSteps ); SongUtil::GetPlayableSteps( GAMESTATE->m_pCurSong, vpPossibleSteps );
bool bStepsIsPossible = find( vpPossibleSteps.begin(), vpPossibleSteps.end(), GAMESTATE->m_pCurSteps[p] ) == vpPossibleSteps.end(); bool bStepsIsPossible = find( vpPossibleSteps.begin(), vpPossibleSteps.end(), GAMESTATE->m_pCurSteps[p] ) == vpPossibleSteps.end();
if( !bStepsIsPossible ) if( !bStepsIsPossible )
@@ -849,7 +849,7 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
// init music status icons // init music status icons
for (MusicWheelItemData *WID : arrayWheelItemDatas) for (MusicWheelItemData *WID : arrayWheelItemDatas)
{ {
if( WID->m_pSong != NULL ) if( WID->m_pSong != nullptr )
{ {
WID->m_Flags.bHasBeginnerOr1Meter = WID->m_pSong->IsEasy( GAMESTATE->GetCurrentStyle()->m_StepsType ) && SHOW_EASY_FLAG; WID->m_Flags.bHasBeginnerOr1Meter = WID->m_pSong->IsEasy( GAMESTATE->GetCurrentStyle()->m_StepsType ) && SHOW_EASY_FLAG;
WID->m_Flags.bEdits = false; WID->m_Flags.bEdits = false;
@@ -859,7 +859,7 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
WID->m_Flags.bEdits |= WID->m_pSong->HasEdits( type ); WID->m_Flags.bEdits |= WID->m_pSong->HasEdits( type );
WID->m_Flags.iStagesForSong = GameState::GetNumStagesMultiplierForSong( WID->m_pSong ); WID->m_Flags.iStagesForSong = GameState::GetNumStagesMultiplierForSong( WID->m_pSong );
} }
else if( WID->m_pCourse != NULL ) else if( WID->m_pCourse != nullptr )
{ {
WID->m_Flags.bHasBeginnerOr1Meter = false; WID->m_Flags.bHasBeginnerOr1Meter = false;
WID->m_Flags.bEdits = WID->m_pCourse->IsAnEdit(); WID->m_Flags.bEdits = WID->m_pCourse->IsAnEdit();
+2 -2
View File
@@ -351,13 +351,13 @@ void MusicWheelItem::RefreshGrades()
if( pWID->m_pSong ) if( pWID->m_pSong )
{ {
const Steps* pSteps = SongUtil::GetStepsByDifficulty( pWID->m_pSong, st, dc ); const Steps* pSteps = SongUtil::GetStepsByDifficulty( pWID->m_pSong, st, dc );
if( pSteps != NULL ) if( pSteps != nullptr )
pHSL = &pProfile->GetStepsHighScoreList(pWID->m_pSong, pSteps); pHSL = &pProfile->GetStepsHighScoreList(pWID->m_pSong, pSteps);
} }
else if( pWID->m_pCourse ) else if( pWID->m_pCourse )
{ {
const Trail *pTrail = pWID->m_pCourse->GetTrail( st, dc ); const Trail *pTrail = pWID->m_pCourse->GetTrail( st, dc );
if( pTrail != NULL ) if( pTrail != nullptr )
pHSL = &pProfile->GetCourseHighScoreList( pWID->m_pCourse, pTrail ); pHSL = &pProfile->GetCourseHighScoreList( pWID->m_pCourse, pTrail );
} }
} }
+4 -4
View File
@@ -363,7 +363,7 @@ void NetworkSyncManager::StartRequest( short position )
ctr = char( position*16 ); ctr = char( position*16 );
m_packet.Write1( ctr ); m_packet.Write1( ctr );
if( GAMESTATE->m_pCurSong != NULL ) if( GAMESTATE->m_pCurSong != nullptr )
{ {
m_packet.WriteNT( GAMESTATE->m_pCurSong->m_sMainTitle ); m_packet.WriteNT( GAMESTATE->m_pCurSong->m_sMainTitle );
m_packet.WriteNT( GAMESTATE->m_pCurSong->m_sSubTitle ); m_packet.WriteNT( GAMESTATE->m_pCurSong->m_sSubTitle );
@@ -376,7 +376,7 @@ void NetworkSyncManager::StartRequest( short position )
m_packet.WriteNT( "" ); m_packet.WriteNT( "" );
} }
if( GAMESTATE->m_pCurCourse != NULL ) if( GAMESTATE->m_pCurCourse != nullptr )
m_packet.WriteNT( GAMESTATE->m_pCurCourse->GetDisplayFullTitle() ); m_packet.WriteNT( GAMESTATE->m_pCurCourse->GetDisplayFullTitle() );
else else
m_packet.WriteNT( RString() ); m_packet.WriteNT( RString() );
@@ -899,7 +899,7 @@ unsigned long NetworkSyncManager::GetCurrentSMBuild( LoadingWindow* ld )
{ {
// \r\n\r\n = Separator from HTTP Header and Body // \r\n\r\n = Separator from HTTP Header and Body
char* cBodyStart = strstr(cBuffer, "\r\n\r\n"); char* cBodyStart = strstr(cBuffer, "\r\n\r\n");
if( cBodyStart != NULL ) if( cBodyStart != nullptr )
{ {
// Get the HTTP Header only // Get the HTTP Header only
int iHeaderLength = cBodyStart - cBuffer; int iHeaderLength = cBodyStart - cBuffer;
@@ -939,7 +939,7 @@ unsigned long NetworkSyncManager::GetCurrentSMBuild( LoadingWindow* ld )
} }
} }
} // if( svResponse[0].find("200") != RString::npos ) } // if( svResponse[0].find("200") != RString::npos )
} // if( cBodyStart != NULL ) } // if( cBodyStart != nullptr )
} // if( iBytes ) } // if( iBytes )
SAFE_DELETE( cBuffer ); SAFE_DELETE( cBuffer );
} // if( socket->connect(sHost, uPort) ) } // if( socket->connect(sHost, uPort) )
+1 -1
View File
@@ -351,7 +351,7 @@ bool NoteData::IsHoldHeadOrBodyAtRow( int iTrack, int iRow, int *pHeadRow ) cons
const TapNote &tn = GetTapNote( iTrack, iRow ); const TapNote &tn = GetTapNote( iTrack, iRow );
if( tn.type == TapNote::hold_head ) if( tn.type == TapNote::hold_head )
{ {
if( pHeadRow != NULL ) if( pHeadRow != nullptr )
*pHeadRow = iRow; *pHeadRow = iRow;
return true; return true;
} }
+2 -2
View File
@@ -145,7 +145,7 @@ static NoteResource *MakeNoteResource( const RString &sButton, const RString &sE
NoteResource *pRes = new NoteResource( nsap ); NoteResource *pRes = new NoteResource( nsap );
pRes->m_pActor = NOTESKIN->LoadActor( sButton, sElement, NULL, bSpriteOnly ); pRes->m_pActor = NOTESKIN->LoadActor( sButton, sElement, NULL, bSpriteOnly );
ASSERT( pRes->m_pActor != NULL ); ASSERT( pRes->m_pActor != nullptr );
g_NoteResource[nsap] = pRes; g_NoteResource[nsap] = pRes;
it = g_NoteResource.find( nsap ); it = g_NoteResource.find( nsap );
@@ -158,7 +158,7 @@ static NoteResource *MakeNoteResource( const RString &sButton, const RString &sE
static void DeleteNoteResource( NoteResource *pRes ) static void DeleteNoteResource( NoteResource *pRes )
{ {
ASSERT( pRes != NULL ); ASSERT( pRes != nullptr );
ASSERT_M( pRes->m_iRefCount > 0, ssprintf("RefCount %i > 0", pRes->m_iRefCount) ); ASSERT_M( pRes->m_iRefCount > 0, ssprintf("RefCount %i > 0", pRes->m_iRefCount) );
--pRes->m_iRefCount; --pRes->m_iRefCount;
+5 -5
View File
@@ -175,7 +175,7 @@ void NoteField::Load(
int iDrawDistanceAfterTargetsPixels, int iDrawDistanceAfterTargetsPixels,
int iDrawDistanceBeforeTargetsPixels ) int iDrawDistanceBeforeTargetsPixels )
{ {
ASSERT( pNoteData != NULL ); ASSERT( pNoteData != nullptr );
m_pNoteData = pNoteData; m_pNoteData = pNoteData;
m_iDrawDistanceAfterTargetsPixels = iDrawDistanceAfterTargetsPixels; m_iDrawDistanceAfterTargetsPixels = iDrawDistanceAfterTargetsPixels;
m_iDrawDistanceBeforeTargetsPixels = iDrawDistanceBeforeTargetsPixels; m_iDrawDistanceBeforeTargetsPixels = iDrawDistanceBeforeTargetsPixels;
@@ -814,7 +814,7 @@ void NoteField::DrawPrimitives()
//LOG->Trace( "NoteField::DrawPrimitives()" ); //LOG->Trace( "NoteField::DrawPrimitives()" );
// This should be filled in on the first update. // This should be filled in on the first update.
ASSERT( m_pCurDisplay != NULL ); ASSERT( m_pCurDisplay != nullptr );
ArrowEffects::Update(); ArrowEffects::Update();
@@ -873,7 +873,7 @@ void NoteField::DrawPrimitives()
unsigned i = 0; unsigned i = 0;
// Draw beat bars // Draw beat bars
if( ( GAMESTATE->IsEditing() || SHOW_BEAT_BARS ) && pTiming != NULL ) if( ( GAMESTATE->IsEditing() || SHOW_BEAT_BARS ) && pTiming != nullptr )
{ {
const vector<TimingSegment *> &tSigs = *segs[SEGMENT_TIME_SIG]; const vector<TimingSegment *> &tSigs = *segs[SEGMENT_TIME_SIG];
int iMeasureIndex = 0; int iMeasureIndex = 0;
@@ -913,9 +913,9 @@ void NoteField::DrawPrimitives()
} }
} }
if( GAMESTATE->IsEditing() && pTiming != NULL ) if( GAMESTATE->IsEditing() && pTiming != nullptr )
{ {
ASSERT(GAMESTATE->m_pCurSong != NULL); ASSERT(GAMESTATE->m_pCurSong != nullptr);
const TimingData &timing = *pTiming; const TimingData &timing = *pTiming;
+4 -4
View File
@@ -329,7 +329,7 @@ int BMSSong::AllocateKeysound( RString filename, RString path )
if( !IsAFile(dir + normalizedFilename) ) if( !IsAFile(dir + normalizedFilename) )
{ {
const char *exts[] = { "oga", "ogg", "wav", "mp3", NULL }; // XXX: stop duplicating these everywhere const char *exts[] = { "oga", "ogg", "wav", "mp3", NULL }; // XXX: stop duplicating these everywhere
for( unsigned i = 0; exts[i] != NULL; ++i ) for( unsigned i = 0; exts[i] != nullptr; ++i )
{ {
RString fn = SetExtension( normalizedFilename, exts[i] ); RString fn = SetExtension( normalizedFilename, exts[i] );
if( IsAFile(dir + fn) ) if( IsAFile(dir + fn) )
@@ -394,7 +394,7 @@ bool BMSSong::GetBackground( RString filename, RString path, RString &bgfile )
if( !IsAFile(dir + normalizedFilename) ) if( !IsAFile(dir + normalizedFilename) )
{ {
const char *exts[] = { "ogv", "avi", "mpg", "mpeg", "bmp", "png", "jpeg", NULL }; // XXX: stop duplicating these everywhere const char *exts[] = { "ogv", "avi", "mpg", "mpeg", "bmp", "png", "jpeg", NULL }; // XXX: stop duplicating these everywhere
for( unsigned i = 0; exts[i] != NULL; ++i ) for( unsigned i = 0; exts[i] != nullptr; ++i )
{ {
RString fn = SetExtension( normalizedFilename, exts[i] ); RString fn = SetExtension( normalizedFilename, exts[i] );
if( IsAFile(dir + fn) ) if( IsAFile(dir + fn) )
@@ -426,14 +426,14 @@ void BMSSong::PrecacheBackgrounds(const RString &dir)
const char *exts[] = { "ogv", "avi", "mpg", "mpeg", "bmp", "png", "jpeg", NULL }; // XXX: stop duplicating these everywhere const char *exts[] = { "ogv", "avi", "mpg", "mpeg", "bmp", "png", "jpeg", NULL }; // XXX: stop duplicating these everywhere
for( unsigned i = 0; exts[i] != NULL; ++i ) for( unsigned i = 0; exts[i] != nullptr; ++i )
{ {
GetDirListing( dir + RString("*.") + RString(exts[i]), arrayPossibleFiles ); GetDirListing( dir + RString("*.") + RString(exts[i]), arrayPossibleFiles );
} }
for( unsigned i = 0; i < arrayPossibleFiles.size(); i++ ) for( unsigned i = 0; i < arrayPossibleFiles.size(); i++ )
{ {
for( unsigned j = 0; exts[j] != NULL; ++j ) for( unsigned j = 0; exts[j] != nullptr; ++j )
{ {
RString fn = SetExtension( arrayPossibleFiles[i], exts[j] ); RString fn = SetExtension( arrayPossibleFiles[i], exts[j] );
mapBackground[fn] = arrayPossibleFiles[i]; mapBackground[fn] = arrayPossibleFiles[i];
+4 -4
View File
@@ -61,7 +61,7 @@ void OptionRow::Clear()
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
m_Underline[p].clear(); m_Underline[p].clear();
if( m_pHand != NULL ) if( m_pHand != nullptr )
{ {
for (RString const &m : m_pHand->m_vsReloadRowMessages) for (RString const &m : m_pHand->m_vsReloadRowMessages)
MESSAGEMAN->Unsubscribe( this, m ); MESSAGEMAN->Unsubscribe( this, m );
@@ -197,7 +197,7 @@ RString OptionRow::GetRowTitle() const
if( GAMESTATE->m_pCurCourse ) if( GAMESTATE->m_pCurCourse )
{ {
const Trail* pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->GetMasterPlayerNumber()]; const Trail* pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->GetMasterPlayerNumber()];
ASSERT( pTrail != NULL ); ASSERT( pTrail != nullptr );
const int iNumCourseEntries = pTrail->m_vEntries.size(); const int iNumCourseEntries = pTrail->m_vEntries.size();
if( iNumCourseEntries > CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS ) if( iNumCourseEntries > CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS )
bShowBpmInSpeedTitle = false; bShowBpmInSpeedTitle = false;
@@ -216,7 +216,7 @@ RString OptionRow::GetRowTitle() const
const Course *pCourse = GAMESTATE->m_pCurCourse; const Course *pCourse = GAMESTATE->m_pCurCourse;
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
const Trail* pTrail = pCourse->GetTrail( st ); const Trail* pTrail = pCourse->GetTrail( st );
ASSERT( pTrail != NULL ); ASSERT( pTrail != nullptr );
pTrail->GetDisplayBpms( bpms ); pTrail->GetDisplayBpms( bpms );
} }
@@ -651,7 +651,7 @@ void OptionRow::SetModIcon( PlayerNumber pn, const RString &sText, GameCommand &
msg.SetParam( "GameCommand", &gc ); msg.SetParam( "GameCommand", &gc );
msg.SetParam( "Text", sText ); msg.SetParam( "Text", sText );
m_sprFrame->HandleMessage( msg ); m_sprFrame->HandleMessage( msg );
if( m_ModIcons[pn] != NULL ) if( m_ModIcons[pn] != nullptr )
m_ModIcons[pn]->Set( sText ); m_ModIcons[pn]->Set( sText );
} }
+3 -3
View File
@@ -536,7 +536,7 @@ public:
m_ppStepsToFill = &GAMESTATE->m_pEditSourceSteps; m_ppStepsToFill = &GAMESTATE->m_pEditSourceSteps;
m_pst = &GAMESTATE->m_stEditSource; m_pst = &GAMESTATE->m_stEditSource;
m_vsReloadRowMessages.push_back( MessageIDToString(Message_EditSourceStepsTypeChanged) ); m_vsReloadRowMessages.push_back( MessageIDToString(Message_EditSourceStepsTypeChanged) );
if( GAMESTATE->m_pCurSteps[0].Get() != NULL ) if( GAMESTATE->m_pCurSteps[0].Get() != nullptr )
m_Def.m_vEnabledForPlayers.clear(); // hide row m_Def.m_vEnabledForPlayers.clear(); // hide row
} }
else else
@@ -1120,7 +1120,7 @@ public:
{ {
LOG->Warn( "Invalid Conf type \"%s\"", sParam.c_str() ); LOG->Warn( "Invalid Conf type \"%s\"", sParam.c_str() );
pConfOption = ConfOption::Find( "Invalid" ); pConfOption = ConfOption::Find( "Invalid" );
ASSERT_M( pConfOption != NULL, "ConfOption::Find(Invalid)" ); ASSERT_M( pConfOption != nullptr, "ConfOption::Find(Invalid)" );
} }
pConfOption->UpdateAvailableOptions(); pConfOption->UpdateAvailableOptions();
@@ -1201,7 +1201,7 @@ public:
m_pstToFill = &GAMESTATE->m_stEditSource; m_pstToFill = &GAMESTATE->m_stEditSource;
m_vsReloadRowMessages.push_back( MessageIDToString(Message_CurrentStepsP1Changed) ); m_vsReloadRowMessages.push_back( MessageIDToString(Message_CurrentStepsP1Changed) );
m_vsReloadRowMessages.push_back( MessageIDToString(Message_EditStepsTypeChanged) ); m_vsReloadRowMessages.push_back( MessageIDToString(Message_EditStepsTypeChanged) );
if( GAMESTATE->m_pCurSteps[0].Get() != NULL ) if( GAMESTATE->m_pCurSteps[0].Get() != nullptr )
m_Def.m_vEnabledForPlayers.clear(); // hide row m_Def.m_vEnabledForPlayers.clear(); // hide row
} }
else else
+2 -2
View File
@@ -101,7 +101,7 @@ void OptionListRow::SetFromHandler( const OptionRowHandler *pHandler )
void OptionListRow::SetTextFromHandler( const OptionRowHandler *pHandler ) void OptionListRow::SetTextFromHandler( const OptionRowHandler *pHandler )
{ {
ASSERT( pHandler != NULL ); ASSERT( pHandler != nullptr );
for( unsigned i = 0; i < pHandler->m_Def.m_vsChoices.size(); ++i ) for( unsigned i = 0; i < pHandler->m_Def.m_vsChoices.size(); ++i )
{ {
// init text // init text
@@ -632,7 +632,7 @@ void OptionsList::SelectionsChanged( const RString &sRowName )
const OptionRowHandler *pHandler = m_Rows[sRowName]; const OptionRowHandler *pHandler = m_Rows[sRowName];
vector<bool> &bSelections = m_bSelections[sRowName]; vector<bool> &bSelections = m_bSelections[sRowName];
if( pHandler->m_Def.m_bOneChoiceForAllPlayers && m_pLinked != NULL ) if( pHandler->m_Def.m_bOneChoiceForAllPlayers && m_pLinked != nullptr )
{ {
vector<bool> &bLinkedSelections = m_pLinked->m_bSelections[sRowName]; vector<bool> &bLinkedSelections = m_pLinked->m_bSelections[sRowName];
bLinkedSelections = bSelections; bLinkedSelections = bSelections;
+1 -1
View File
@@ -47,7 +47,7 @@ void PercentageDisplay::LoadFromNode( const XNode* pNode )
this->AddChild( &m_textPercent ); this->AddChild( &m_textPercent );
pChild = pNode->GetChild( "PercentRemainder" ); pChild = pNode->GetChild( "PercentRemainder" );
if( !ShowDancePointsNotPercentage() && pChild != NULL ) if( !ShowDancePointsNotPercentage() && pChild != nullptr )
{ {
m_bUseRemainder = true; m_bUseRemainder = true;
m_textPercentRemainder.LoadFromNode( pChild ); m_textPercentRemainder.LoadFromNode( pChild );
+10 -10
View File
@@ -416,12 +416,12 @@ void Player::Init(
if( GAMESTATE->IsCourseMode() ) if( GAMESTATE->IsCourseMode() )
{ {
ASSERT( GAMESTATE->m_pCurTrail[pn] != NULL ); ASSERT( GAMESTATE->m_pCurTrail[pn] != nullptr );
GAMESTATE->m_pCurTrail[pn]->GetDisplayBpms( bpms ); GAMESTATE->m_pCurTrail[pn]->GetDisplayBpms( bpms );
} }
else else
{ {
ASSERT( GAMESTATE->m_pCurSong != NULL ); ASSERT( GAMESTATE->m_pCurSong != nullptr );
GAMESTATE->m_pCurSong->GetDisplayBpms( bpms ); GAMESTATE->m_pCurSong->GetDisplayBpms( bpms );
} }
@@ -891,14 +891,14 @@ void Player::Update( float fDeltaTime )
const bool bReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(0) == 1; const bool bReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(0) == 1;
float fPercentCentered = m_pPlayerState->m_PlayerOptions.GetCurrent().m_fScrolls[PlayerOptions::SCROLL_CENTERED]; float fPercentCentered = m_pPlayerState->m_PlayerOptions.GetCurrent().m_fScrolls[PlayerOptions::SCROLL_CENTERED];
if( m_pActorWithJudgmentPosition != NULL ) if( m_pActorWithJudgmentPosition != nullptr )
{ {
const Actor::TweenState &ts1 = m_tsJudgment[bReverse?1:0][0]; const Actor::TweenState &ts1 = m_tsJudgment[bReverse?1:0][0];
const Actor::TweenState &ts2 = m_tsJudgment[bReverse?1:0][1]; const Actor::TweenState &ts2 = m_tsJudgment[bReverse?1:0][1];
Actor::TweenState::MakeWeightedAverage( m_pActorWithJudgmentPosition->DestTweenState(), ts1, ts2, fPercentCentered ); Actor::TweenState::MakeWeightedAverage( m_pActorWithJudgmentPosition->DestTweenState(), ts1, ts2, fPercentCentered );
} }
if( m_pActorWithComboPosition != NULL ) if( m_pActorWithComboPosition != nullptr )
{ {
const Actor::TweenState &ts1 = m_tsCombo[bReverse?1:0][0]; const Actor::TweenState &ts1 = m_tsCombo[bReverse?1:0][0];
const Actor::TweenState &ts2 = m_tsCombo[bReverse?1:0][1]; const Actor::TweenState &ts2 = m_tsCombo[bReverse?1:0][1];
@@ -908,9 +908,9 @@ void Player::Update( float fDeltaTime )
float fNoteFieldZoom = 1 - fMiniPercent*0.5f; float fNoteFieldZoom = 1 - fMiniPercent*0.5f;
if( m_pNoteField ) if( m_pNoteField )
m_pNoteField->SetZoom( fNoteFieldZoom ); m_pNoteField->SetZoom( fNoteFieldZoom );
if( m_pActorWithJudgmentPosition != NULL ) if( m_pActorWithJudgmentPosition != nullptr )
m_pActorWithJudgmentPosition->SetZoom( m_pActorWithJudgmentPosition->GetZoom() * fJudgmentZoom ); m_pActorWithJudgmentPosition->SetZoom( m_pActorWithJudgmentPosition->GetZoom() * fJudgmentZoom );
if( m_pActorWithComboPosition != NULL ) if( m_pActorWithComboPosition != nullptr )
m_pActorWithComboPosition->SetZoom( m_pActorWithComboPosition->GetZoom() * fJudgmentZoom ); m_pActorWithComboPosition->SetZoom( m_pActorWithComboPosition->GetZoom() * fJudgmentZoom );
} }
@@ -931,7 +931,7 @@ void Player::Update( float fDeltaTime )
ASSERT_M( iNumCols <= MAX_COLS_PER_PLAYER, ssprintf("%i > %i", iNumCols, MAX_COLS_PER_PLAYER) ); ASSERT_M( iNumCols <= MAX_COLS_PER_PLAYER, ssprintf("%i > %i", iNumCols, MAX_COLS_PER_PLAYER) );
for( int col=0; col < iNumCols; ++col ) for( int col=0; col < iNumCols; ++col )
{ {
ASSERT( m_pPlayerState != NULL ); ASSERT( m_pPlayerState != nullptr );
// TODO: Remove use of PlayerNumber. // TODO: Remove use of PlayerNumber.
GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( col, m_pPlayerState->m_PlayerNumber ); GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( col, m_pPlayerState->m_PlayerNumber );
@@ -1216,7 +1216,7 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vector<TrackRowTap
if( m_pPlayerState->m_PlayerController == PC_AUTOPLAY ) if( m_pPlayerState->m_PlayerController == PC_AUTOPLAY )
{ {
STATSMAN->m_CurStageStats.m_bUsedAutoplay = true; STATSMAN->m_CurStageStats.m_bUsedAutoplay = true;
if( m_pPlayerStageStats != NULL ) if( m_pPlayerStageStats != nullptr )
m_pPlayerStageStats->m_bDisqualified = true; m_pPlayerStageStats->m_bDisqualified = true;
} }
} }
@@ -3162,9 +3162,9 @@ void Player::HandleTapRowScore( unsigned row )
m_pSecondaryScoreKeeper->HandleTapScore( tn ); m_pSecondaryScoreKeeper->HandleTapScore( tn );
} }
if( m_pPrimaryScoreKeeper != NULL ) if( m_pPrimaryScoreKeeper != nullptr )
m_pPrimaryScoreKeeper->HandleTapRowScore( m_NoteData, row ); m_pPrimaryScoreKeeper->HandleTapRowScore( m_NoteData, row );
if( m_pSecondaryScoreKeeper != NULL ) if( m_pSecondaryScoreKeeper != nullptr )
m_pSecondaryScoreKeeper->HandleTapRowScore( m_NoteData, row ); m_pSecondaryScoreKeeper->HandleTapRowScore( m_NoteData, row );
const int iCurCombo = m_pPlayerStageStats ? m_pPlayerStageStats->m_iCurCombo : 0; const int iCurCombo = m_pPlayerStageStats ? m_pPlayerStageStats->m_iCurCombo : 0;
+1 -1
View File
@@ -108,7 +108,7 @@ public:
static float GetMaxStepDistanceSeconds(); static float GetMaxStepDistanceSeconds();
static float GetWindowSeconds( TimingWindow tw ); static float GetWindowSeconds( TimingWindow tw );
const NoteData &GetNoteData() const { return m_NoteData; } const NoteData &GetNoteData() const { return m_NoteData; }
bool HasVisibleParts() const { return m_pNoteField != NULL; } bool HasVisibleParts() const { return m_pNoteField != nullptr; }
void SetActorWithJudgmentPosition( Actor *pActor ) { m_pActorWithJudgmentPosition = pActor; } void SetActorWithJudgmentPosition( Actor *pActor ) { m_pActorWithJudgmentPosition = pActor; }
void SetActorWithComboPosition( Actor *pActor ) { m_pActorWithComboPosition = pActor; } void SetActorWithComboPosition( Actor *pActor ) { m_pActorWithComboPosition = pActor; }
+3 -3
View File
@@ -282,7 +282,7 @@ void PlayerOptions::FromString( const RString &sMultipleMods )
bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut ) bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut )
{ {
ASSERT_M( NOTESKIN != NULL, "The Noteskin Manager must be loaded in order to process mods." ); ASSERT_M( NOTESKIN != nullptr, "The Noteskin Manager must be loaded in order to process mods." );
RString sBit = sOneMod; RString sBit = sOneMod;
sBit.MakeLower(); sBit.MakeLower();
@@ -764,8 +764,8 @@ bool PlayerOptions::IsEasierForSongAndSteps( Song* pSong, Steps* pSteps, PlayerN
bool PlayerOptions::IsEasierForCourseAndTrail( Course* pCourse, Trail* pTrail ) const bool PlayerOptions::IsEasierForCourseAndTrail( Course* pCourse, Trail* pTrail ) const
{ {
ASSERT( pCourse != NULL ); ASSERT( pCourse != nullptr );
ASSERT( pTrail != NULL ); ASSERT( pTrail != nullptr );
return std::any_of(pTrail->m_vEntries.begin(), pTrail->m_vEntries.end(), [&](TrailEntry const &e) { return std::any_of(pTrail->m_vEntries.begin(), pTrail->m_vEntries.end(), [&](TrailEntry const &e) {
return e.pSong && IsEasierForSongAndSteps(e.pSong, e.pSteps, PLAYER_1); return e.pSong && IsEasierForSongAndSteps(e.pSong, e.pSteps, PLAYER_1);
+1 -1
View File
@@ -40,7 +40,7 @@ void IPreference::LoadAllDefaults()
void IPreference::ReadAllPrefsFromNode( const XNode* pNode, bool bIsStatic ) void IPreference::ReadAllPrefsFromNode( const XNode* pNode, bool bIsStatic )
{ {
ASSERT( pNode != NULL ); ASSERT( pNode != nullptr );
for (IPreference *p : *m_Subscribers.m_pSubscribers) for (IPreference *p : *m_Subscribers.m_pSubscribers)
p->ReadFrom( pNode, bIsStatic ); p->ReadFrom( pNode, bIsStatic );
} }
+6 -6
View File
@@ -1367,7 +1367,7 @@ XNode* Profile::SaveSongScoresCreateNode() const
CHECKPOINT; CHECKPOINT;
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile != NULL ); ASSERT( pProfile != nullptr );
XNode* pNode = new XNode( "SongScores" ); XNode* pNode = new XNode( "SongScores" );
@@ -1448,7 +1448,7 @@ XNode* Profile::SaveCourseScoresCreateNode() const
CHECKPOINT; CHECKPOINT;
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile != NULL ); ASSERT( pProfile != nullptr );
XNode* pNode = new XNode( "CourseScores" ); XNode* pNode = new XNode( "CourseScores" );
@@ -1556,7 +1556,7 @@ XNode* Profile::SaveCategoryScoresCreateNode() const
CHECKPOINT; CHECKPOINT;
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile != NULL ); ASSERT( pProfile != nullptr );
XNode* pNode = new XNode( "CategoryScores" ); XNode* pNode = new XNode( "CategoryScores" );
@@ -1628,7 +1628,7 @@ void Profile::LoadCategoryScoresFromNode( const XNode* pCategoryScores )
void Profile::SaveStatsWebPageToDir( RString sDir ) const void Profile::SaveStatsWebPageToDir( RString sDir ) const
{ {
ASSERT( PROFILEMAN != NULL ); ASSERT( PROFILEMAN != nullptr );
} }
void Profile::SaveMachinePublicKeyToDir( RString sDir ) const void Profile::SaveMachinePublicKeyToDir( RString sDir ) const
@@ -1664,7 +1664,7 @@ XNode* Profile::SaveScreenshotDataCreateNode() const
CHECKPOINT; CHECKPOINT;
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile != NULL ); ASSERT( pProfile != nullptr );
XNode* pNode = new XNode( "ScreenshotData" ); XNode* pNode = new XNode( "ScreenshotData" );
@@ -1706,7 +1706,7 @@ XNode* Profile::SaveCalorieDataCreateNode() const
CHECKPOINT; CHECKPOINT;
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile != NULL ); ASSERT( pProfile != nullptr );
XNode* pNode = new XNode( "CalorieData" ); XNode* pNode = new XNode( "CalorieData" );
+7 -7
View File
@@ -114,12 +114,12 @@ void ProfileManager::Init()
{ {
RString sCharacterID = FIXED_PROFILE_CHARACTER_ID( i ); RString sCharacterID = FIXED_PROFILE_CHARACTER_ID( i );
Character *pCharacter = CHARMAN->GetCharacterFromID( sCharacterID ); Character *pCharacter = CHARMAN->GetCharacterFromID( sCharacterID );
ASSERT_M( pCharacter != NULL, sCharacterID ); ASSERT_M( pCharacter != nullptr, sCharacterID );
RString sProfileID; RString sProfileID;
bool b = CreateLocalProfile( pCharacter->GetDisplayName(), sProfileID ); bool b = CreateLocalProfile( pCharacter->GetDisplayName(), sProfileID );
ASSERT( b ); ASSERT( b );
Profile* pProfile = GetLocalProfile( sProfileID ); Profile* pProfile = GetLocalProfile( sProfileID );
ASSERT_M( pProfile != NULL, sProfileID ); ASSERT_M( pProfile != nullptr, sProfileID );
pProfile->m_sCharacterID = sCharacterID; pProfile->m_sCharacterID = sCharacterID;
SaveLocalProfile( sProfileID ); SaveLocalProfile( sProfileID );
} }
@@ -341,7 +341,7 @@ bool ProfileManager::SaveProfile( PlayerNumber pn ) const
bool ProfileManager::SaveLocalProfile( RString sProfileID ) bool ProfileManager::SaveLocalProfile( RString sProfileID )
{ {
const Profile *pProfile = GetLocalProfile( sProfileID ); const Profile *pProfile = GetLocalProfile( sProfileID );
ASSERT( pProfile != NULL ); ASSERT( pProfile != nullptr );
RString sDir = LocalProfileIDToDir( sProfileID ); RString sDir = LocalProfileIDToDir( sProfileID );
bool b = pProfile->SaveAllToDir( sDir, PREFSMAN->m_bSignProfileData ); bool b = pProfile->SaveAllToDir( sDir, PREFSMAN->m_bSignProfileData );
return b; return b;
@@ -473,7 +473,7 @@ bool ProfileManager::RenameLocalProfile( RString sProfileID, RString sNewName )
ASSERT( !sProfileID.empty() ); ASSERT( !sProfileID.empty() );
Profile *pProfile = ProfileManager::GetLocalProfile( sProfileID ); Profile *pProfile = ProfileManager::GetLocalProfile( sProfileID );
ASSERT( pProfile != NULL ); ASSERT( pProfile != nullptr );
pProfile->m_sDisplayName = sNewName; pProfile->m_sDisplayName = sNewName;
RString sProfileDir = LocalProfileIDToDir( sProfileID ); RString sProfileDir = LocalProfileIDToDir( sProfileID );
@@ -483,7 +483,7 @@ bool ProfileManager::RenameLocalProfile( RString sProfileID, RString sNewName )
bool ProfileManager::DeleteLocalProfile( RString sProfileID ) bool ProfileManager::DeleteLocalProfile( RString sProfileID )
{ {
Profile *pProfile = ProfileManager::GetLocalProfile( sProfileID ); Profile *pProfile = ProfileManager::GetLocalProfile( sProfileID );
ASSERT( pProfile != NULL ); ASSERT( pProfile != nullptr );
RString sProfileDir = LocalProfileIDToDir( sProfileID ); RString sProfileDir = LocalProfileIDToDir( sProfileID );
// flush directory cache in an attempt to get this working // flush directory cache in an attempt to get this working
@@ -821,7 +821,7 @@ class LunaProfileManager: public Luna<ProfileManager>
{ {
public: public:
static int IsPersistentProfile( T* p, lua_State *L ) { lua_pushboolean(L, p->IsPersistentProfile(Enum::Check<PlayerNumber>(L, 1)) ); return 1; } 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 != NULL); 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 != nullptr); pP->PushSelf(L); return 1; }
static int GetMachineProfile( T* p, lua_State *L ) { p->GetMachineProfile()->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 * ) { p->SaveMachineProfile(); return 0; } static int SaveMachineProfile( T* p, lua_State * ) { p->SaveMachineProfile(); return 0; }
static int GetLocalProfile( T* p, lua_State *L ) static int GetLocalProfile( T* p, lua_State *L )
@@ -833,7 +833,7 @@ public:
lua_pushnil(L); lua_pushnil(L);
return 1; 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 GetLocalProfileFromIndex( T* p, lua_State *L ) { Profile *pProfile = p->GetLocalProfileFromIndex(IArg(1)); ASSERT(pProfile != nullptr); pProfile->PushSelf(L); return 1; }
static int GetLocalProfileIDFromIndex( T* p, lua_State *L ) { lua_pushstring(L, p->GetLocalProfileIDFromIndex(IArg(1)) ); 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 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; } static int GetNumLocalProfiles( T* p, lua_State *L ) { lua_pushnumber(L, p->GetNumLocalProfiles() ); return 1; }
+1 -1
View File
@@ -73,7 +73,7 @@ void RageBitmapTexture::Create()
RString sWarning = ssprintf( "RageBitmapTexture: Couldn't load %s: %s", actualID.filename.c_str(), error.c_str() ); RString sWarning = ssprintf( "RageBitmapTexture: Couldn't load %s: %s", actualID.filename.c_str(), error.c_str() );
Dialog::OK( sWarning ); Dialog::OK( sWarning );
pImg = RageSurfaceUtils::MakeDummySurface( 64, 64 ); pImg = RageSurfaceUtils::MakeDummySurface( 64, 64 );
ASSERT( pImg != NULL ); ASSERT( pImg != nullptr );
} }
if( actualID.bHotPinkColorKey ) if( actualID.bHotPinkColorKey )
+3 -3
View File
@@ -653,7 +653,7 @@ RageSurface* RageDisplay_D3D::CreateScreenshot()
} }
RageSurface *surface = CreateSurfaceFromPixfmt( RagePixelFormat_RGBA8, lr.pBits, desc.Width, desc.Height, lr.Pitch); RageSurface *surface = CreateSurfaceFromPixfmt( RagePixelFormat_RGBA8, lr.pBits, desc.Width, desc.Height, lr.Pitch);
ASSERT( surface != NULL ); ASSERT( surface != nullptr );
// We need to make a copy, since lr.pBits will go away when we call UnlockRect(). // We need to make a copy, since lr.pBits will go away when we call UnlockRect().
result = result =
@@ -1383,7 +1383,7 @@ void RageDisplay_D3D::UpdateTexture(
int xoffset, int yoffset, int width, int height ) int xoffset, int yoffset, int width, int height )
{ {
IDirect3DTexture9* pTex = (IDirect3DTexture9*)uTexHandle; IDirect3DTexture9* pTex = (IDirect3DTexture9*)uTexHandle;
ASSERT( pTex != NULL ); ASSERT( pTex != nullptr );
RECT rect; RECT rect;
rect.left = xoffset; rect.left = xoffset;
@@ -1406,7 +1406,7 @@ void RageDisplay_D3D::UpdateTexture(
ASSERT( texpixfmt != NUM_RagePixelFormat ); ASSERT( texpixfmt != NUM_RagePixelFormat );
RageSurface *Texture = CreateSurfaceFromPixfmt(RagePixelFormat(texpixfmt), lr.pBits, width, height, lr.Pitch); RageSurface *Texture = CreateSurfaceFromPixfmt(RagePixelFormat(texpixfmt), lr.pBits, width, height, lr.Pitch);
ASSERT( Texture != NULL ); ASSERT( Texture != nullptr );
RageSurfaceUtils::Blit( img, Texture, width, height ); RageSurfaceUtils::Blit( img, Texture, width, height );
delete Texture; delete Texture;
+1 -1
View File
@@ -735,7 +735,7 @@ void RageDisplay_Legacy::SetBlendMode( BlendMode mode )
{ {
glEnable(GL_BLEND); glEnable(GL_BLEND);
if (glBlendEquation != NULL) if (glBlendEquation != nullptr)
{ {
if (mode == BLEND_INVERT_DEST) if (mode == BLEND_INVERT_DEST)
glBlendEquation( GL_FUNC_SUBTRACT ); glBlendEquation( GL_FUNC_SUBTRACT );
+3 -3
View File
@@ -1359,7 +1359,7 @@ void RageCompiledGeometryHWOGL::Draw( int iMeshIndex ) const
#define BUFFER_OFFSET(o) ((char*)(o)) #define BUFFER_OFFSET(o) ((char*)(o))
ASSERT( glDrawRangeElements != NULL ); ASSERT( glDrawRangeElements != nullptr );
glDrawRangeElements( glDrawRangeElements(
GL_TRIANGLES, GL_TRIANGLES,
meshInfo.iVertexStart, // minimum array index contained in indices meshInfo.iVertexStart, // minimum array index contained in indices
@@ -1735,7 +1735,7 @@ void RageDisplay_Legacy::SetBlendMode( BlendMode mode )
{ {
glEnable(GL_BLEND); glEnable(GL_BLEND);
if (glBlendEquation != NULL) if (glBlendEquation != nullptr)
{ {
if (mode == BLEND_INVERT_DEST) if (mode == BLEND_INVERT_DEST)
glBlendEquation( GL_FUNC_SUBTRACT ); glBlendEquation( GL_FUNC_SUBTRACT );
@@ -2487,7 +2487,7 @@ void RageDisplay_Legacy::SetRenderTarget( unsigned iTexture, bool bPreserveTextu
} }
/* If we already had a render target, disable it. */ /* If we already had a render target, disable it. */
if (g_pCurrentRenderTarget != NULL) if (g_pCurrentRenderTarget != nullptr)
SetRenderTarget(0, true); SetRenderTarget(0, true);
/* Enable the new render target. */ /* Enable the new render target. */
+1 -1
View File
@@ -55,7 +55,7 @@ void RageException::Throw( const char *sFmt, ... )
ASSERT_M( g_HandlerThreadID == RageThread::GetInvalidThreadID() || g_HandlerThreadID == RageThread::GetCurrentThreadID(), ASSERT_M( g_HandlerThreadID == RageThread::GetInvalidThreadID() || g_HandlerThreadID == RageThread::GetCurrentThreadID(),
ssprintf("RageException::Throw() on another thread: %s", error.c_str()) ); ssprintf("RageException::Throw() on another thread: %s", error.c_str()) );
if( g_CleanupHandler != NULL ) if( g_CleanupHandler != nullptr )
g_CleanupHandler( error ); g_CleanupHandler( error );
exit(1); exit(1);
+4 -4
View File
@@ -44,7 +44,7 @@ RString RageFile::GetPath() const
bool RageFile::Open( const RString& path, int mode ) bool RageFile::Open( const RString& path, int mode )
{ {
ASSERT( FILEMAN != NULL ); ASSERT( FILEMAN != nullptr );
Close(); Close();
m_Path = path; m_Path = path;
@@ -122,14 +122,14 @@ bool RageFile::AtEOF() const
void RageFile::ClearError() void RageFile::ClearError()
{ {
if( m_File != NULL ) if( m_File != nullptr )
m_File->ClearError(); m_File->ClearError();
m_sError = ""; m_sError = "";
} }
RString RageFile::GetError() const RString RageFile::GetError() const
{ {
if( m_File != NULL && m_File->GetError() != "" ) if( m_File != nullptr && m_File->GetError() != "" )
return m_File->GetError(); return m_File->GetError();
return m_sError; return m_sError;
} }
@@ -137,7 +137,7 @@ RString RageFile::GetError() const
void RageFile::SetError( const RString &err ) void RageFile::SetError( const RString &err )
{ {
if( m_File != NULL ) if( m_File != nullptr )
m_File->ClearError(); m_File->ClearError();
m_sError = err; m_sError = err;
} }
+1 -1
View File
@@ -45,7 +45,7 @@ public:
bool Open( const RString& path, int mode = READ ); bool Open( const RString& path, int mode = READ );
void Close(); void Close();
bool IsOpen() const { return m_File != NULL; } bool IsOpen() const { return m_File != nullptr; }
bool AtEOF() const; bool AtEOF() const;
RString GetError() const; RString GetError() const;
+5 -5
View File
@@ -25,7 +25,7 @@ RageFileObj::RageFileObj( const RageFileObj &cpy ):
RageFileBasic(cpy) RageFileBasic(cpy)
{ {
/* If the original file has a buffer, copy it. */ /* If the original file has a buffer, copy it. */
if( cpy.m_pReadBuffer != NULL ) if( cpy.m_pReadBuffer != nullptr )
{ {
m_pReadBuffer = new char[BSIZE]; m_pReadBuffer = new char[BSIZE];
memcpy( m_pReadBuffer, cpy.m_pReadBuffer, BSIZE ); memcpy( m_pReadBuffer, cpy.m_pReadBuffer, BSIZE );
@@ -38,7 +38,7 @@ RageFileObj::RageFileObj( const RageFileObj &cpy ):
m_pReadBuffer = NULL; m_pReadBuffer = NULL;
} }
if( cpy.m_pWriteBuffer != NULL ) if( cpy.m_pWriteBuffer != nullptr )
{ {
m_pWriteBuffer = new char[cpy.m_iWriteBufferSize]; m_pWriteBuffer = new char[cpy.m_iWriteBufferSize];
memcpy( m_pWriteBuffer, cpy.m_pWriteBuffer, m_iWriteBufferUsed ); memcpy( m_pWriteBuffer, cpy.m_pWriteBuffer, m_iWriteBufferUsed );
@@ -105,7 +105,7 @@ int RageFileObj::Read( void *pBuffer, size_t iBytes )
while( !m_bEOF && iBytes > 0 ) while( !m_bEOF && iBytes > 0 )
{ {
if( m_pReadBuffer != NULL && m_iReadBufAvail ) if( m_pReadBuffer != nullptr && m_iReadBufAvail )
{ {
/* Copy data out of the buffer first. */ /* Copy data out of the buffer first. */
int iFromBuffer = min( (int) iBytes, m_iReadBufAvail ); int iFromBuffer = min( (int) iBytes, m_iReadBufAvail );
@@ -230,7 +230,7 @@ int RageFileObj::EmptyWriteBuf()
int RageFileObj::Write( const void *pBuffer, size_t iBytes ) int RageFileObj::Write( const void *pBuffer, size_t iBytes )
{ {
if( m_pWriteBuffer != NULL ) if( m_pWriteBuffer != nullptr )
{ {
/* If the file position has moved away from the write buffer, or the /* If the file position has moved away from the write buffer, or the
* incoming data won't fit in the buffer, flush. */ * incoming data won't fit in the buffer, flush. */
@@ -429,7 +429,7 @@ int RageFileObj::PutLine( const RString &sStr )
int RageFileObj::FillReadBuf() int RageFileObj::FillReadBuf()
{ {
/* Don't call this unless buffering is enabled. */ /* Don't call this unless buffering is enabled. */
ASSERT( m_pReadBuffer != NULL ); ASSERT( m_pReadBuffer != nullptr );
/* The buffer starts at m_Buffer; any data in it starts at m_pReadBuf; space between /* The buffer starts at m_Buffer; any data in it starts at m_pReadBuf; space between
* the two is old data that we've read. (Don't mangle that data; we can use it * the two is old data that we've read. (Don't mangle that data; we can use it
+2 -2
View File
@@ -400,7 +400,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
uint32_t iExpectedCRC32 = FileReading::read_u32_le( *pFile, sError ); uint32_t iExpectedCRC32 = FileReading::read_u32_le( *pFile, sError );
uint32_t iUncompressedSize = FileReading::read_u32_le( *pFile, sError ); uint32_t iUncompressedSize = FileReading::read_u32_le( *pFile, sError );
if( iCRC32 != NULL ) if( iCRC32 != nullptr )
*iCRC32 = iExpectedCRC32; *iCRC32 = iExpectedCRC32;
FileReading::Seek( *pFile, iDataPos, sError ); FileReading::Seek( *pFile, iDataPos, sError );
@@ -414,7 +414,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
pInflateFile->DeleteFileWhenFinished(); pInflateFile->DeleteFileWhenFinished();
/* Enable CRC calculation only if the caller is interested. */ /* Enable CRC calculation only if the caller is interested. */
if( iCRC32 != NULL ) if( iCRC32 != nullptr )
pInflateFile->EnableCRC32(); pInflateFile->EnableCRC32();
return pInflateFile; return pInflateFile;
+23 -23
View File
@@ -177,7 +177,7 @@ ThreadedFileWorker::~ThreadedFileWorker()
{ {
StopThread(); StopThread();
if( m_pChildDriver != NULL ) if( m_pChildDriver != nullptr )
FILEMAN->ReleaseFileDriver( m_pChildDriver ); FILEMAN->ReleaseFileDriver( m_pChildDriver );
/* Unregister ourself. */ /* Unregister ourself. */
@@ -216,7 +216,7 @@ void ThreadedFileWorker::HandleRequest( int iRequest )
break; break;
case REQ_CLOSE: case REQ_CLOSE:
ASSERT( m_pRequestFile != NULL ); ASSERT( m_pRequestFile != nullptr );
delete m_pRequestFile; delete m_pRequestFile;
/* Clear m_pRequestFile, so RequestTimedOut doesn't double-delete. */ /* Clear m_pRequestFile, so RequestTimedOut doesn't double-delete. */
@@ -224,38 +224,38 @@ void ThreadedFileWorker::HandleRequest( int iRequest )
break; break;
case REQ_GET_FILE_SIZE: case REQ_GET_FILE_SIZE:
ASSERT( m_pRequestFile != NULL ); ASSERT( m_pRequestFile != nullptr );
m_iResultRequest = m_pRequestFile->GetFileSize(); m_iResultRequest = m_pRequestFile->GetFileSize();
break; break;
case REQ_SEEK: case REQ_SEEK:
ASSERT( m_pRequestFile != NULL ); ASSERT( m_pRequestFile != nullptr );
m_iResultRequest = m_pRequestFile->Seek( m_iRequestPos ); m_iResultRequest = m_pRequestFile->Seek( m_iRequestPos );
m_sResultError = m_pRequestFile->GetError(); m_sResultError = m_pRequestFile->GetError();
break; break;
case REQ_READ: case REQ_READ:
ASSERT( m_pRequestFile != NULL ); ASSERT( m_pRequestFile != nullptr );
ASSERT( m_pResultBuffer != NULL ); ASSERT( m_pResultBuffer != nullptr );
m_iResultRequest = m_pRequestFile->Read( m_pResultBuffer, m_iRequestSize ); m_iResultRequest = m_pRequestFile->Read( m_pResultBuffer, m_iRequestSize );
m_sResultError = m_pRequestFile->GetError(); m_sResultError = m_pRequestFile->GetError();
break; break;
case REQ_WRITE: case REQ_WRITE:
ASSERT( m_pRequestFile != NULL ); ASSERT( m_pRequestFile != nullptr );
ASSERT( m_pRequestBuffer != NULL ); ASSERT( m_pRequestBuffer != nullptr );
m_iResultRequest = m_pRequestFile->Write( m_pRequestBuffer, m_iRequestSize ); m_iResultRequest = m_pRequestFile->Write( m_pRequestBuffer, m_iRequestSize );
m_sResultError = m_pRequestFile->GetError(); m_sResultError = m_pRequestFile->GetError();
break; break;
case REQ_FLUSH: case REQ_FLUSH:
ASSERT( m_pRequestFile != NULL ); ASSERT( m_pRequestFile != nullptr );
m_iResultRequest = m_pRequestFile->Flush(); m_iResultRequest = m_pRequestFile->Flush();
m_sResultError = m_pRequestFile->GetError(); m_sResultError = m_pRequestFile->GetError();
break; break;
case REQ_COPY: case REQ_COPY:
ASSERT( m_pRequestFile != NULL ); ASSERT( m_pRequestFile != nullptr );
m_pResultFile = m_pRequestFile->Copy(); m_pResultFile = m_pRequestFile->Copy();
break; break;
@@ -328,7 +328,7 @@ RageFileBasic *ThreadedFileWorker::Open( const RString &sPath, int iMode, int &i
void ThreadedFileWorker::Close( RageFileBasic *pFile ) void ThreadedFileWorker::Close( RageFileBasic *pFile )
{ {
ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
if( pFile == NULL ) if( pFile == NULL )
return; return;
@@ -353,7 +353,7 @@ void ThreadedFileWorker::Close( RageFileBasic *pFile )
int ThreadedFileWorker::GetFileSize( RageFileBasic *&pFile ) int ThreadedFileWorker::GetFileSize( RageFileBasic *&pFile )
{ {
ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
/* If we're currently in a timed-out state, fail. */ /* If we're currently in a timed-out state, fail. */
if( IsTimedOut() ) if( IsTimedOut() )
@@ -381,7 +381,7 @@ int ThreadedFileWorker::GetFileSize( RageFileBasic *&pFile )
int ThreadedFileWorker::GetFD( RageFileBasic *&pFile ) int ThreadedFileWorker::GetFD( RageFileBasic *&pFile )
{ {
ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
/* If we're currently in a timed-out state, fail. */ /* If we're currently in a timed-out state, fail. */
if( IsTimedOut() ) if( IsTimedOut() )
@@ -409,7 +409,7 @@ int ThreadedFileWorker::GetFD( RageFileBasic *&pFile )
int ThreadedFileWorker::Seek( RageFileBasic *&pFile, int iPos, RString &sError ) int ThreadedFileWorker::Seek( RageFileBasic *&pFile, int iPos, RString &sError )
{ {
ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
/* If we're currently in a timed-out state, fail. */ /* If we're currently in a timed-out state, fail. */
if( IsTimedOut() ) if( IsTimedOut() )
@@ -444,7 +444,7 @@ int ThreadedFileWorker::Seek( RageFileBasic *&pFile, int iPos, RString &sError )
int ThreadedFileWorker::Read( RageFileBasic *&pFile, void *pBuf, int iSize, RString &sError ) int ThreadedFileWorker::Read( RageFileBasic *&pFile, void *pBuf, int iSize, RString &sError )
{ {
ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
/* If we're currently in a timed-out state, fail. */ /* If we're currently in a timed-out state, fail. */
if( IsTimedOut() ) if( IsTimedOut() )
@@ -486,7 +486,7 @@ int ThreadedFileWorker::Read( RageFileBasic *&pFile, void *pBuf, int iSize, RStr
int ThreadedFileWorker::Write( RageFileBasic *&pFile, const void *pBuf, int iSize, RString &sError ) int ThreadedFileWorker::Write( RageFileBasic *&pFile, const void *pBuf, int iSize, RString &sError )
{ {
ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
/* If we're currently in a timed-out state, fail. */ /* If we're currently in a timed-out state, fail. */
if( IsTimedOut() ) if( IsTimedOut() )
@@ -527,7 +527,7 @@ int ThreadedFileWorker::Write( RageFileBasic *&pFile, const void *pBuf, int iSiz
int ThreadedFileWorker::Flush( RageFileBasic *&pFile, RString &sError ) int ThreadedFileWorker::Flush( RageFileBasic *&pFile, RString &sError )
{ {
ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
/* If we're currently in a timed-out state, fail. */ /* If we're currently in a timed-out state, fail. */
if( IsTimedOut() ) if( IsTimedOut() )
@@ -562,7 +562,7 @@ int ThreadedFileWorker::Flush( RageFileBasic *&pFile, RString &sError )
RageFileBasic *ThreadedFileWorker::Copy( RageFileBasic *&pFile, RString &sError ) RageFileBasic *ThreadedFileWorker::Copy( RageFileBasic *&pFile, RString &sError )
{ {
ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
/* If we're currently in a timed-out state, fail. */ /* If we're currently in a timed-out state, fail. */
if( IsTimedOut() ) if( IsTimedOut() )
@@ -619,7 +619,7 @@ bool ThreadedFileWorker::PopulateFileSet( FileSet &fs, const RString &sPath )
int ThreadedFileWorker::Move( const RString &sOldPath, const RString &sNewPath ) int ThreadedFileWorker::Move( const RString &sOldPath, const RString &sNewPath )
{ {
ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
/* If we're currently in a timed-out state, fail. */ /* If we're currently in a timed-out state, fail. */
if( IsTimedOut() ) if( IsTimedOut() )
@@ -639,7 +639,7 @@ int ThreadedFileWorker::Move( const RString &sOldPath, const RString &sNewPath )
int ThreadedFileWorker::Remove( const RString &sPath ) int ThreadedFileWorker::Remove( const RString &sPath )
{ {
ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
/* If we're currently in a timed-out state, fail. */ /* If we're currently in a timed-out state, fail. */
if( IsTimedOut() ) if( IsTimedOut() )
@@ -710,7 +710,7 @@ public:
~RageFileObjTimeout() ~RageFileObjTimeout()
{ {
if( m_pFile != NULL ) if( m_pFile != nullptr )
{ {
Flush(); Flush();
m_pWorker->Close( m_pFile ); m_pWorker->Close( m_pFile );
@@ -853,13 +853,13 @@ public:
void SetWorker( ThreadedFileWorker *pWorker ) void SetWorker( ThreadedFileWorker *pWorker )
{ {
ASSERT( pWorker != NULL ); ASSERT( pWorker != nullptr );
m_pWorker = pWorker; m_pWorker = pWorker;
} }
void PopulateFileSet( FileSet &fs, const RString &sPath ) void PopulateFileSet( FileSet &fs, const RString &sPath )
{ {
ASSERT( m_pWorker != NULL ); ASSERT( m_pWorker != nullptr );
m_pWorker->PopulateFileSet( fs, sPath ); m_pWorker->PopulateFileSet( fs, sPath );
} }
+1 -1
View File
@@ -92,7 +92,7 @@ RageFileDriver *RageFileManager::GetFileDriver( RString sMountpoint )
void RageFileManager::ReleaseFileDriver( RageFileDriver *pDriver ) void RageFileManager::ReleaseFileDriver( RageFileDriver *pDriver )
{ {
ASSERT( pDriver != NULL ); ASSERT( pDriver != nullptr );
g_Mutex->Lock(); g_Mutex->Lock();
unsigned i; unsigned i;
+5 -5
View File
@@ -101,7 +101,7 @@ void RageInput::WindowReset()
void RageInput::AddHandler( InputHandler *pHandler ) void RageInput::AddHandler( InputHandler *pHandler )
{ {
ASSERT( pHandler != NULL ); ASSERT( pHandler != nullptr );
LoadedInputHandler hand; LoadedInputHandler hand;
hand.m_pDevice = pHandler; hand.m_pDevice = pHandler;
@@ -125,7 +125,7 @@ InputHandler *RageInput::GetHandlerForDevice( const InputDevice id )
RString RageInput::GetDeviceSpecificInputString( const DeviceInput &di ) RString RageInput::GetDeviceSpecificInputString( const DeviceInput &di )
{ {
InputHandler *pDriver = GetHandlerForDevice( di.device ); InputHandler *pDriver = GetHandlerForDevice( di.device );
if( pDriver != NULL ) if( pDriver != nullptr )
return pDriver->GetDeviceSpecificInputString(di); return pDriver->GetDeviceSpecificInputString(di);
else else
return di.ToString(); return di.ToString();
@@ -134,7 +134,7 @@ RString RageInput::GetDeviceSpecificInputString( const DeviceInput &di )
RString RageInput::GetLocalizedInputString( const DeviceInput &di ) RString RageInput::GetLocalizedInputString( const DeviceInput &di )
{ {
InputHandler *pDriver = GetHandlerForDevice( di.device ); InputHandler *pDriver = GetHandlerForDevice( di.device );
if( pDriver != NULL ) if( pDriver != nullptr )
return pDriver->GetLocalizedInputString(di); return pDriver->GetLocalizedInputString(di);
else else
return Capitalize( DeviceButtonToString(di.button) ); return Capitalize( DeviceButtonToString(di.button) );
@@ -143,7 +143,7 @@ RString RageInput::GetLocalizedInputString( const DeviceInput &di )
wchar_t RageInput::DeviceInputToChar( DeviceInput di, bool bUseCurrentKeyModifiers ) wchar_t RageInput::DeviceInputToChar( DeviceInput di, bool bUseCurrentKeyModifiers )
{ {
InputHandler *pDriver = GetHandlerForDevice( di.device ); InputHandler *pDriver = GetHandlerForDevice( di.device );
if( pDriver != NULL ) if( pDriver != nullptr )
return pDriver->DeviceButtonToChar(di.button, bUseCurrentKeyModifiers); return pDriver->DeviceButtonToChar(di.button, bUseCurrentKeyModifiers);
else else
return '\0'; return '\0';
@@ -152,7 +152,7 @@ wchar_t RageInput::DeviceInputToChar( DeviceInput di, bool bUseCurrentKeyModifie
InputDeviceState RageInput::GetInputDeviceState( InputDevice id ) InputDeviceState RageInput::GetInputDeviceState( InputDevice id )
{ {
InputHandler *pDriver = GetHandlerForDevice( id ); InputHandler *pDriver = GetHandlerForDevice( id );
if( pDriver != NULL ) if( pDriver != nullptr )
return pDriver->GetInputDeviceState(id); return pDriver->GetInputDeviceState(id);
else else
return InputDeviceState_NoInputHandler; return InputDeviceState_NoInputHandler;
+4 -4
View File
@@ -53,7 +53,7 @@ RageSound::RageSound():
m_iStoppedSourceFrame(0), m_bPlaying(false), m_iStoppedSourceFrame(0), m_bPlaying(false),
m_bDeleteWhenFinished(false), m_sError("") m_bDeleteWhenFinished(false), m_sError("")
{ {
ASSERT( SOUNDMAN != NULL ); ASSERT( SOUNDMAN != nullptr );
} }
RageSound::~RageSound() RageSound::~RageSound()
@@ -65,7 +65,7 @@ RageSound::RageSound( const RageSound &cpy ):
RageSoundBase( cpy ), RageSoundBase( cpy ),
m_Mutex( "RageSound" ) m_Mutex( "RageSound" )
{ {
ASSERT(SOUNDMAN != NULL); ASSERT(SOUNDMAN != nullptr);
m_pSource = NULL; m_pSource = NULL;
@@ -130,7 +130,7 @@ void RageSound::DeleteSelfWhenFinishedPlaying()
bool RageSound::IsLoaded() const bool RageSound::IsLoaded() const
{ {
return m_pSource != NULL; return m_pSource != nullptr;
} }
class RageSoundReader_Silence: public RageSoundReader class RageSoundReader_Silence: public RageSoundReader
@@ -266,7 +266,7 @@ int RageSound::GetDataToPlay( float *pBuffer, int iFrames, int64_t &iStreamFrame
// LockMut(m_Mutex); // LockMut(m_Mutex);
ASSERT_M( m_bPlaying, ssprintf("%p", this) ); ASSERT_M( m_bPlaying, ssprintf("%p", this) );
ASSERT( m_pSource != NULL ); ASSERT( m_pSource != nullptr );
iFramesStored = 0; iFramesStored = 0;
iStreamFrame = m_iStreamFrame; iStreamFrame = m_iStreamFrame;
+3 -3
View File
@@ -69,13 +69,13 @@ void RageSoundManager::Shutdown()
void RageSoundManager::StartMixing( RageSoundBase *pSound ) void RageSoundManager::StartMixing( RageSoundBase *pSound )
{ {
if( m_pDriver != NULL ) if( m_pDriver != nullptr )
m_pDriver->StartMixing( pSound ); m_pDriver->StartMixing( pSound );
} }
void RageSoundManager::StopMixing( RageSoundBase *pSound ) void RageSoundManager::StopMixing( RageSoundBase *pSound )
{ {
if( m_pDriver != NULL ) if( m_pDriver != nullptr )
m_pDriver->StopMixing( pSound ); m_pDriver->StopMixing( pSound );
} }
@@ -118,7 +118,7 @@ void RageSoundManager::Update()
g_SoundManMutex.Unlock(); /* finished with m_mapPreloadedSounds */ g_SoundManMutex.Unlock(); /* finished with m_mapPreloadedSounds */
if( m_pDriver != NULL ) if( m_pDriver != nullptr )
m_pDriver->Update(); m_pDriver->Update();
} }
+1 -1
View File
@@ -15,7 +15,7 @@
RageSoundReader_Extend::RageSoundReader_Extend( RageSoundReader *pSource ): RageSoundReader_Extend::RageSoundReader_Extend( RageSoundReader *pSource ):
RageSoundReader_Filter( pSource ) RageSoundReader_Filter( pSource )
{ {
ASSERT_M(pSource != NULL, "The music file was not found! Was it deleted or moved while the game was on?"); ASSERT_M(pSource != nullptr, "The music file was not found! Was it deleted or moved while the game was on?");
m_iPositionFrames = pSource->GetNextSourceFrame(); m_iPositionFrames = pSource->GetNextSourceFrame();
m_StopMode = M_STOP; m_StopMode = M_STOP;
+2 -2
View File
@@ -270,7 +270,7 @@ static int get_this_frame_byte( const madlib_t *mad )
int ret = mad->inbuf_filepos; int ret = mad->inbuf_filepos;
/* If we have a frame, adjust. */ /* If we have a frame, adjust. */
if( mad->Stream.this_frame != NULL ) if( mad->Stream.this_frame != nullptr )
ret += mad->Stream.this_frame-mad->inbuf; ret += mad->Stream.this_frame-mad->inbuf;
return ret; return ret;
@@ -331,7 +331,7 @@ int RageSoundReader_MP3::fill_buffer()
{ {
/* Need more data. */ /* Need more data. */
int inbytes = 0; int inbytes = 0;
if( mad->Stream.next_frame != NULL ) if( mad->Stream.next_frame != nullptr )
{ {
/* Pull out remaining data from the last buffer. */ /* Pull out remaining data from the last buffer. */
inbytes = mad->Stream.bufend-mad->Stream.next_frame; inbytes = mad->Stream.bufend-mad->Stream.next_frame;
+1 -1
View File
@@ -47,7 +47,7 @@ int RageSoundReader_Preload::GetTotalFrames() const
bool RageSoundReader_Preload::Open( RageSoundReader *pSource ) bool RageSoundReader_Preload::Open( RageSoundReader *pSource )
{ {
ASSERT( pSource != NULL ); ASSERT( pSource != nullptr );
m_iSampleRate = pSource->GetSampleRate(); m_iSampleRate = pSource->GetSampleRate();
m_iChannels = pSource->GetNumChannels(); m_iChannels = pSource->GetNumChannels();
m_fRate = pSource->GetStreamToSourceRatio(); m_fRate = pSource->GetStreamToSourceRatio();
+1 -1
View File
@@ -667,7 +667,7 @@ int RageSoundReader_Resample_Good::Read( float *pBuf, int iFrames )
{ {
int iFramesNeeded = m_apResamplers[0]->NumInputsForOutputSamples(iFrames); int iFramesNeeded = m_apResamplers[0]->NumInputsForOutputSamples(iFrames);
float *pTmpBuf = (float *) alloca( iFramesNeeded * sizeof(float) * iChannels ); float *pTmpBuf = (float *) alloca( iFramesNeeded * sizeof(float) * iChannels );
ASSERT( pTmpBuf != NULL ); ASSERT( pTmpBuf != nullptr );
int iFramesIn = m_pSource->Read( pTmpBuf, iFramesNeeded ); int iFramesIn = m_pSource->Read( pTmpBuf, iFramesNeeded );
if( iFramesIn < 0 ) if( iFramesIn < 0 )
return iFramesIn; return iFramesIn;
+4 -4
View File
@@ -191,7 +191,7 @@ int RageSoundReader_Vorbisfile::Read( float *buf, int iFrames )
{ {
vorbis_info *vi = ov_info( vf, -1 ); vorbis_info *vi = ov_info( vf, -1 );
ASSERT( vi != NULL ); ASSERT( vi != nullptr );
if( (unsigned) vi->channels != channels ) if( (unsigned) vi->channels != channels )
RageException::Throw( "File \"%s\" changes channel count from %i to %i; not supported.", RageException::Throw( "File \"%s\" changes channel count from %i to %i; not supported.",
@@ -261,17 +261,17 @@ int RageSoundReader_Vorbisfile::Read( float *buf, int iFrames )
int RageSoundReader_Vorbisfile::GetSampleRate() const int RageSoundReader_Vorbisfile::GetSampleRate() const
{ {
ASSERT(vf != NULL); ASSERT(vf != nullptr);
vorbis_info *vi = ov_info(vf, -1); vorbis_info *vi = ov_info(vf, -1);
ASSERT(vi != NULL); ASSERT(vi != nullptr);
return vi->rate; return vi->rate;
} }
int RageSoundReader_Vorbisfile::GetNextSourceFrame() const int RageSoundReader_Vorbisfile::GetNextSourceFrame() const
{ {
ASSERT(vf != NULL); ASSERT(vf != nullptr);
int iFrame = (int)ov_pcm_tell( vf ); int iFrame = (int)ov_pcm_tell( vf );
return iFrame; return iFrame;
+5 -5
View File
@@ -289,7 +289,7 @@ public:
int iMaxSize = min( (int) m_WavData.m_iBlockAlign - 7 * m_WavData.m_iChannels, (m_WavData.m_iDataChunkSize+m_WavData.m_iDataChunkPos) - m_File.Tell() ); int iMaxSize = min( (int) m_WavData.m_iBlockAlign - 7 * m_WavData.m_iChannels, (m_WavData.m_iDataChunkSize+m_WavData.m_iDataChunkPos) - m_File.Tell() );
char *pBuf = (char *) alloca( iMaxSize ); char *pBuf = (char *) alloca( iMaxSize );
ASSERT( pBuf != NULL ); ASSERT( pBuf != nullptr );
int iBlockSize = m_File.Read( pBuf, iMaxSize ); int iBlockSize = m_File.Read( pBuf, iMaxSize );
if( iBlockSize == 0 ) if( iBlockSize == 0 )
@@ -581,25 +581,25 @@ RageSoundReader_FileReader::OpenResult RageSoundReader_WAV::Open( RageFileBasic
int RageSoundReader_WAV::GetLength() const int RageSoundReader_WAV::GetLength() const
{ {
ASSERT( m_pImpl != NULL ); ASSERT( m_pImpl != nullptr );
return m_pImpl->GetLength(); return m_pImpl->GetLength();
} }
int RageSoundReader_WAV::SetPosition( int iFrame ) int RageSoundReader_WAV::SetPosition( int iFrame )
{ {
ASSERT( m_pImpl != NULL ); ASSERT( m_pImpl != nullptr );
return m_pImpl->SetPosition( iFrame ); return m_pImpl->SetPosition( iFrame );
} }
int RageSoundReader_WAV::GetNextSourceFrame() const int RageSoundReader_WAV::GetNextSourceFrame() const
{ {
ASSERT( m_pImpl != NULL ); ASSERT( m_pImpl != nullptr );
return m_pImpl->GetNextSourceFrame(); return m_pImpl->GetNextSourceFrame();
} }
int RageSoundReader_WAV::Read( float *pBuf, int iFrames ) int RageSoundReader_WAV::Read( float *pBuf, int iFrames )
{ {
ASSERT( m_pImpl != NULL ); ASSERT( m_pImpl != nullptr );
return m_pImpl->Read( pBuf, iFrames ); return m_pImpl->Read( pBuf, iFrames );
} }
+1 -1
View File
@@ -64,7 +64,7 @@ void RageSurfaceFormat::GetRGB( uint32_t val, uint8_t *r, uint8_t *g, uint8_t *b
{ {
if( BytesPerPixel == 1 ) if( BytesPerPixel == 1 )
{ {
ASSERT( palette != NULL ); ASSERT( palette != nullptr );
*r = palette->colors[val].r; *r = palette->colors[val].r;
*g = palette->colors[val].g; *g = palette->colors[val].g;
*b = palette->colors[val].b; *b = palette->colors[val].b;
+2 -2
View File
@@ -134,7 +134,7 @@ void RageSurfaceUtils::CopySurface( const RageSurface *src, RageSurface *dest )
// Copy the palette, if we have one. // Copy the palette, if we have one.
if( src->format->BitsPerPixel == 8 && dest->format->BitsPerPixel == 8 ) if( src->format->BitsPerPixel == 8 && dest->format->BitsPerPixel == 8 )
{ {
ASSERT( dest->fmt.palette != NULL ); ASSERT( dest->fmt.palette != nullptr );
*dest->fmt.palette = *src->fmt.palette; *dest->fmt.palette = *src->fmt.palette;
} }
@@ -791,7 +791,7 @@ RageSurface *RageSurfaceUtils::LoadSurface( RString file )
// Create the surface. // Create the surface.
RageSurface *img = CreateSurface( h.width, h.height, h.bpp, RageSurface *img = CreateSurface( h.width, h.height, h.bpp,
h.Rmask, h.Gmask, h.Bmask, h.Amask ); h.Rmask, h.Gmask, h.Bmask, h.Amask );
ASSERT( img != NULL ); ASSERT( img != nullptr );
/* If the pitch has changed, this surface is either corrupt, or was /* If the pitch has changed, this surface is either corrupt, or was
* created with a different version whose CreateSurface() behavior * created with a different version whose CreateSurface() behavior
+11 -11
View File
@@ -48,7 +48,7 @@ struct acolorhash_hash
for( unsigned i = 0; i < HASH_SIZE; ++i ) for( unsigned i = 0; i < HASH_SIZE; ++i )
{ {
acolorhist_list achl, achlnext; acolorhist_list achl, achlnext;
for ( achl = hash[i]; achl != NULL; achl = achlnext ) for ( achl = hash[i]; achl != nullptr; achl = achlnext )
{ {
achlnext = achl->next; achlnext = achl->next;
free( achl ); free( achl );
@@ -123,7 +123,7 @@ void RageSurfaceUtils::Palettize( RageSurface *&pImg, int iColors, bool bDither
while(1) while(1)
{ {
achv = pam_computeacolorhist( pImg, MAXCOLORS, &colors ); achv = pam_computeacolorhist( pImg, MAXCOLORS, &colors );
if( achv != NULL ) if( achv != nullptr )
break; break;
pixval newmaxval = maxval / 2; pixval newmaxval = maxval / 2;
@@ -330,9 +330,9 @@ static acolorhist_item *mediancut( acolorhist_item *achv, int colors, int sum, i
int boxes; int boxes;
bv = (box_vector) malloc( sizeof(struct box) * newcolors ); bv = (box_vector) malloc( sizeof(struct box) * newcolors );
ASSERT( bv != NULL ); ASSERT( bv != nullptr );
acolormap = (acolorhist_item*) malloc( sizeof(struct acolorhist_item) * newcolors); acolormap = (acolorhist_item*) malloc( sizeof(struct acolorhist_item) * newcolors);
ASSERT( acolormap != NULL ); ASSERT( acolormap != nullptr );
for ( int i = 0; i < newcolors; ++i ) for ( int i = 0; i < newcolors; ++i )
PAM_ASSIGN( acolormap[i].acolor, 0, 0, 0, 0 ); PAM_ASSIGN( acolormap[i].acolor, 0, 0, 0, 0 );
@@ -516,17 +516,17 @@ static bool pam_computeacolorhash( const RageSurface *src, int maxacolors, int*
{ {
int hashval = pam_hashapixel( *pP ); int hashval = pam_hashapixel( *pP );
acolorhist_list achl; acolorhist_list achl;
for ( achl = hash.hash[hashval]; achl != NULL; achl = achl->next ) for ( achl = hash.hash[hashval]; achl != nullptr; achl = achl->next )
if ( PAM_EQUAL( achl->ch.acolor, *pP ) ) if ( PAM_EQUAL( achl->ch.acolor, *pP ) )
break; break;
if ( achl != NULL ) if ( achl != nullptr )
++achl->ch.value; ++achl->ch.value;
else else
{ {
if ( ++(*acolorsP) > maxacolors ) if ( ++(*acolorsP) > maxacolors )
return false; return false;
achl = (acolorhist_list) malloc( sizeof(struct acolorhist_list_item) ); achl = (acolorhist_list) malloc( sizeof(struct acolorhist_list_item) );
ASSERT( achl != NULL ); ASSERT( achl != nullptr );
memcpy( achl->ch.acolor, *pP, sizeof(apixel) ); memcpy( achl->ch.acolor, *pP, sizeof(apixel) );
achl->ch.value = 1; achl->ch.value = 1;
@@ -543,13 +543,13 @@ static acolorhist_item *pam_acolorhashtoacolorhist( const acolorhash_hash &acht,
{ {
// Collate the hash table into a simple acolorhist array. // Collate the hash table into a simple acolorhist array.
acolorhist_item *achv = (acolorhist_item*) malloc( maxacolors * sizeof(struct acolorhist_item) ); acolorhist_item *achv = (acolorhist_item*) malloc( maxacolors * sizeof(struct acolorhist_item) );
ASSERT( achv != NULL ); ASSERT( achv != nullptr );
// Loop through the hash table. // Loop through the hash table.
int j = 0; int j = 0;
for( unsigned i = 0; i < HASH_SIZE; ++i ) for( unsigned i = 0; i < HASH_SIZE; ++i )
{ {
for ( acolorhist_list achl = acht.hash[i]; achl != NULL; achl = achl->next ) for ( acolorhist_list achl = acht.hash[i]; achl != nullptr; achl = achl->next )
{ {
// Add the new entry. // Add the new entry.
achv[j] = achl->ch; achv[j] = achl->ch;
@@ -574,7 +574,7 @@ static acolorhist_item *pam_computeacolorhist( const RageSurface *src, int maxac
static void pam_addtoacolorhash( acolorhash_hash &acht, const uint8_t acolorP[4], int value ) static void pam_addtoacolorhash( acolorhash_hash &acht, const uint8_t acolorP[4], int value )
{ {
acolorhist_list achl = (acolorhist_list) malloc( sizeof(struct acolorhist_list_item) ); acolorhist_list achl = (acolorhist_list) malloc( sizeof(struct acolorhist_list_item) );
ASSERT( achl != NULL ); ASSERT( achl != nullptr );
int hash = pam_hashapixel( acolorP ); int hash = pam_hashapixel( acolorP );
memcpy( achl->ch.acolor, acolorP, sizeof(apixel) ); memcpy( achl->ch.acolor, acolorP, sizeof(apixel) );
@@ -587,7 +587,7 @@ static void pam_addtoacolorhash( acolorhash_hash &acht, const uint8_t acolorP[4]
static int pam_lookupacolor( const acolorhash_hash &acht, const uint8_t acolorP[4] ) static int pam_lookupacolor( const acolorhash_hash &acht, const uint8_t acolorP[4] )
{ {
const int hash = pam_hashapixel( acolorP ); const int hash = pam_hashapixel( acolorP );
for ( acolorhist_list_item *achl = acht.hash[hash]; achl != NULL; achl = achl->next ) for ( acolorhist_list_item *achl = acht.hash[hash]; achl != nullptr; achl = achl->next )
if ( PAM_EQUAL( achl->ch.acolor, acolorP ) ) if ( PAM_EQUAL( achl->ch.acolor, acolorP ) )
return achl->ch.value; return achl->ch.value;
+1 -1
View File
@@ -31,7 +31,7 @@ static RageSurface *TryOpenFile( RString sPath, bool bHeaderOnly, RString &error
if( result == RageSurfaceUtils::OPEN_OK ) if( result == RageSurfaceUtils::OPEN_OK )
{ {
ASSERT( ret != NULL ); ASSERT( ret != nullptr );
return ret; return ret;
} }
+1 -1
View File
@@ -201,7 +201,7 @@ RageSurfaceUtils::OpenResult RageSurface_Load_BMP( const RString &sPath, RageSur
img = NULL; img = NULL;
ret = LoadBMP( f, img, error ); ret = LoadBMP( f, img, error );
if( ret != RageSurfaceUtils::OPEN_OK && img != NULL ) if( ret != RageSurfaceUtils::OPEN_OK && img != nullptr )
{ {
delete img; delete img;
img = NULL; img = NULL;
+1 -1
View File
@@ -229,7 +229,7 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
default: default:
FAIL_M(ssprintf( "%i", type) ); FAIL_M(ssprintf( "%i", type) );
} }
ASSERT( img != NULL ); ASSERT( img != nullptr );
/* alloca to prevent memleaks if libpng longjmps us */ /* alloca to prevent memleaks if libpng longjmps us */
png_byte **row_pointers = (png_byte **) alloca( sizeof(png_byte*) * height ); png_byte **row_pointers = (png_byte **) alloca( sizeof(png_byte*) * height );
+1 -1
View File
@@ -27,7 +27,7 @@ RageTexturePreloader &RageTexturePreloader::operator=( const RageTexturePreloade
void RageTexturePreloader::Load( const RageTextureID &ID ) void RageTexturePreloader::Load( const RageTextureID &ID )
{ {
ASSERT( TEXTUREMAN != NULL ); ASSERT( TEXTUREMAN != nullptr );
RageTexture *pTexture = TEXTUREMAN->LoadTexture( ID ); RageTexture *pTexture = TEXTUREMAN->LoadTexture( ID );
m_apTextures.push_back( pTexture ); m_apTextures.push_back( pTexture );
+11 -11
View File
@@ -94,12 +94,12 @@ void ThreadSlot::ThreadCheckpoint::Set( const char *szFile, int iLine, const cha
m_szMessage = szMessage; m_szMessage = szMessage;
/* Skip any path components. */ /* Skip any path components. */
if( m_szFile != NULL ) if( m_szFile != nullptr )
{ {
const char *p = strrchr( m_szFile, '/' ); const char *p = strrchr( m_szFile, '/' );
if( p == NULL ) if( p == NULL )
p = strrchr( m_szFile, '\\' ); p = strrchr( m_szFile, '\\' );
if( p != NULL && p[1] != '\0' ) if( p != nullptr && p[1] != '\0' )
m_szFile = p+1; m_szFile = p+1;
} }
@@ -215,7 +215,7 @@ RageThread::RageThread( const RageThread &cpy ):
RageThread::~RageThread() RageThread::~RageThread()
{ {
if( m_pSlot != NULL ) if( m_pSlot != nullptr )
Wait(); Wait();
} }
@@ -310,8 +310,8 @@ bool RageThread::EnumThreadIDs( int n, uint64_t &iID )
int RageThread::Wait() int RageThread::Wait()
{ {
ASSERT( m_pSlot != NULL ); ASSERT( m_pSlot != nullptr );
ASSERT( m_pSlot->m_pImpl != NULL ); ASSERT( m_pSlot->m_pImpl != nullptr );
int ret = m_pSlot->m_pImpl->Wait(); int ret = m_pSlot->m_pImpl->Wait();
LockMut( GetThreadSlotsLock() ); LockMut( GetThreadSlotsLock() );
@@ -323,14 +323,14 @@ int RageThread::Wait()
} }
void RageThread::Halt(bool Kill) { void RageThread::Halt(bool Kill) {
ASSERT( m_pSlot != NULL ); ASSERT( m_pSlot != nullptr );
ASSERT( m_pSlot->m_pImpl != NULL ); ASSERT( m_pSlot->m_pImpl != nullptr );
m_pSlot->m_pImpl->Halt(Kill); m_pSlot->m_pImpl->Halt(Kill);
} }
void RageThread::Resume() { void RageThread::Resume() {
ASSERT( m_pSlot != NULL ); ASSERT( m_pSlot != nullptr );
ASSERT( m_pSlot->m_pImpl != NULL ); ASSERT( m_pSlot->m_pImpl != nullptr );
m_pSlot->m_pImpl->Resume(); m_pSlot->m_pImpl->Resume();
} }
@@ -432,7 +432,7 @@ void Checkpoints::GetLogs( char *pBuf, int iSize, const char *delim )
strcat( pBuf, buf ); strcat( pBuf, buf );
strcat( pBuf, delim ); strcat( pBuf, delim );
for( int line = 1; (buf = GetCheckpointLog(slotno, line)) != NULL; ++line ) for( int line = 1; (buf = GetCheckpointLog(slotno, line)) != nullptr; ++line )
{ {
strcat( pBuf, buf ); strcat( pBuf, buf );
strcat( pBuf, delim ); strcat( pBuf, delim );
@@ -704,7 +704,7 @@ bool RageEvent::Wait( RageTimer *pTimeout )
ASSERT( m_LockCnt == 0 ); ASSERT( m_LockCnt == 0 );
/* A zero RageTimer also means no timeout. */ /* A zero RageTimer also means no timeout. */
if( pTimeout != NULL && pTimeout->IsZero() ) if( pTimeout != nullptr && pTimeout->IsZero() )
pTimeout = NULL; pTimeout = NULL;
bool bRet = m_pEvent->Wait( pTimeout ); bool bRet = m_pEvent->Wait( pTimeout );
+1 -1
View File
@@ -31,7 +31,7 @@ public:
static const char *GetThreadNameByID( uint64_t iID ); static const char *GetThreadNameByID( uint64_t iID );
static bool EnumThreadIDs( int n, uint64_t &iID ); static bool EnumThreadIDs( int n, uint64_t &iID );
int Wait(); int Wait();
bool IsCreated() const { return m_pSlot != NULL; } bool IsCreated() const { return m_pSlot != nullptr; }
/* A system can define HAVE_TLS, indicating that it can compile thread_local /* A system can define HAVE_TLS, indicating that it can compile thread_local
* code, but an individual environment may not actually have functional TLS. * code, but an individual environment may not actually have functional TLS.
+4 -4
View File
@@ -1027,7 +1027,7 @@ bool GetCommandlineArgument( const RString &option, RString *argument, int iInde
RString GetCwd() RString GetCwd()
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
bool ret = getcwd(buf, PATH_MAX) != NULL; bool ret = getcwd(buf, PATH_MAX) != nullptr;
ASSERT(ret); ASSERT(ret);
return buf; return buf;
} }
@@ -2274,7 +2274,7 @@ bool FileCopy( RageFileBasic &in, RageFileBasic &out, RString &sError, bool *bRe
if( in.Read(data, 1024*32) == -1 ) if( in.Read(data, 1024*32) == -1 )
{ {
sError = ssprintf( "read error: %s", in.GetError().c_str() ); sError = ssprintf( "read error: %s", in.GetError().c_str() );
if( bReadError != NULL ) if( bReadError != nullptr )
*bReadError = true; *bReadError = true;
return false; return false;
} }
@@ -2284,7 +2284,7 @@ bool FileCopy( RageFileBasic &in, RageFileBasic &out, RString &sError, bool *bRe
if( i == -1 ) if( i == -1 )
{ {
sError = ssprintf( "write error: %s", out.GetError().c_str() ); sError = ssprintf( "write error: %s", out.GetError().c_str() );
if( bReadError != NULL ) if( bReadError != nullptr )
*bReadError = false; *bReadError = false;
return false; return false;
} }
@@ -2293,7 +2293,7 @@ bool FileCopy( RageFileBasic &in, RageFileBasic &out, RString &sError, bool *bRe
if( out.Flush() == -1 ) if( out.Flush() == -1 )
{ {
sError = ssprintf( "write error: %s", out.GetError().c_str() ); sError = ssprintf( "write error: %s", out.GetError().c_str() );
if( bReadError != NULL ) if( bReadError != nullptr )
*bReadError = false; *bReadError = false;
return false; return false;
} }
+1 -1
View File
@@ -131,7 +131,7 @@ public:
HiddenPtr( const HiddenPtr<T> &cpy ): m_pPtr(NULL) HiddenPtr( const HiddenPtr<T> &cpy ): m_pPtr(NULL)
{ {
if( cpy.m_pPtr != NULL ) if( cpy.m_pPtr != nullptr )
m_pPtr = HiddenPtrTraits<T>::Copy( cpy.m_pPtr ); m_pPtr = HiddenPtrTraits<T>::Copy( cpy.m_pPtr );
} }
+2 -2
View File
@@ -31,7 +31,7 @@ public:
~CachedObject() ~CachedObject()
{ {
if( m_pObject != NULL ) if( m_pObject != nullptr )
ClearCacheSpecific( m_pObject ); ClearCacheSpecific( m_pObject );
} }
@@ -145,7 +145,7 @@ public:
CachedObjectHelpers::Lock(); CachedObjectHelpers::Lock();
m_pCache = p; m_pCache = p;
m_bCacheIsSet = true; m_bCacheIsSet = true;
if( p != NULL ) if( p != nullptr )
p->m_CachedObject.m_pObject = p; p->m_CachedObject.m_pObject = p;
CachedObjectHelpers::Unlock(); CachedObjectHelpers::Unlock();
} }
+3 -3
View File
@@ -349,7 +349,7 @@ FileSet *FilenameDB::GetFileSet( const RString &sDir_, bool bCreate )
/* This also re-locks m_Mutex for us. */ /* This also re-locks m_Mutex for us. */
FileSet *pParent = GetFileSet( sParent ); FileSet *pParent = GetFileSet( sParent );
if( pParent != NULL ) if( pParent != nullptr )
{ {
set<File>::iterator it = pParent->files.find( File(Basename(sDir)) ); set<File>::iterator it = pParent->files.find( File(Basename(sDir)) );
if( it != pParent->files.end() ) if( it != pParent->files.end() )
@@ -361,7 +361,7 @@ FileSet *FilenameDB::GetFileSet( const RString &sDir_, bool bCreate )
m_Mutex.Lock(); m_Mutex.Lock();
} }
if( pParentDirp != NULL ) if( pParentDirp != nullptr )
*pParentDirp = pRet; *pParentDirp = pRet;
pRet->age.Touch(); pRet->age.Touch();
@@ -559,7 +559,7 @@ void *FilenameDB::GetFilePriv( const RString &path )
const File *pFile = GetFile( path ); const File *pFile = GetFile( path );
void *pRet = NULL; void *pRet = NULL;
if( pFile != NULL ) if( pFile != nullptr )
pRet = pFile->priv; pRet = pFile->priv;
m_Mutex.Unlock(); /* locked by GetFileSet */ m_Mutex.Unlock(); /* locked by GetFileSet */
+1 -1
View File
@@ -180,7 +180,7 @@ void RoomWheel::Move( int n )
if( n == 0 && m_iSelection >= m_offset ) if( n == 0 && m_iSelection >= m_offset )
{ {
const RoomWheelItemData* data = GetItem( m_iSelection-m_offset ); const RoomWheelItemData* data = GetItem( m_iSelection-m_offset );
if( data != NULL ) if( data != nullptr )
SCREENMAN->PostMessageToTopScreen( SM_RoomInfoDeploy, 0 ); SCREENMAN->PostMessageToTopScreen( SM_RoomInfoDeploy, 0 );
} }
else else
+2 -2
View File
@@ -104,9 +104,9 @@ void ScoreKeeperNormal::Load(
for( unsigned i=0; i<apSteps.size(); i++ ) for( unsigned i=0; i<apSteps.size(); i++ )
{ {
Song* pSong = apSongs[i]; Song* pSong = apSongs[i];
ASSERT( pSong != NULL ); ASSERT( pSong != nullptr );
Steps* pSteps = apSteps[i]; Steps* pSteps = apSteps[i];
ASSERT( pSteps != NULL ); ASSERT( pSteps != nullptr );
const AttackArray &aa = asModifiers[i]; const AttackArray &aa = asModifiers[i];
NoteData ndTemp; NoteData ndTemp;
pSteps->GetNoteData( ndTemp ); pSteps->GetNoteData( ndTemp );
+1 -1
View File
@@ -180,7 +180,7 @@ void ScoreKeeperRave::LaunchAttack( AttackLevel al )
RString* asAttacks = GAMESTATE->m_pCurCharacters[pn]->m_sAttacks[al]; // [NUM_ATTACKS_PER_LEVEL] RString* asAttacks = GAMESTATE->m_pCurCharacters[pn]->m_sAttacks[al]; // [NUM_ATTACKS_PER_LEVEL]
RString sAttackToGive; RString sAttackToGive;
if (GAMESTATE->m_pCurCharacters[pn] != NULL) if (GAMESTATE->m_pCurCharacters[pn] != nullptr)
sAttackToGive = asAttacks[ RandomInt(NUM_ATTACKS_PER_LEVEL) ]; sAttackToGive = asAttacks[ RandomInt(NUM_ATTACKS_PER_LEVEL) ];
else else
{ {
+8 -8
View File
@@ -1102,8 +1102,8 @@ void ScreenEdit::Init()
SubscribeToMessage( "Judgment" ); SubscribeToMessage( "Judgment" );
ASSERT( GAMESTATE->m_pCurSong != NULL ); ASSERT( GAMESTATE->m_pCurSong != nullptr );
ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] != NULL ); ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] != nullptr );
EDIT_MODE.Load( m_sName, "EditMode" ); EDIT_MODE.Load( m_sName, "EditMode" );
ScreenWithMenuElements::Init(); ScreenWithMenuElements::Init();
@@ -2112,7 +2112,7 @@ bool ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
// save current steps // save current steps
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1]; Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
ASSERT( pSteps != NULL ); ASSERT( pSteps != nullptr );
pSteps->SetNoteData( m_NoteDataEdit ); pSteps->SetNoteData( m_NoteDataEdit );
// Get all Steps of this StepsType // Get all Steps of this StepsType
@@ -3087,7 +3087,7 @@ void ScreenEdit::TransitionEditState( EditState em )
/* FirstBeat affects backgrounds, so commit changes to memory (not to disk) /* FirstBeat affects backgrounds, so commit changes to memory (not to disk)
* and recalc it. */ * and recalc it. */
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1]; Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
ASSERT( pSteps != NULL ); ASSERT( pSteps != nullptr );
pSteps->SetNoteData( m_NoteDataEdit ); pSteps->SetNoteData( m_NoteDataEdit );
m_pSong->ReCalculateRadarValuesAndLastSecond(); m_pSong->ReCalculateRadarValuesAndLastSecond();
@@ -3493,7 +3493,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
GAMESTATE->m_pCurCourse.Set( pCourse ); GAMESTATE->m_pCurCourse.Set( pCourse );
GAMESTATE->m_iEditCourseEntryIndex.Set( iCourseEntryIndex ); GAMESTATE->m_iEditCourseEntryIndex.Set( iCourseEntryIndex );
ASSERT( GAMESTATE->m_pCurCourse != NULL ); ASSERT( GAMESTATE->m_pCurCourse != nullptr );
} }
} }
else if (SM == SM_BackFromKeysoundTrack) else if (SM == SM_BackFromKeysoundTrack)
@@ -5520,8 +5520,8 @@ void ScreenEdit::SetupCourseAttacks()
void ScreenEdit::CopyToLastSave() void ScreenEdit::CopyToLastSave()
{ {
ASSERT( GAMESTATE->m_pCurSong != NULL ); ASSERT( GAMESTATE->m_pCurSong != nullptr );
ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] != NULL ); ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] != nullptr );
m_SongLastSave = *GAMESTATE->m_pCurSong; m_SongLastSave = *GAMESTATE->m_pCurSong;
m_vStepsLastSave.clear(); m_vStepsLastSave.clear();
const vector<Steps*> &vSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( GAMESTATE->m_pCurSteps[PLAYER_1]->m_StepsType ); const vector<Steps*> &vSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( GAMESTATE->m_pCurSteps[PLAYER_1]->m_StepsType );
@@ -5543,7 +5543,7 @@ void ScreenEdit::CopyFromLastSave()
void ScreenEdit::RevertFromDisk() void ScreenEdit::RevertFromDisk()
{ {
ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] != NULL ); ASSERT( GAMESTATE->m_pCurSteps[PLAYER_1] != nullptr );
StepsID id; StepsID id;
id.FromSteps( GAMESTATE->m_pCurSteps[PLAYER_1] ); id.FromSteps( GAMESTATE->m_pCurSteps[PLAYER_1] );
ASSERT( id.IsValid() ); ASSERT( id.IsValid() );
+3 -3
View File
@@ -220,7 +220,7 @@ bool ScreenEditMenu::MenuStart( const InputEventPlus & )
{ {
case EditMenuAction_Delete: case EditMenuAction_Delete:
{ {
ASSERT( pSteps != NULL ); ASSERT( pSteps != nullptr );
if( pSteps->IsAutogen() ) if( pSteps->IsAutogen() )
{ {
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
@@ -238,7 +238,7 @@ bool ScreenEditMenu::MenuStart( const InputEventPlus & )
case EditMenuAction_Practice: case EditMenuAction_Practice:
break; break;
case EditMenuAction_Delete: case EditMenuAction_Delete:
ASSERT( pSteps != NULL ); ASSERT( pSteps != nullptr );
ScreenPrompt::Prompt( SM_None, STEPS_WILL_BE_LOST.GetValue() + "\n\n" + CONTINUE_WITH_DELETE.GetValue(), ScreenPrompt::Prompt( SM_None, STEPS_WILL_BE_LOST.GetValue() + "\n\n" + CONTINUE_WITH_DELETE.GetValue(),
PROMPT_YES_NO, ANSWER_NO ); PROMPT_YES_NO, ANSWER_NO );
break; break;
@@ -298,7 +298,7 @@ bool ScreenEditMenu::MenuStart( const InputEventPlus & )
case EditMenuAction_Practice: case EditMenuAction_Practice:
{ {
// Prepare for ScreenEdit // Prepare for ScreenEdit
ASSERT( pSteps != NULL ); ASSERT( pSteps != nullptr );
bool bPromptToNameSteps = (action == EditMenuAction_Create && dc == Difficulty_Edit); bool bPromptToNameSteps = (action == EditMenuAction_Create && dc == Difficulty_Edit);
if( bPromptToNameSteps ) if( bPromptToNameSteps )
{ {
+10 -10
View File
@@ -428,7 +428,7 @@ void ScreenGameplay::Init()
GAMESTATE->m_pCurSteps[p].Set( GAMESTATE->m_pCurSteps[ GAMESTATE->GetFirstHumanPlayer() ] ); GAMESTATE->m_pCurSteps[p].Set( GAMESTATE->m_pCurSteps[ GAMESTATE->GetFirstHumanPlayer() ] );
FOREACH_EnabledPlayer(p) FOREACH_EnabledPlayer(p)
ASSERT( GAMESTATE->m_pCurSteps[p].Get() != NULL ); ASSERT( GAMESTATE->m_pCurSteps[p].Get() != nullptr );
} }
/* Increment the course play count. */ /* Increment the course play count. */
@@ -814,28 +814,28 @@ void ScreenGameplay::InitSongQueues()
if( GAMESTATE->IsCourseMode() ) if( GAMESTATE->IsCourseMode() )
{ {
Course* pCourse = GAMESTATE->m_pCurCourse; Course* pCourse = GAMESTATE->m_pCurCourse;
ASSERT( pCourse != NULL ); ASSERT( pCourse != nullptr );
m_apSongsQueue.clear(); m_apSongsQueue.clear();
PlayerNumber pnMaster = GAMESTATE->GetMasterPlayerNumber(); PlayerNumber pnMaster = GAMESTATE->GetMasterPlayerNumber();
Trail *pTrail = GAMESTATE->m_pCurTrail[pnMaster]; Trail *pTrail = GAMESTATE->m_pCurTrail[pnMaster];
ASSERT( pTrail != NULL ); ASSERT( pTrail != nullptr );
for (TrailEntry const &e : pTrail->m_vEntries) for (TrailEntry const &e : pTrail->m_vEntries)
{ {
ASSERT( e.pSong != NULL ); ASSERT( e.pSong != nullptr );
m_apSongsQueue.push_back( e.pSong ); m_apSongsQueue.push_back( e.pSong );
} }
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{ {
Trail *lTrail = GAMESTATE->m_pCurTrail[ pi->GetStepsAndTrailIndex() ]; Trail *lTrail = GAMESTATE->m_pCurTrail[ pi->GetStepsAndTrailIndex() ];
ASSERT( lTrail != NULL ); ASSERT( lTrail != nullptr );
pi->m_vpStepsQueue.clear(); pi->m_vpStepsQueue.clear();
pi->m_asModifiersQueue.clear(); pi->m_asModifiersQueue.clear();
for (TrailEntry const &e : lTrail->m_vEntries) for (TrailEntry const &e : lTrail->m_vEntries)
{ {
ASSERT( e.pSteps != NULL ); ASSERT( e.pSteps != nullptr );
pi->m_vpStepsQueue.push_back( e.pSteps ); pi->m_vpStepsQueue.push_back( e.pSteps );
AttackArray a; AttackArray a;
e.GetAttackArray( a ); e.GetAttackArray( a );
@@ -1094,7 +1094,7 @@ void ScreenGameplay::LoadNextSong()
Steps* pSteps = GAMESTATE->m_pCurSteps[ pi->GetStepsAndTrailIndex() ]; Steps* pSteps = GAMESTATE->m_pCurSteps[ pi->GetStepsAndTrailIndex() ];
++pi->GetPlayerStageStats()->m_iStepsPlayed; ++pi->GetPlayerStageStats()->m_iStepsPlayed;
ASSERT( GAMESTATE->m_pCurSteps[ pi->GetStepsAndTrailIndex() ] != NULL ); ASSERT( GAMESTATE->m_pCurSteps[ pi->GetStepsAndTrailIndex() ] != nullptr );
if( pi->m_ptextStepsDescription ) if( pi->m_ptextStepsDescription )
pi->m_ptextStepsDescription->SetText( pSteps->GetDescription() ); pi->m_ptextStepsDescription->SetText( pSteps->GetDescription() );
@@ -1285,10 +1285,10 @@ void ScreenGameplay::LoadLights()
// First, check if the song has explicit lights // First, check if the song has explicit lights
m_CabinetLightsNoteData.Init(); m_CabinetLightsNoteData.Init();
ASSERT( GAMESTATE->m_pCurSong != NULL ); ASSERT( GAMESTATE->m_pCurSong != nullptr );
const Steps *pSteps = SongUtil::GetClosestNotes( GAMESTATE->m_pCurSong, StepsType_lights_cabinet, Difficulty_Medium ); const Steps *pSteps = SongUtil::GetClosestNotes( GAMESTATE->m_pCurSong, StepsType_lights_cabinet, Difficulty_Medium );
if( pSteps != NULL ) if( pSteps != nullptr )
{ {
pSteps->GetNoteData( m_CabinetLightsNoteData ); pSteps->GetNoteData( m_CabinetLightsNoteData );
return; return;
@@ -1751,7 +1751,7 @@ void ScreenGameplay::Update( float fDeltaTime )
DancingCharacters *pCharacter = NULL; DancingCharacters *pCharacter = NULL;
if( m_pSongBackground ) if( m_pSongBackground )
pCharacter = m_pSongBackground->GetDancingCharacters(); pCharacter = m_pSongBackground->GetDancingCharacters();
if( pCharacter != NULL ) if( pCharacter != nullptr )
{ {
TapNoteScore tns = pi->m_pPlayer->GetLastTapNoteScore(); TapNoteScore tns = pi->m_pPlayer->GetLastTapNoteScore();
+2 -2
View File
@@ -15,8 +15,8 @@ ScreenGameplayLesson::ScreenGameplayLesson()
void ScreenGameplayLesson::Init() void ScreenGameplayLesson::Init()
{ {
ASSERT( GAMESTATE->GetCurrentStyle() != NULL ); ASSERT( GAMESTATE->GetCurrentStyle() != nullptr );
ASSERT( GAMESTATE->m_pCurSong != NULL ); ASSERT( GAMESTATE->m_pCurSong != nullptr );
/* Now that we've set up, init the base class. */ /* Now that we've set up, init the base class. */
ScreenGameplayNormal::Init(); ScreenGameplayNormal::Init();
+4 -4
View File
@@ -116,9 +116,9 @@ void ScoreScroller::ConfigureActor( Actor *pActor, int iItem )
const ScoreRowItemData &data = m_vScoreRowItemData[iItem]; const ScoreRowItemData &data = m_vScoreRowItemData[iItem];
Message msg("Set"); Message msg("Set");
if( data.m_pSong != NULL ) if( data.m_pSong != nullptr )
msg.SetParam( "Song", data.m_pSong ); msg.SetParam( "Song", data.m_pSong );
if( data.m_pCourse != NULL ) if( data.m_pCourse != nullptr )
msg.SetParam( "Course", data.m_pCourse ); msg.SetParam( "Course", data.m_pCourse );
@@ -133,7 +133,7 @@ void ScoreScroller::ConfigureActor( Actor *pActor, int iItem )
Difficulty dc = iter.first; Difficulty dc = iter.first;
StepsType st = iter.second; StepsType st = iter.second;
if( data.m_pSong != NULL ) if( data.m_pSong != nullptr )
{ {
const Song* pSong = data.m_pSong; const Song* pSong = data.m_pSong;
Steps *pSteps = SongUtil::GetStepsByDifficulty( pSong, st, dc, false ); Steps *pSteps = SongUtil::GetStepsByDifficulty( pSong, st, dc, false );
@@ -141,7 +141,7 @@ void ScoreScroller::ConfigureActor( Actor *pActor, int iItem )
pSteps = NULL; pSteps = NULL;
LuaHelpers::Push( L, pSteps ); LuaHelpers::Push( L, pSteps );
} }
else if( data.m_pCourse != NULL ) else if( data.m_pCourse != nullptr )
{ {
const Course* pCourse = data.m_pCourse; const Course* pCourse = data.m_pCourse;
Trail *pTrail = pCourse->GetTrail( st, dc ); Trail *pTrail = pCourse->GetTrail( st, dc );
+2 -2
View File
@@ -149,7 +149,7 @@ void ScreenHowToPlay::Init()
const Style* pStyle = GAMESTATE->GetCurrentStyle(); const Style* pStyle = GAMESTATE->GetCurrentStyle();
Steps *pSteps = SongUtil::GetClosestNotes( &m_Song, pStyle->m_StepsType, Difficulty_Beginner ); Steps *pSteps = SongUtil::GetClosestNotes( &m_Song, pStyle->m_StepsType, Difficulty_Beginner );
ASSERT_M( pSteps != NULL, ssprintf("No playable steps of StepsType '%s' for ScreenHowToPlay", StringConversion::ToString(pStyle->m_StepsType).c_str()) ); ASSERT_M( pSteps != nullptr, ssprintf("No playable steps of StepsType '%s' for ScreenHowToPlay", StringConversion::ToString(pStyle->m_StepsType).c_str()) );
m_Song.m_SongTiming.TidyUpData( false ); m_Song.m_SongTiming.TidyUpData( false );
pSteps->m_Timing.TidyUpData( true ); pSteps->m_Timing.TidyUpData( true );
@@ -248,7 +248,7 @@ void ScreenHowToPlay::Step()
void ScreenHowToPlay::Update( float fDelta ) void ScreenHowToPlay::Update( float fDelta )
{ {
if( GAMESTATE->m_pCurSong != NULL ) if( GAMESTATE->m_pCurSong != nullptr )
{ {
RageTimer tm; RageTimer tm;
GAMESTATE->UpdateSongPosition( m_fFakeSecondsIntoSong, GAMESTATE->m_pCurSong->m_SongTiming, tm, true ); GAMESTATE->UpdateSongPosition( m_fFakeSecondsIntoSong, GAMESTATE->m_pCurSong->m_SongTiming, tm, true );
+4 -4
View File
@@ -34,7 +34,7 @@ void ScreenJukebox::SetSong()
/* Check to see if there is a theme course. If there is a course that has /* Check to see if there is a theme course. If there is a course that has
* the exact same name as the theme, then we pick a song from this course. */ * the exact same name as the theme, then we pick a song from this course. */
Course *pCourse = SONGMAN->GetCourseFromName( THEME->GetCurThemeName() ); Course *pCourse = SONGMAN->GetCourseFromName( THEME->GetCurThemeName() );
if( pCourse != NULL ) if( pCourse != nullptr )
for ( unsigned i = 0; i < pCourse->m_vEntries.size(); i++ ) for ( unsigned i = 0; i < pCourse->m_vEntries.size(); i++ )
if( pCourse->m_vEntries[i].IsFixedSong() ) if( pCourse->m_vEntries[i].IsFixedSong() )
vSongs.push_back( pCourse->m_vEntries[i].songID.ToSong() ); vSongs.push_back( pCourse->m_vEntries[i].songID.ToSong() );
@@ -73,7 +73,7 @@ void ScreenJukebox::SetSong()
Song* pSong = vSongs[RandomInt(vSongs.size())]; Song* pSong = vSongs[RandomInt(vSongs.size())];
ASSERT( pSong != NULL ); ASSERT( pSong != nullptr );
if( !pSong->HasMusic() ) if( !pSong->HasMusic() )
continue; // skip continue; // skip
if( !pSong->NormallyDisplayed() ) if( !pSong->NormallyDisplayed() )
@@ -152,7 +152,7 @@ void ScreenJukebox::SetSong()
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
{ {
GAMESTATE->m_pCurTrail[p].Set( lCourse->GetTrail( GAMESTATE->GetCurrentStyle()->m_StepsType ) ); GAMESTATE->m_pCurTrail[p].Set( lCourse->GetTrail( GAMESTATE->GetCurrentStyle()->m_StepsType ) );
ASSERT( GAMESTATE->m_pCurTrail[p] != NULL ); ASSERT( GAMESTATE->m_pCurTrail[p] != nullptr );
} }
} }
} }
@@ -172,7 +172,7 @@ ScreenJukebox::ScreenJukebox()
void ScreenJukebox::Init() void ScreenJukebox::Init()
{ {
// ScreenJukeboxMenu must set this // ScreenJukeboxMenu must set this
ASSERT( GAMESTATE->GetCurrentStyle() != NULL ); ASSERT( GAMESTATE->GetCurrentStyle() != nullptr );
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
SetSong(); SetSong();
+3 -3
View File
@@ -770,14 +770,14 @@ void ScreenManager::PopAllScreens()
void ScreenManager::PostMessageToTopScreen( ScreenMessage SM, float fDelay ) void ScreenManager::PostMessageToTopScreen( ScreenMessage SM, float fDelay )
{ {
Screen* pTopScreen = GetTopScreen(); Screen* pTopScreen = GetTopScreen();
if( pTopScreen != NULL ) if( pTopScreen != nullptr )
pTopScreen->PostScreenMessage( SM, fDelay ); pTopScreen->PostScreenMessage( SM, fDelay );
} }
void ScreenManager::SendMessageToTopScreen( ScreenMessage SM ) void ScreenManager::SendMessageToTopScreen( ScreenMessage SM )
{ {
Screen* pTopScreen = GetTopScreen(); Screen* pTopScreen = GetTopScreen();
if( pTopScreen != NULL ) if( pTopScreen != nullptr )
pTopScreen->HandleScreenMessage( SM ); pTopScreen->HandleScreenMessage( SM );
} }
@@ -858,7 +858,7 @@ public:
static int GetTopScreen( T* p, lua_State *L ) static int GetTopScreen( T* p, lua_State *L )
{ {
Actor *pScreen = p->GetTopScreen(); Actor *pScreen = p->GetTopScreen();
if( pScreen != NULL ) if( pScreen != nullptr )
pScreen->PushSelf(L); pScreen->PushSelf(L);
else else
lua_pushnil( L ); lua_pushnil( L );
+1 -1
View File
@@ -59,7 +59,7 @@ void ScreenMiniMenu::Init()
void ScreenMiniMenu::BeginScreen() void ScreenMiniMenu::BeginScreen()
{ {
ASSERT( g_pMenuDef != NULL ); ASSERT( g_pMenuDef != nullptr );
LoadMenu( g_pMenuDef ); LoadMenu( g_pMenuDef );
m_SMSendOnOK = g_SendOnOK; m_SMSendOnOK = g_SendOnOK;
+1 -1
View File
@@ -179,7 +179,7 @@ void ScreenNetRoom::HandleScreenMessage( const ScreenMessage SM )
{ {
int i = m_RoomWheel.GetCurrentIndex() - m_RoomWheel.GetPerminateOffset(); int i = m_RoomWheel.GetCurrentIndex() - m_RoomWheel.GetPerminateOffset();
const RoomWheelItemData* data = m_RoomWheel.GetItem(i); const RoomWheelItemData* data = m_RoomWheel.GetItem(i);
if( data != NULL ) if( data != nullptr )
m_roomInfo.SetRoom( data ); m_roomInfo.SetRoom( data );
} }

Some files were not shown because too many files have changed in this diff Show More