Integrate C++11 branch into 5_1-new
This commit is contained in:
+43
-43
@@ -70,7 +70,7 @@ typedef void (*song_tag_func_t)(SongTagInfo& info);
|
||||
/****************************************************************/
|
||||
void SetVersion(SongTagInfo& info)
|
||||
{
|
||||
info.song->m_fVersion = StringToFloat((*info.params)[1]);
|
||||
info.song->m_fVersion = std::stof((*info.params)[1]);
|
||||
}
|
||||
void SetTitle(SongTagInfo& info)
|
||||
{
|
||||
@@ -157,11 +157,11 @@ void SetInstrumentTrack(SongTagInfo& info)
|
||||
void SetMusicLength(SongTagInfo& info)
|
||||
{
|
||||
if(info.from_cache)
|
||||
info.song->m_fMusicLengthSeconds = StringToFloat((*info.params)[1]);
|
||||
info.song->m_fMusicLengthSeconds = std::stof((*info.params)[1]);
|
||||
}
|
||||
void SetLastSecondHint(SongTagInfo& info)
|
||||
{
|
||||
info.song->SetSpecifiedLastSecond(StringToFloat((*info.params)[1]));
|
||||
info.song->SetSpecifiedLastSecond(std::stof((*info.params)[1]));
|
||||
}
|
||||
void SetSampleStart(SongTagInfo& info)
|
||||
{
|
||||
@@ -179,11 +179,11 @@ void SetDisplayBPM(SongTagInfo& info)
|
||||
else
|
||||
{
|
||||
info.song->m_DisplayBPMType = DISPLAY_BPM_SPECIFIED;
|
||||
info.song->m_fSpecifiedBPMMin = StringToFloat((*info.params)[1]);
|
||||
info.song->m_fSpecifiedBPMMin = std::stof((*info.params)[1]);
|
||||
if((*info.params)[2].empty())
|
||||
{ info.song->m_fSpecifiedBPMMax = info.song->m_fSpecifiedBPMMin; }
|
||||
else
|
||||
{ info.song->m_fSpecifiedBPMMax = StringToFloat((*info.params)[2]); }
|
||||
{ info.song->m_fSpecifiedBPMMax = std::stof((*info.params)[2]); }
|
||||
}
|
||||
}
|
||||
void SetSelectable(SongTagInfo& info)
|
||||
@@ -199,7 +199,7 @@ void SetSelectable(SongTagInfo& info)
|
||||
* used 3.9+ features are not excluded here */
|
||||
else if((*info.params)[1].EqualsNoCase("ES") || (*info.params)[1].EqualsNoCase("OMES"))
|
||||
{ info.song->m_SelectionDisplay = info.song->SHOW_ALWAYS; }
|
||||
else if(StringToInt((*info.params)[1]) > 0)
|
||||
else if(std::stoi((*info.params)[1]) > 0)
|
||||
{ info.song->m_SelectionDisplay = info.song->SHOW_ALWAYS; }
|
||||
else
|
||||
{ LOG->UserLog("Song file", info.path, "has an unknown #SELECTABLE value, \"%s\"; ignored.", (*info.params)[1].c_str()); }
|
||||
@@ -234,7 +234,7 @@ void SetAttacks(SongTagInfo& info)
|
||||
}
|
||||
void SetOffset(SongTagInfo& info)
|
||||
{
|
||||
info.song->m_SongTiming.m_fBeat0OffsetInSeconds = StringToFloat((*info.params)[1]);
|
||||
info.song->m_SongTiming.m_fBeat0OffsetInSeconds = std::stof((*info.params)[1]);
|
||||
}
|
||||
void SetSongStops(SongTagInfo& info)
|
||||
{
|
||||
@@ -283,12 +283,12 @@ void SetSongFakes(SongTagInfo& info)
|
||||
void SetFirstSecond(SongTagInfo& info)
|
||||
{
|
||||
if(info.from_cache)
|
||||
{ info.song->SetFirstSecond(StringToFloat((*info.params)[1])); }
|
||||
{ info.song->SetFirstSecond(std::stof((*info.params)[1])); }
|
||||
}
|
||||
void SetLastSecond(SongTagInfo& info)
|
||||
{
|
||||
if(info.from_cache)
|
||||
{ info.song->SetLastSecond(StringToFloat((*info.params)[1])); }
|
||||
{ info.song->SetLastSecond(std::stof((*info.params)[1])); }
|
||||
}
|
||||
void SetSongFilename(SongTagInfo& info)
|
||||
{
|
||||
@@ -298,19 +298,19 @@ void SetSongFilename(SongTagInfo& info)
|
||||
void SetHasMusic(SongTagInfo& info)
|
||||
{
|
||||
if(info.from_cache)
|
||||
{ info.song->m_bHasMusic = StringToInt((*info.params)[1]) != 0; }
|
||||
{ info.song->m_bHasMusic = std::stoi((*info.params)[1]) != 0; }
|
||||
}
|
||||
void SetHasBanner(SongTagInfo& info)
|
||||
{
|
||||
if(info.from_cache)
|
||||
{ info.song->m_bHasBanner = StringToInt((*info.params)[1]) != 0; }
|
||||
{ info.song->m_bHasBanner = std::stoi((*info.params)[1]) != 0; }
|
||||
}
|
||||
|
||||
// Functions for steps tags go below this line. -Kyz
|
||||
/****************************************************************/
|
||||
void SetStepsVersion(StepsTagInfo& info)
|
||||
{
|
||||
info.song->m_fVersion = StringToFloat((*info.params)[1]);
|
||||
info.song->m_fVersion = std::stof((*info.params)[1]);
|
||||
}
|
||||
void SetChartName(StepsTagInfo& info)
|
||||
{
|
||||
@@ -350,7 +350,7 @@ void SetDifficulty(StepsTagInfo& info)
|
||||
}
|
||||
void SetMeter(StepsTagInfo& info)
|
||||
{
|
||||
info.steps->SetMeter(StringToInt((*info.params)[1]));
|
||||
info.steps->SetMeter(std::stoi((*info.params)[1]));
|
||||
info.ssc_format= true;
|
||||
}
|
||||
void SetRadarValues(StepsTagInfo& info)
|
||||
@@ -368,7 +368,7 @@ void SetRadarValues(StepsTagInfo& info)
|
||||
{
|
||||
for(size_t i= 0; i < cats_per_player; ++i)
|
||||
{
|
||||
v[pn][i]= StringToFloat(values[pn * cats_per_player + i]);
|
||||
v[pn][i]= std::stof(values[pn * cats_per_player + i]);
|
||||
}
|
||||
}
|
||||
info.steps->SetCachedRadarValues(v);
|
||||
@@ -499,7 +499,7 @@ void SetStepsOffset(StepsTagInfo& info)
|
||||
{
|
||||
if(info.song->m_fVersion >= VERSION_SPLIT_TIMING || info.for_load_edit)
|
||||
{
|
||||
info.timing->m_fBeat0OffsetInSeconds = StringToFloat((*info.params)[1]);
|
||||
info.timing->m_fBeat0OffsetInSeconds = std::stof((*info.params)[1]);
|
||||
info.has_own_timing = true;
|
||||
}
|
||||
}
|
||||
@@ -511,12 +511,12 @@ void SetStepsDisplayBPM(StepsTagInfo& info)
|
||||
else
|
||||
{
|
||||
info.steps->SetDisplayBPM(DISPLAY_BPM_SPECIFIED);
|
||||
float min = StringToFloat((*info.params)[1]);
|
||||
float min = std::stof((*info.params)[1]);
|
||||
info.steps->SetMinBPM(min);
|
||||
if((*info.params)[2].empty())
|
||||
{ info.steps->SetMaxBPM(min); }
|
||||
else
|
||||
{ info.steps->SetMaxBPM(StringToFloat((*info.params)[2])); }
|
||||
{ info.steps->SetMaxBPM(std::stof((*info.params)[2])); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,8 +659,8 @@ void SSCLoader::ProcessBPMs( TimingData &out, const RString sParam )
|
||||
continue;
|
||||
}
|
||||
|
||||
const float fBeat = StringToFloat( arrayBPMValues[0] );
|
||||
const float fNewBPM = StringToFloat( arrayBPMValues[1] );
|
||||
const float fBeat = std::stof( arrayBPMValues[0] );
|
||||
const float fNewBPM = std::stof( arrayBPMValues[1] );
|
||||
if( fBeat >= 0 && fNewBPM > 0 )
|
||||
{
|
||||
out.AddSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) );
|
||||
@@ -693,8 +693,8 @@ void SSCLoader::ProcessStops( TimingData &out, const RString sParam )
|
||||
continue;
|
||||
}
|
||||
|
||||
const float fBeat = StringToFloat( arrayStopValues[0] );
|
||||
const float fNewStop = StringToFloat( arrayStopValues[1] );
|
||||
const float fBeat = std::stof( arrayStopValues[0] );
|
||||
const float fNewStop = std::stof( arrayStopValues[1] );
|
||||
if( fBeat >= 0 && fNewStop > 0 )
|
||||
out.AddSegment( StopSegment(BeatToNoteRow(fBeat), fNewStop) );
|
||||
else
|
||||
@@ -725,8 +725,8 @@ void SSCLoader::ProcessWarps( TimingData &out, const RString sParam, const float
|
||||
continue;
|
||||
}
|
||||
|
||||
const float fBeat = StringToFloat( arrayWarpValues[0] );
|
||||
const float fNewBeat = StringToFloat( arrayWarpValues[1] );
|
||||
const float fBeat = std::stof( arrayWarpValues[0] );
|
||||
const float fNewBeat = std::stof( arrayWarpValues[1] );
|
||||
// Early versions were absolute in beats. They should be relative.
|
||||
if( ( fVersion < VERSION_SPLIT_TIMING && fNewBeat > fBeat ) )
|
||||
{
|
||||
@@ -762,7 +762,7 @@ void SSCLoader::ProcessLabels( TimingData &out, const RString sParam )
|
||||
continue;
|
||||
}
|
||||
|
||||
const float fBeat = StringToFloat( arrayLabelValues[0] );
|
||||
const float fBeat = std::stof( arrayLabelValues[0] );
|
||||
RString sLabel = arrayLabelValues[1];
|
||||
TrimRight(sLabel);
|
||||
if( fBeat >= 0.0f )
|
||||
@@ -796,9 +796,9 @@ void SSCLoader::ProcessCombos( TimingData &out, const RString line, const int ro
|
||||
arrayComboExpressions[f].c_str() );
|
||||
continue;
|
||||
}
|
||||
const float fComboBeat = StringToFloat( arrayComboValues[0] );
|
||||
const int iCombos = StringToInt( arrayComboValues[1] );
|
||||
const int iMisses = (size == 2 ? iCombos : StringToInt(arrayComboValues[2]));
|
||||
const float fComboBeat = std::stof( arrayComboValues[0] );
|
||||
const int iCombos = std::stoi( arrayComboValues[1] );
|
||||
const int iMisses = (size == 2 ? iCombos : std::stoi(arrayComboValues[2]));
|
||||
out.AddSegment( ComboSegment( BeatToNoteRow(fComboBeat), iCombos, iMisses ) );
|
||||
}
|
||||
}
|
||||
@@ -808,10 +808,10 @@ void SSCLoader::ProcessScrolls( TimingData &out, const RString sParam )
|
||||
vector<RString> vs1;
|
||||
split( sParam, ",", vs1 );
|
||||
|
||||
FOREACH_CONST( RString, vs1, s1 )
|
||||
for (RString const &s1 : vs1)
|
||||
{
|
||||
vector<RString> vs2;
|
||||
split( *s1, "=", vs2 );
|
||||
split( s1, "=", vs2 );
|
||||
|
||||
if( vs2.size() < 2 )
|
||||
{
|
||||
@@ -822,8 +822,8 @@ void SSCLoader::ProcessScrolls( TimingData &out, const RString sParam )
|
||||
continue;
|
||||
}
|
||||
|
||||
const float fBeat = StringToFloat( vs2[0] );
|
||||
const float fRatio = StringToFloat( vs2[1] );
|
||||
const float fBeat = std::stof( vs2[0] );
|
||||
const float fRatio = std::stof( vs2[1] );
|
||||
|
||||
if( fBeat < 0 )
|
||||
{
|
||||
@@ -875,7 +875,7 @@ bool SSCLoader::LoadNoteDataFromSimfile( const RString & cachePath, Steps &out )
|
||||
case LNDID_version:
|
||||
// Note that version is in both switches. Formerly, it was
|
||||
// checked before the tryingSteps condition. -Kyz
|
||||
storedVersion = StringToFloat(matcher);
|
||||
storedVersion = std::stof(matcher);
|
||||
break;
|
||||
case LNDID_stepstype:
|
||||
if(out.m_StepsType != GAMEMAN->StringToStepsType(matcher))
|
||||
@@ -905,7 +905,7 @@ bool SSCLoader::LoadNoteDataFromSimfile( const RString & cachePath, Steps &out )
|
||||
{ tryingSteps = false; }
|
||||
break;
|
||||
case LNDID_meter:
|
||||
if(out.GetMeter() != StringToInt(matcher))
|
||||
if(out.GetMeter() != std::stoi(matcher))
|
||||
{ tryingSteps = false; }
|
||||
break;
|
||||
case LNDID_credit:
|
||||
@@ -928,7 +928,7 @@ bool SSCLoader::LoadNoteDataFromSimfile( const RString & cachePath, Steps &out )
|
||||
case LNDID_version:
|
||||
// Note that version is in both switches. Formerly, it was
|
||||
// checked before the tryingSteps condition. -Kyz
|
||||
storedVersion = StringToFloat(matcher);
|
||||
storedVersion = std::stof(matcher);
|
||||
break;
|
||||
case LNDID_notedata:
|
||||
tryingSteps = true;
|
||||
@@ -962,7 +962,7 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
|
||||
|
||||
int state = GETTING_SONG_INFO;
|
||||
const unsigned values = msd.GetNumValues();
|
||||
Steps* pNewNotes = NULL;
|
||||
Steps* pNewNotes = nullptr;
|
||||
TimingData stepsTiming;
|
||||
|
||||
SongTagInfo reused_song_info(&*this, &out, sPath, bFromCache);
|
||||
@@ -1047,7 +1047,7 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SSCLoader::LoadEditFromFile( RString sEditFilePath, ProfileSlot slot, bool bAddStepsToSong, Song *givenSong /* =NULL */ )
|
||||
bool SSCLoader::LoadEditFromFile( RString sEditFilePath, ProfileSlot slot, bool bAddStepsToSong, Song *givenSong /* = nullptr */ )
|
||||
{
|
||||
LOG->Trace( "SSCLoader::LoadEditFromFile(%s)", sEditFilePath.c_str() );
|
||||
|
||||
@@ -1076,10 +1076,10 @@ bool SSCLoader::LoadEditFromMsd(const MsdFile &msd,
|
||||
const RString &sEditFilePath,
|
||||
ProfileSlot slot,
|
||||
bool bAddStepsToSong,
|
||||
Song *givenSong /* =NULL */ )
|
||||
Song *givenSong /* = nullptr */ )
|
||||
{
|
||||
Song* pSong = givenSong;
|
||||
Steps* pNewNotes = NULL;
|
||||
Steps* pNewNotes = nullptr;
|
||||
TimingData stepsTiming;
|
||||
|
||||
StepsTagInfo reused_steps_info(&*this, pSong, sEditFilePath, false);
|
||||
@@ -1093,12 +1093,12 @@ bool SSCLoader::LoadEditFromMsd(const MsdFile &msd,
|
||||
RString sValueName = sParams[0];
|
||||
sValueName.MakeUpper();
|
||||
|
||||
if(pSong != NULL)
|
||||
if(pSong != nullptr)
|
||||
{
|
||||
reused_steps_info.params= &sParams;
|
||||
steps_handler_map_t::iterator handler=
|
||||
parser_helper.steps_tag_handlers.find(sValueName);
|
||||
if(pNewNotes != NULL && handler != parser_helper.steps_tag_handlers.end())
|
||||
if(pNewNotes != nullptr && handler != parser_helper.steps_tag_handlers.end())
|
||||
{
|
||||
handler->second(reused_steps_info);
|
||||
}
|
||||
@@ -1110,7 +1110,7 @@ bool SSCLoader::LoadEditFromMsd(const MsdFile &msd,
|
||||
}
|
||||
else if(sValueName=="NOTES")
|
||||
{
|
||||
if(pSong == NULL)
|
||||
if(pSong == nullptr)
|
||||
{
|
||||
LOG->UserLog("Edit file", sEditFilePath,
|
||||
"doesn't have a #SONG tag preceeding the first #NOTES tag,"
|
||||
@@ -1137,7 +1137,7 @@ bool SSCLoader::LoadEditFromMsd(const MsdFile &msd,
|
||||
// Force the difficulty to edit in case the edit set its own
|
||||
// difficulty because IsEditAlreadyLoaded has an assert and edits
|
||||
// shouldn't be able to add charts of other difficulties. -Kyz
|
||||
if(pNewNotes != NULL)
|
||||
if(pNewNotes != nullptr)
|
||||
{
|
||||
pNewNotes->SetDifficulty(Difficulty_Edit);
|
||||
if(pSong->IsEditAlreadyLoaded(pNewNotes))
|
||||
@@ -1197,7 +1197,7 @@ bool SSCLoader::LoadEditFromMsd(const MsdFile &msd,
|
||||
sSongFullTitle.Replace('\\', '/');
|
||||
pSong = SONGMAN->FindSong(sSongFullTitle);
|
||||
reused_steps_info.song= pSong;
|
||||
if(pSong == NULL)
|
||||
if(pSong == nullptr)
|
||||
{
|
||||
LOG->UserLog("Edit file", sEditFilePath,
|
||||
"requires a song \"%s\" that isn't present.",
|
||||
|
||||
Reference in New Issue
Block a user