simplify
This commit is contained in:
@@ -316,7 +316,7 @@ void MusicWheel::GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CStrin
|
|||||||
continue;
|
continue;
|
||||||
if( so==SORT_ROULETTE && !pSong->RouletteDisplayed() )
|
if( so==SORT_ROULETTE && !pSong->RouletteDisplayed() )
|
||||||
continue;
|
continue;
|
||||||
if( so==SORT_ROULETTE && GAMESTATE->m_pUnlockingSys->SongIsRoulette( pSong->GetFullTranslitTitle() ) )
|
if( so==SORT_ROULETTE && GAMESTATE->m_pUnlockingSys->SongIsRoulette( pSong ) )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ void MusicWheel::GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CStrin
|
|||||||
// If we're using unlocks, check it here to prevent from being shown
|
// If we're using unlocks, check it here to prevent from being shown
|
||||||
if( PREFSMAN->m_bUseUnlockSystem )
|
if( PREFSMAN->m_bUseUnlockSystem )
|
||||||
{
|
{
|
||||||
pSong->m_bIsLocked = GAMESTATE->m_pUnlockingSys->SongIsLocked( pSong->GetFullTranslitTitle() );
|
pSong->m_bIsLocked = GAMESTATE->m_pUnlockingSys->SongIsLocked( pSong );
|
||||||
if( pSong->m_bIsLocked ) { continue; }
|
if( pSong->m_bIsLocked ) { continue; }
|
||||||
}
|
}
|
||||||
arraySongs.push_back( pSong );
|
arraySongs.push_back( pSong );
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "UnlockSystem.h"
|
#include "UnlockSystem.h"
|
||||||
|
#include "SongManager.h"
|
||||||
|
|
||||||
ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
|
ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
|
||||||
{
|
{
|
||||||
@@ -33,8 +34,11 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
|
|||||||
Unlocks[i].SetName( ssprintf("Unlock%d",i) );
|
Unlocks[i].SetName( ssprintf("Unlock%d",i) );
|
||||||
SET_XY( Unlocks[i] );
|
SET_XY( Unlocks[i] );
|
||||||
|
|
||||||
const bool SongIsLocked = GAMESTATE->m_pUnlockingSys->SongIsLocked
|
Song *pSong = SONGMAN->FindSong("", THEME->GetMetric("ScreenUnlock", ssprintf("Unlock%dSong", i)) );
|
||||||
(THEME->GetMetric("ScreenUnlock", ssprintf("Unlock%dSong", i)));
|
if( pSong == NULL )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const bool SongIsLocked = GAMESTATE->m_pUnlockingSys->SongIsLocked( pSong );
|
||||||
if ( !SongIsLocked )
|
if ( !SongIsLocked )
|
||||||
this->AddChild(&Unlocks[i]);
|
this->AddChild(&Unlocks[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
#include "Song.h"
|
||||||
#include "RageException.h"
|
#include "RageException.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "UnlockSystem.h"
|
#include "UnlockSystem.h"
|
||||||
@@ -27,6 +28,16 @@ UnlockSystem::UnlockSystem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool UnlockSystem::SongIsLocked( const Song *song )
|
||||||
|
{
|
||||||
|
return SongIsLocked( song->GetFullTranslitTitle() );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UnlockSystem::SongIsRoulette( const Song *song )
|
||||||
|
{
|
||||||
|
return SongIsRoulette( song->GetFullTranslitTitle() );
|
||||||
|
}
|
||||||
|
|
||||||
bool UnlockSystem::SongIsLocked( CString sSongName )
|
bool UnlockSystem::SongIsLocked( CString sSongName )
|
||||||
{
|
{
|
||||||
sSongName.MakeUpper(); //Avoid case-sensitive problems
|
sSongName.MakeUpper(); //Avoid case-sensitive problems
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ enum UnlockTypes { UNLOCK_AP, UNLOCK_DP, UNLOCK_SP,
|
|||||||
UNLOCK_EC, UNLOCK_EF, UNLOCK_SC,
|
UNLOCK_EC, UNLOCK_EF, UNLOCK_SC,
|
||||||
UNLOCK_TT, UNLOCK_RO};
|
UNLOCK_TT, UNLOCK_RO};
|
||||||
|
|
||||||
|
class Song;
|
||||||
|
|
||||||
struct SongEntry
|
struct SongEntry
|
||||||
{
|
{
|
||||||
CString m_sSongName; /* Name of the song in the DWI/SM file itself.. This allows
|
CString m_sSongName; /* Name of the song in the DWI/SM file itself.. This allows
|
||||||
@@ -50,8 +52,8 @@ class UnlockSystem
|
|||||||
public:
|
public:
|
||||||
UnlockSystem();
|
UnlockSystem();
|
||||||
float NumPointsUntilNextUnlock();
|
float NumPointsUntilNextUnlock();
|
||||||
bool SongIsLocked( CString sSongName );
|
bool SongIsLocked( const Song *song );
|
||||||
bool SongIsRoulette( CString sSongName );
|
bool SongIsRoulette( const Song *song );
|
||||||
bool LoadFromDATFile( CString sPath );
|
bool LoadFromDATFile( CString sPath );
|
||||||
vector<SongEntry> m_SongEntries; // All locked songs are stored here
|
vector<SongEntry> m_SongEntries; // All locked songs are stored here
|
||||||
|
|
||||||
@@ -68,6 +70,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
void SortSongEntriesArray(); // sorts unlocks
|
void SortSongEntriesArray(); // sorts unlocks
|
||||||
bool ParseRow(CString text, CString &type, float &qty, CString &songname);
|
bool ParseRow(CString text, CString &type, float &qty, CString &songname);
|
||||||
|
bool SongIsLocked( CString sSongName );
|
||||||
|
bool SongIsRoulette( CString sSongName );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user