From f8a942330134fe75cf882165d65d012c1d498dc7 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Tue, 8 Jun 2010 18:16:54 -0500 Subject: [PATCH] 23b02ce: fix BackgroundChange color values being written with commas. Commas are a reserved character that seprate values in a tag. Caret was used to separate RGBA values in a color in this case and NotesLoaderSM already handles that. [Chris Danford] --- src/NotesWriterSM.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/NotesWriterSM.cpp b/src/NotesWriterSM.cpp index 5bab31280e..ee9ef4e321 100644 --- a/src/NotesWriterSM.cpp +++ b/src/NotesWriterSM.cpp @@ -16,6 +16,14 @@ #include "Song.h" #include "Steps.h" +static RString EscapeBackgroundColor( const RString color ) +{ + // Comma separates values in a background change. Caret separates RGBA values in a color value, and NotesLoaderSM switches them to commas on load. + RString c = color; + c.Replace(",", "^"); + return c; +} + static RString BackgroundChangeToString( const BackgroundChange &bgc ) { // TODO: Technically we need to double-escape the filename (because it might contain '=') and then @@ -31,8 +39,8 @@ static RString BackgroundChangeToString( const BackgroundChange &bgc ) bgc.m_def.m_sEffect.c_str(), bgc.m_def.m_sFile2.c_str(), bgc.m_sTransition.c_str(), - SmEscape(bgc.m_def.m_sColor1).c_str(), - SmEscape(bgc.m_def.m_sColor2).c_str() + SmEscape(EscapeBackgroundColor(bgc.m_def.m_sColor1)).c_str(), + SmEscape(EscapeBackgroundColor(bgc.m_def.m_sColor2)).c_str() ); return s; }