From 394982b4617c3bc64fde4525a13ff4a4ebbf8bb4 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 6 Dec 2004 06:41:31 +0000 Subject: [PATCH] fix "0 // foo" -> true --- stepmania/src/ThemeManager.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index f0988e26ba..505e86d4fa 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -685,9 +685,15 @@ float ThemeManager::GetMetricF( const CString &sClassName, const CString &sValue bool ThemeManager::GetMetricB( const CString &sClassName, const CString &sValueName ) { CString sValue = GetMetricRaw( sClassName,sValueName ); - if( sValue == "0" ) + + /* Watch out: "0" and "1" are not false and true in Lua (all string values are + * true). Make sure that we catch all values that are supposed to be simple + * booleans. */ + TrimLeft( sValue ); + TrimRight( sValue ); + if( sValue.Left(1) == "0" ) return false; /* optimization */ - if( sValue == "1" ) + if( sValue.Left(1) == "1" ) return true; /* optimization */ Lua::PrepareExpression( sValue );