replace SongManager::GetSongFromSteps with use of song pointer
This commit is contained in:
@@ -1243,7 +1243,7 @@ void BMSSongLoader::AddToSong()
|
||||
|
||||
bool BMSLoader::LoadNoteDataFromSimfile( const RString & cachePath, Steps & out )
|
||||
{
|
||||
Song *pSong = SONGMAN->GetSongFromSteps( &out );
|
||||
Song *pSong = out.m_pSong;
|
||||
|
||||
// before doing anything else, load the chart first!
|
||||
BMSChart chart;
|
||||
|
||||
@@ -87,7 +87,7 @@ void ScreenOptionsManageEditSteps::BeginScreen()
|
||||
vHands.push_back( OptionRowHandlerUtil::MakeNull() );
|
||||
OptionRowDefinition &def = vHands.back()->m_Def;
|
||||
|
||||
Song *pSong = SONGMAN->GetSongFromSteps( *s );
|
||||
Song *pSong = (*s)->m_pSong;
|
||||
|
||||
def.m_sName = pSong->GetTranslitFullTitle() + " - " + (*s)->GetDescription();
|
||||
def.m_bAllowThemeTitle = false; // not themable
|
||||
@@ -153,7 +153,7 @@ void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
|
||||
ASSERT( ScreenTextEntry::s_sLastAnswer != "" ); // validate should have assured this
|
||||
|
||||
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
Song *pSong = SONGMAN->GetSongFromSteps( pSteps );
|
||||
Song *pSong = pSteps->m_pSong;
|
||||
|
||||
RString sOldDescription = pSteps->GetDescription();
|
||||
pSteps->SetDescription( ScreenTextEntry::s_sLastAnswer );
|
||||
@@ -190,7 +190,7 @@ void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
|
||||
case StepsEditAction_Edit:
|
||||
{
|
||||
Steps *pSteps = GetStepsWithFocus();
|
||||
Song *pSong = SONGMAN->GetSongFromSteps( pSteps );
|
||||
Song *pSong = pSteps->m_pSong;
|
||||
GAMESTATE->m_pCurSong.Set( pSong );
|
||||
GAMESTATE->m_pCurSteps[PLAYER_1].Set( pSteps );
|
||||
|
||||
@@ -230,7 +230,7 @@ void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
|
||||
void ScreenOptionsManageEditSteps::AfterChangeRow( PlayerNumber pn )
|
||||
{
|
||||
Steps *pSteps = GetStepsWithFocus();
|
||||
Song *pSong = pSteps ? SONGMAN->GetSongFromSteps( pSteps ) : NULL;
|
||||
Song *pSong = pSteps ? pSteps->m_pSong : NULL;
|
||||
|
||||
GAMESTATE->m_pCurSong.Set( pSong );
|
||||
GAMESTATE->m_pCurSteps[PLAYER_1].Set( pSteps );
|
||||
|
||||
+4
-24
@@ -1127,30 +1127,9 @@ void SongManager::GetStepsLoadedFromProfile( vector<Steps*> &AddTo, ProfileSlot
|
||||
}
|
||||
}
|
||||
|
||||
Song *SongManager::GetSongFromSteps( Steps *pSteps ) const
|
||||
{
|
||||
ASSERT( pSteps != NULL );
|
||||
const vector<Song*> &vSongs = GetAllSongs();
|
||||
FOREACH_CONST( Song*, vSongs, song )
|
||||
{
|
||||
vector<Steps*> vSteps;
|
||||
SongUtil::GetSteps( *song, vSteps );
|
||||
|
||||
FOREACH_CONST( Steps*, vSteps, steps )
|
||||
{
|
||||
if( *steps == pSteps )
|
||||
{
|
||||
return *song;
|
||||
}
|
||||
}
|
||||
}
|
||||
FAIL_M("No song found for steps");
|
||||
}
|
||||
|
||||
void SongManager::DeleteSteps( Steps *pSteps )
|
||||
{
|
||||
Song *pSong = GetSongFromSteps( pSteps );
|
||||
pSong->DeleteSteps( pSteps );
|
||||
pSteps->m_pSong->DeleteSteps( pSteps );
|
||||
}
|
||||
|
||||
bool SongManager::WasLoadedFromAdditionalSongs( const Song *pSong ) const
|
||||
@@ -1942,11 +1921,12 @@ public:
|
||||
static int GetNumCourses( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumCourses() ); return 1; }
|
||||
static int GetNumAdditionalCourses( T* p, lua_State *L ){ lua_pushnumber( L, p->GetNumAdditionalCourses() ); return 1; }
|
||||
static int GetNumCourseGroups( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumCourseGroups() ); return 1; }
|
||||
/* Note: this could now be implemented as Luna<Steps>::GetSong */
|
||||
static int GetSongFromSteps( T* p, lua_State *L )
|
||||
{
|
||||
Song *pSong = NULL;
|
||||
if( lua_isnil(L,1) ) { pSong = p->GetSongFromSteps( NULL ); }
|
||||
else { Steps *pSteps = Luna<Steps>::check(L,1); pSong = p->GetSongFromSteps( pSteps ); }
|
||||
if( lua_isnil(L,1) ) { pSong = NULL; }
|
||||
else { Steps *pSteps = Luna<Steps>::check(L,1); pSong = pSteps->m_pSong; }
|
||||
if(pSong) pSong->PushSelf(L);
|
||||
else lua_pushnil(L);
|
||||
return 1;
|
||||
|
||||
@@ -144,7 +144,6 @@ public:
|
||||
int GetSongRank(Song* pSong);
|
||||
|
||||
void GetStepsLoadedFromProfile( vector<Steps*> &AddTo, ProfileSlot slot ) const;
|
||||
Song *GetSongFromSteps( Steps *pSteps ) const;
|
||||
void DeleteSteps( Steps *pSteps ); // transfers ownership of pSteps
|
||||
bool WasLoadedFromAdditionalSongs( const Song *pSong ) const;
|
||||
bool WasLoadedFromAdditionalCourses( const Course *pCourse ) const;
|
||||
|
||||
+1
-1
@@ -795,7 +795,7 @@ static LocalizedString EDIT_NAME_CANNOT_CONTAIN ( "SongUtil", "The edit name can
|
||||
bool SongUtil::ValidateCurrentEditStepsDescription( const RString &sAnswer, RString &sErrorOut )
|
||||
{
|
||||
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
Song *pSong = SONGMAN->GetSongFromSteps( pSteps );
|
||||
Song *pSong = pSteps->m_pSong;
|
||||
|
||||
ASSERT( pSteps->IsAnEdit() );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user