ignore locked and tutorial songs when choosing songs for random CourseEntries
This commit is contained in:
@@ -92,6 +92,11 @@ void SaveCatalogXml()
|
|||||||
{
|
{
|
||||||
Course* pCourse = vpCourses[i];
|
Course* pCourse = vpCourses[i];
|
||||||
|
|
||||||
|
// skip non-fixed courses. We don't have any stable data for them other than
|
||||||
|
// the title.
|
||||||
|
if( !pCourse->IsFixed() )
|
||||||
|
continue;
|
||||||
|
|
||||||
CourseID courseID;
|
CourseID courseID;
|
||||||
courseID.FromCourse( pCourse );
|
courseID.FromCourse( pCourse );
|
||||||
|
|
||||||
|
|||||||
+39
-17
@@ -19,7 +19,7 @@
|
|||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "ProfileManager.h"
|
#include "ProfileManager.h"
|
||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
|
#include "UnlockManager.h"
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
/* Amount to increase meter ranges to make them difficult: */
|
/* Amount to increase meter ranges to make them difficult: */
|
||||||
@@ -74,8 +74,10 @@ void Course::LoadFromCRSFile( CString sPath )
|
|||||||
sPath = sCacheFile.c_str();
|
sPath = sCacheFile.c_str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
LOG->Trace( "Course::LoadFromCRSFile(\"%s\")", sPath.c_str() );
|
LOG->Trace( "Course::LoadFromCRSFile(\"%s\")", sPath.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
MsdFile msd;
|
MsdFile msd;
|
||||||
if( !msd.ReadFile(sPath) )
|
if( !msd.ReadFile(sPath) )
|
||||||
RageException::Throw( "Error opening CRS file '%s'.", sPath.c_str() );
|
RageException::Throw( "Error opening CRS file '%s'.", sPath.c_str() );
|
||||||
@@ -298,18 +300,7 @@ void Course::LoadFromCRSFile( CString sPath )
|
|||||||
* don't have to do it at runtime. */
|
* don't have to do it at runtime. */
|
||||||
if( !bUseCache )
|
if( !bUseCache )
|
||||||
{
|
{
|
||||||
FOREACH_StepsType( st )
|
CalculateRadarValues();
|
||||||
{
|
|
||||||
FOREACH_CourseDifficulty( cd )
|
|
||||||
{
|
|
||||||
Trail *pTrail = GetTrail( st, cd );
|
|
||||||
if( pTrail == NULL )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
RadarValues rv = pTrail->GetRadarValues();
|
|
||||||
m_RadarCache[CacheEntry(st, cd)] = rv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we have any cache data, write the cache file. */
|
/* If we have any cache data, write the cache file. */
|
||||||
if( m_RadarCache.size() )
|
if( m_RadarCache.size() )
|
||||||
@@ -871,9 +862,17 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
|
|||||||
ASSERT( pSong );
|
ASSERT( pSong );
|
||||||
CurSong = (CurSong+1) % AllSongsShuffled.size();
|
CurSong = (CurSong+1) % AllSongsShuffled.size();
|
||||||
|
|
||||||
if(e.type == COURSE_ENTRY_RANDOM_WITHIN_GROUP &&
|
// Ignore locked songs when choosing randomly
|
||||||
pSong->m_sGroupName.CompareNoCase(e.group_name))
|
if( UNLOCKMAN->SongIsLocked(pSong) )
|
||||||
continue; /* wrong group */
|
continue;
|
||||||
|
|
||||||
|
// Ignore boring tutorial songs
|
||||||
|
if( pSong->IsTutorial() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( e.type == COURSE_ENTRY_RANDOM_WITHIN_GROUP &&
|
||||||
|
pSong->m_sGroupName.CompareNoCase(e.group_name))
|
||||||
|
continue; /* wrong group */
|
||||||
|
|
||||||
if( e.difficulty == DIFFICULTY_INVALID )
|
if( e.difficulty == DIFFICULTY_INVALID )
|
||||||
pSteps = pSong->GetStepsByMeter( st, low_meter, high_meter );
|
pSteps = pSong->GetStepsByMeter( st, low_meter, high_meter );
|
||||||
@@ -1254,6 +1253,29 @@ bool Course::ShowInDemonstrationAndRanking() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Course::CalculateRadarValues()
|
||||||
|
{
|
||||||
|
FOREACH_StepsType( st )
|
||||||
|
{
|
||||||
|
FOREACH_CourseDifficulty( cd )
|
||||||
|
{
|
||||||
|
// For courses that aren't fixed, the radar values are meaningless.
|
||||||
|
// Makes non-fixed courses have unknown radar values.
|
||||||
|
if( IsFixed() )
|
||||||
|
{
|
||||||
|
Trail *pTrail = GetTrail( st, cd );
|
||||||
|
if( pTrail == NULL )
|
||||||
|
continue;
|
||||||
|
RadarValues rv = pTrail->GetRadarValues();
|
||||||
|
m_RadarCache[CacheEntry(st, cd)] = rv;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_RadarCache[CacheEntry(st, cd)] = RadarValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// lua start
|
// lua start
|
||||||
#include "LuaBinding.h"
|
#include "LuaBinding.h"
|
||||||
|
|||||||
@@ -161,6 +161,8 @@ public:
|
|||||||
void PushSelf( lua_State *L );
|
void PushSelf( lua_State *L );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void CalculateRadarValues();
|
||||||
|
|
||||||
bool GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const;
|
bool GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const;
|
||||||
bool GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const;
|
bool GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user