From 143b96d5fab2f743476a67ae1ac1aa5776eab9dc Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 14 Nov 2009 00:57:27 +0000 Subject: [PATCH] Fix ThemeMetric gives the first value of the enum when the theme metric is nil, instead of EnumType_INVALID. This happened because ThemeMetric was setting the value to its default, eg. EnumType(), when LuaHelpers::FromStack returned false. This behavior doesn't make sense in the general case, since EnumType() results in an arbitrary value (the first one) rather than Invalid. Every FromStack function sets a reasonable default on invalid data, anyway, and only RageColor and enums can return false in any case. This fixes CustomDifficulty when CourseType = nil. --- stepmania/src/ThemeMetric.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stepmania/src/ThemeMetric.h b/stepmania/src/ThemeMetric.h index 3b0aad5dba..ccc2ccf9fc 100644 --- a/stepmania/src/ThemeMetric.h +++ b/stepmania/src/ThemeMetric.h @@ -84,8 +84,7 @@ public: Lua *L = LUA->Get(); THEME->GetMetric( m_sGroup, m_sName, m_Value ); m_Value.PushSelf(L); - if( !LuaHelpers::FromStack(L, m_currentValue, -1) ) - m_currentValue = T(); + LuaHelpers::FromStack(L, m_currentValue, -1); lua_pop( L, 1 ); LUA->Release(L);