Add std:: prefixes to all shuffle calls. Use unique_ptr instead of shared_ptr.

This commit is contained in:
Brian Phlipot
2022-10-03 16:21:19 -07:00
committed by teejusb
parent 95e55f5cdd
commit a0e805e511
7 changed files with 16 additions and 17 deletions
+2 -2
View File
@@ -368,7 +368,7 @@ static void CourseSortSongs( SongSort sort, std::vector<Song*> &vpPossibleSongs,
{
DEFAULT_FAIL(sort);
case SongSort_Randomize:
shuffle( vpPossibleSongs.begin(), vpPossibleSongs.end(), rnd );
std::shuffle( vpPossibleSongs.begin(), vpPossibleSongs.end(), rnd );
break;
case SongSort_MostPlays:
if( PROFILEMAN )
@@ -428,7 +428,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
* will change every time it's viewed, and the displayed order will have no
* bearing on what you'll actually play. */
tmp_entries = m_vEntries;
shuffle( tmp_entries.begin(), tmp_entries.end(), rnd );
std::shuffle( tmp_entries.begin(), tmp_entries.end(), rnd );
}
const std::vector<CourseEntry> &entries = m_bShuffle ? tmp_entries:m_vEntries;
+1 -1
View File
@@ -304,7 +304,7 @@ void CourseUtil::AutogenOniFromArtist( const RString &sArtistName, RString sArti
* song set changes. */
{
RandomGen rng( GetHashForString( sArtistName ) + aSongs.size() );
shuffle( aSongs.begin(), aSongs.end(), rng );
std::shuffle( aSongs.begin(), aSongs.end(), rng );
}
// Only use up to four songs.
+1 -1
View File
@@ -1333,7 +1333,7 @@ void MusicWheel::StartRandom()
{
// Shuffle and use the roulette wheel.
RandomGen rnd;
shuffle( getWheelItemsData(SORT_ROULETTE).begin(), getWheelItemsData(SORT_ROULETTE).end(), rnd );
std::shuffle( getWheelItemsData(SORT_ROULETTE).begin(), getWheelItemsData(SORT_ROULETTE).end(), rnd );
GAMESTATE->m_SortOrder.Set( SORT_ROULETTE );
}
else
+1 -1
View File
@@ -202,7 +202,7 @@ void ScreenOptionsCourseOverview::ProcessMenuStart( const InputEventPlus &input
case CourseOverviewRow_Shuffle:
{
Course *pCourse = GAMESTATE->m_pCurCourse;
shuffle( pCourse->m_vEntries.begin(), pCourse->m_vEntries.end(), g_RandomNumberGenerator );
std::shuffle( pCourse->m_vEntries.begin(), pCourse->m_vEntries.end(), g_RandomNumberGenerator );
Trail *pTrail = pCourse->GetTrailForceRegenCache( GAMESTATE->GetCurrentStyle(input.pn)->m_StepsType );
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
SCREENMAN->PlayStartSound();
+1 -1
View File
@@ -146,7 +146,7 @@ void ScreenOptionsCourseOverview::ProcessMenuStart( const InputEventPlus &input
case ReviewWorkoutRow_Shuffle:
{
Course *pCourse = GAMESTATE->m_pCurCourse;
shuffle( pCourse->m_vEntries.begin(), pCourse->m_vEntries.end(), g_RandomNumberGenerator );
std::shuffle( pCourse->m_vEntries.begin(), pCourse->m_vEntries.end(), g_RandomNumberGenerator );
Trail *pTrail = pCourse->GetTrailForceRegenCache( GAMESTATE->m_pCurStyle->m_StepsType );
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
SCREENMAN->PlayStartSound();
+2 -2
View File
@@ -1585,10 +1585,10 @@ void SongManager::UpdateShuffled()
{
// update shuffled
m_pShuffledSongs = m_pSongs;
shuffle( m_pShuffledSongs.begin(), m_pShuffledSongs.end(), g_RandomNumberGenerator );
std::shuffle( m_pShuffledSongs.begin(), m_pShuffledSongs.end(), g_RandomNumberGenerator );
m_pShuffledCourses = m_pCourses;
shuffle( m_pShuffledCourses.begin(), m_pShuffledCourses.end(), g_RandomNumberGenerator );
std::shuffle( m_pShuffledCourses.begin(), m_pShuffledCourses.end(), g_RandomNumberGenerator );
}
void SongManager::UpdatePreferredSort(RString sPreferredSongs, RString sPreferredCourses)
+8 -9
View File
@@ -103,7 +103,7 @@ struct WinWdmFilter
CloseHandle( m_hHandle );
}
std::shared_ptr<WinWdmPin> CreatePin( unsigned long iPinId, RString &sError );
std::unique_ptr<WinWdmPin> CreatePin( unsigned long iPinId, RString &sError );
WinWdmPin *InstantiateRenderPin(
DeviceSampleFormat &PreferredOutputSampleFormat,
int &iPreferredOutputChannels,
@@ -114,7 +114,7 @@ struct WinWdmFilter
void Release();
HANDLE m_hHandle;
std::vector<std::shared_ptr<WinWdmPin>> m_apPins;
std::vector<std::unique_ptr<WinWdmPin>> m_apPins;
RString m_sFilterName;
RString m_sFriendlyName;
int m_iUsageCount;
@@ -274,7 +274,7 @@ static bool WdmGetPinPropertyMulti(
* The pin object holds all the configuration information about the pin
* before it is opened, and then the handle of the pin after is opened
*/
std::shared_ptr<WinWdmPin> WinWdmFilter::CreatePin( unsigned long iPinId, RString &sError )
std::unique_ptr<WinWdmPin> WinWdmFilter::CreatePin( unsigned long iPinId, RString &sError )
{
{
/* Get the COMMUNICATION property */
@@ -369,7 +369,7 @@ std::shared_ptr<WinWdmPin> WinWdmFilter::CreatePin( unsigned long iPinId, RStrin
}
/* Allocate the new PIN object */
auto pPin = std::make_shared<WinWdmPin>( this, iPinId );
auto pPin = std::make_unique<WinWdmPin>( this, iPinId );
/* Get DATARANGEs */
KSMULTIPLE_ITEM *pDataRangesItem;
@@ -551,7 +551,7 @@ WinWdmFilter *WinWdmFilter::Create( const RString &sFilterName, const RString &s
/* Create the pin with this Id */
auto pNewPin = pFilter->CreatePin( iPinId, sError );
if( pNewPin )
pFilter->m_apPins.push_back( pNewPin );
pFilter->m_apPins.push_back( std::move(pNewPin) );
}
if( pFilter->m_apPins.empty() )
@@ -617,9 +617,8 @@ void WinWdmFilter::Release()
*/
WinWdmPin *WinWdmFilter::InstantiateRenderPin( const WAVEFORMATEX *wfex, RString &sError )
{
for( size_t i = 0; i < m_apPins.size(); ++i )
for (const auto& pPin : m_apPins)
{
auto pPin = m_apPins[i];
if( pPin->Instantiate(wfex, sError) )
{
sError = "";
@@ -715,7 +714,7 @@ WinWdmPin *WinWdmFilter::InstantiateRenderPin(
*/
std::vector<int> aSampleRates;
{
for (auto pPin : m_apPins)
for (const auto& pPin : m_apPins)
{
for (KSDATARANGE_AUDIO const &range : pPin->m_dataRangesItem)
{
@@ -1279,7 +1278,7 @@ RString RageSoundDriver_WDMKS::Init()
const WinWdmFilter *pFilter = apFilters[i];
LOG->Trace( "Device #%i: %s", i, pFilter->m_sFriendlyName.c_str() );
int j = 0;
for (auto pPin : pFilter->m_apPins)
for (const auto& pPin : pFilter->m_apPins)
{
LOG->Trace( " Pin %i", j++ );
for (KSDATARANGE_AUDIO const &range : pPin->m_dataRangesItem)