Rewrite BG/FG changes parsing (#1916)

* Handle commas and equals in BG/FG change tags

Rewrote parsing of BGCHANGES and FGCHANGES tags to be able to
handle people putting commas and equals in the filenames. For the
value positions which can be filenames, check to see if we can
recognize any filename from the song directory followed by a comma,
equal, or end of string. If we can, use that. If not, just treat it
the same as before, looking for the next comma or equal.
This commit is contained in:
Tracy Ward
2019-10-12 11:41:39 -04:00
committed by GitHub
parent fd92cc2ed8
commit 04f7a8c466
4 changed files with 192 additions and 27 deletions
+5 -5
View File
@@ -344,14 +344,14 @@ bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
else if( sValueName=="FGCHANGES" )
{
vector<RString> aFGChangeExpressions;
split( sParams[1], ",", aFGChangeExpressions );
std::vector<std::vector<RString> > aFGChanges;
ParseBGChangesString(sParams[1], aFGChanges, out.GetSongDir());
for( unsigned b=0; b<aFGChangeExpressions.size(); b++ )
for (const auto &b : aFGChanges)
{
BackgroundChange change;
if( LoadFromBGChangesString( change, aFGChangeExpressions[b] ) )
out.AddForegroundChange( change );
if (LoadFromBGChangesVector(change, b))
out.AddForegroundChange(change);
}
}