SongManager double shot:
1) Fix issue where course banners were read from cache even when BannerCache wasn't set to full mode. 2) Added GetSongGroupNames() and GetSongsInGroup(sGroupName) Lua bindings.
This commit is contained in:
+24
-33
@@ -338,47 +338,21 @@ void SongManager::LoadGroupSymLinks(RString sDir, RString sGroupFolder)
|
|||||||
|
|
||||||
void SongManager::PreloadSongImages()
|
void SongManager::PreloadSongImages()
|
||||||
{
|
{
|
||||||
bool bSkipBanners = false;
|
|
||||||
//bool bSkipBackgrounds = false;
|
|
||||||
if( PREFSMAN->m_BannerCache != BNCACHE_FULL )
|
if( PREFSMAN->m_BannerCache != BNCACHE_FULL )
|
||||||
bSkipBanners = true;
|
return;
|
||||||
/*
|
|
||||||
if( PREFSMAN->m_BackgroundCache != BNCACHE_FULL )
|
|
||||||
bSkipBackgrounds = true;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Load textures before unloading old ones, so we don't reload textures
|
/* Load textures before unloading old ones, so we don't reload textures
|
||||||
* that we don't need to. */
|
* that we don't need to. */
|
||||||
RageTexturePreloader preload;
|
RageTexturePreloader preload;
|
||||||
|
|
||||||
//if( !bSkipBanners && !bSkipBackgrounds )
|
const vector<Song*> &songs = GetAllSongs();
|
||||||
if( !bSkipBanners )
|
for( unsigned i = 0; i < songs.size(); ++i )
|
||||||
{
|
{
|
||||||
const vector<Song*> &songs = GetAllSongs();
|
if( !songs[i]->HasBanner() )
|
||||||
for( unsigned i = 0; i < songs.size(); ++i )
|
continue;
|
||||||
{
|
|
||||||
// preload banners
|
|
||||||
if( !songs[i]->HasBanner() && !songs[i]->HasBackground() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( !bSkipBanners && songs[i]->HasBanner() )
|
const RageTextureID ID = Sprite::SongBannerTexture( songs[i]->GetBannerPath() );
|
||||||
{
|
preload.Load( ID );
|
||||||
const RageTextureID ID = Sprite::SongBannerTexture( songs[i]->GetBannerPath() );
|
|
||||||
preload.Load( ID );
|
|
||||||
}
|
|
||||||
|
|
||||||
// preload backgrounds
|
|
||||||
/*
|
|
||||||
if( !bSkipBackgrounds && songs[i]->HasBackground() )
|
|
||||||
{
|
|
||||||
if ( !songs[i]->HasBackground() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const RageTextureID IDbg = Sprite::SongBGTexture( songs[i]->GetBackgroundPath() );
|
|
||||||
preload.Load( IDbg );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Course*> courses;
|
vector<Course*> courses;
|
||||||
@@ -1866,6 +1840,21 @@ public:
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static int GetSongGroupNames( T* p, lua_State *L )
|
||||||
|
{
|
||||||
|
vector<RString> v;
|
||||||
|
p->GetSongGroupNames( v );
|
||||||
|
LuaHelpers::CreateTableFromArray<RString>( v, L );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GetSongsInGroup( T* p, lua_State *L )
|
||||||
|
{
|
||||||
|
vector<Song*> v = p->GetSongs(SArg(1));
|
||||||
|
LuaHelpers::CreateTableFromArray<Song*>( v, L );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
DEFINE_METHOD( ShortenGroupName, ShortenGroupName( SArg(1) ) )
|
DEFINE_METHOD( ShortenGroupName, ShortenGroupName( SArg(1) ) )
|
||||||
|
|
||||||
LunaSongManager()
|
LunaSongManager()
|
||||||
@@ -1890,6 +1879,8 @@ public:
|
|||||||
ADD_METHOD( GetSongGroupColor );
|
ADD_METHOD( GetSongGroupColor );
|
||||||
ADD_METHOD( GetCourseColor );
|
ADD_METHOD( GetCourseColor );
|
||||||
//ADD_METHOD( GetSongRank );
|
//ADD_METHOD( GetSongRank );
|
||||||
|
ADD_METHOD( GetSongGroupNames );
|
||||||
|
ADD_METHOD( GetSongsInGroup );
|
||||||
ADD_METHOD( ShortenGroupName );
|
ADD_METHOD( ShortenGroupName );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user