From a5289ddacae105cd5ea63af5a8a732e159fbddc3 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Wed, 29 Oct 2014 17:43:37 -0600 Subject: [PATCH] Fixed broken else-if chain in Actor::SetEffectClockString. Changed error to not crash Stepmania. --- src/Actor.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Actor.cpp b/src/Actor.cpp index 3d8e8b9694..0e487dcd9a 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -889,7 +889,7 @@ void Actor::ScaleTo( const RectF &rect, StretchType st ) void Actor::SetEffectClockString( const RString &s ) { if (s.EqualsNoCase("timer")) this->SetEffectClock( CLOCK_TIMER ); - if (s.EqualsNoCase("timerglobal")) this->SetEffectClock( CLOCK_TIMER_GLOBAL ); + else if(s.EqualsNoCase("timerglobal")) this->SetEffectClock( CLOCK_TIMER_GLOBAL ); else if(s.EqualsNoCase("beat")) this->SetEffectClock( CLOCK_BGM_BEAT ); else if(s.EqualsNoCase("music")) this->SetEffectClock( CLOCK_BGM_TIME ); else if(s.EqualsNoCase("bgm")) this->SetEffectClock( CLOCK_BGM_BEAT ); // compat, deprecated @@ -899,9 +899,13 @@ void Actor::SetEffectClockString( const RString &s ) { CabinetLight cl = StringToCabinetLight( s ); if( cl == CabinetLight_Invalid ) - FAIL_M(ssprintf("Invalid cabinet light: %s", s.c_str())); - - this->SetEffectClock( (EffectClock) (cl + CLOCK_LIGHT_1) ); + { + LuaHelpers::ReportScriptErrorFmt("String '%s' is not an effect clock string or the name of a cabinet light.", s.c_str()); + } + else + { + this->SetEffectClock(static_cast(cl + CLOCK_LIGHT_1)); + } } }