Fix std::stoi bad behaviour closes #2130

Patched with outfox upstream, this restores BG as it is expected
This commit is contained in:
Crystal Squirrel
2021-08-14 21:29:48 +01:00
parent 6bd6963406
commit 5d4a6cf903
+3 -3
View File
@@ -976,7 +976,7 @@ bool SMLoader::LoadFromBGChangesVector( BackgroundChange &change, std::vector<RS
// Backward compatibility:
if( change.m_def.m_sEffect.empty() )
{
bool bLoop = std::stoi( aBGChangeValues[5] ) != 0;
bool bLoop = StringToInt( aBGChangeValues[5] ) != 0;
if( !bLoop )
change.m_def.m_sEffect = SBE_StretchNoLoop;
}
@@ -986,7 +986,7 @@ bool SMLoader::LoadFromBGChangesVector( BackgroundChange &change, std::vector<RS
// Backward compatibility:
if( change.m_def.m_sEffect.empty() )
{
bool bRewindMovie = std::stoi( aBGChangeValues[4] ) != 0;
bool bRewindMovie = StringToInt( aBGChangeValues[4] ) != 0;
if( bRewindMovie )
change.m_def.m_sEffect = SBE_StretchRewind;
}
@@ -995,7 +995,7 @@ bool SMLoader::LoadFromBGChangesVector( BackgroundChange &change, std::vector<RS
// param 9 overrides this.
// Backward compatibility:
if( change.m_sTransition.empty() )
change.m_sTransition = (std::stoi( aBGChangeValues[3] ) != 0) ? "CrossFade" : "";
change.m_sTransition = (StringToInt( aBGChangeValues[3] ) != 0) ? "CrossFade" : "";
// fall through
case 3:
change.m_fRate = StringToFloat( aBGChangeValues[2] );