From 125738084006cd990401a4325a7047c702e0ce66 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 18 Nov 2003 04:06:39 +0000 Subject: [PATCH] use RageColor::FromString --- stepmania/src/ThemeManager.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 17526240b5..ab4c1182f4 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -478,23 +478,10 @@ bool ThemeManager::GetMetricB( CString sClassName, CString sValueName ) RageColor ThemeManager::GetMetricC( CString sClassName, CString sValueName ) { - float r=1,b=1,g=1,a=1; - CString sValue = GetMetricRaw(sClassName,sValueName); - int result = sscanf( GetMetricRaw(sClassName,sValueName), "%f,%f,%f,%f", &r, &g, &b, &a ); - if( result == 4 ) - return RageColor(r,g,b,a); - - int ir=255,ib=255,ig=255,ia=255; - result = sscanf( GetMetricRaw(sClassName,sValueName), "#%2x%2x%2x%2x", &ir, &ig, &ib, &ia ); - if( result == 4 ) - return RageColor(ir / 255.0f, ig / 255.0f, ib / 255.0f, ia / 255.0f); - - result = sscanf( GetMetricRaw(sClassName,sValueName), "#%2x%2x%2x", &ir, &ig, &ib ); - if( result == 3 ) - return RageColor(ir / 255.0f, ig / 255.0f, ib / 255.0f, 1); - - LOG->Warn( "The color value '%s' for NoteSkin metric '%s : %s' is invalid.", GetMetricRaw(sClassName,sValueName).c_str(), sClassName.c_str(), sValueName.c_str() ); - return RageColor(1,1,1,1); + RageColor ret(1,1,1,1); + if( !ret.FromString( GetMetricRaw(sClassName,sValueName) ) ) + LOG->Warn( "The color value '%s' for NoteSkin metric '%s : %s' is invalid.", GetMetricRaw(sClassName,sValueName).c_str(), sClassName.c_str(), sValueName.c_str() ); + return ret; } void ThemeManager::NextTheme()