From 85eb3e0a0577b52cd1b0e1157d7363391ac53b81 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 29 Sep 2006 07:24:40 +0000 Subject: [PATCH] more useful error messages --- stepmania/src/ActorUtil.cpp | 8 ++++---- stepmania/src/ActorUtil.h | 4 ++-- stepmania/src/ThemeManager.cpp | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index b5bfe6a481..f025847176 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -396,7 +396,7 @@ Actor* ActorUtil::MakeActor( const RString &sPath_, const XNode *pParent, Actor } } -void ActorUtil::ParseActorCommands( Lua *L, const RString &sCommands ) +void ActorUtil::ParseActorCommands( Lua *L, const RString &sCommands, const RString &sName ) { RString sLuaFunction; if( sCommands.size() > 0 && sCommands[0] == '\033' ) @@ -472,16 +472,16 @@ void ActorUtil::ParseActorCommands( Lua *L, const RString &sCommands ) } RString sError; - if( !LuaHelpers::RunScript( L, sLuaFunction, "", sError, 1 ) ) + if( !LuaHelpers::RunScript( L, sLuaFunction, sName, sError, 1 ) ) LOG->Warn( "Compiling \"%s\": %s", sLuaFunction.c_str(), sError.c_str() ); /* The function is now on the stack. */ } -apActorCommands ActorUtil::ParseActorCommands( const RString &sCommands ) +apActorCommands ActorUtil::ParseActorCommands( const RString &sCommands, const RString &sName ) { Lua *L = LUA->Get(); - ParseActorCommands( L, sCommands ); + ParseActorCommands( L, sCommands, sName ); LuaReference *pRet = new LuaReference; pRet->SetFromStack( L ); LUA->Release( L ); diff --git a/stepmania/src/ActorUtil.h b/stepmania/src/ActorUtil.h index a4c5efac0f..6e5cb2d7ee 100644 --- a/stepmania/src/ActorUtil.h +++ b/stepmania/src/ActorUtil.h @@ -45,8 +45,8 @@ namespace ActorUtil void Register( const RString& sClassName, CreateActorFn pfn ); Actor* Create( const RString& sClassName, const RString& sDir, const XNode* pNode, Actor *pParentActor ); - void ParseActorCommands( Lua *L, const RString &sCommands ); - apActorCommands ParseActorCommands( const RString &sCommands ); + void ParseActorCommands( Lua *L, const RString &sCommands, const RString &sName = "" ); + apActorCommands ParseActorCommands( const RString &sCommands, const RString &sName = "" ); void SetXY( Actor& actor, const RString &sType ); void LoadCommand( Actor& actor, const RString &sType, const RString &sCommandName ); void LoadCommandFromName( Actor& actor, const RString &sType, const RString &sCommandName, const RString &sName ); diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 5b3ce4f7c5..aaa18f3dec 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -949,14 +949,15 @@ void ThemeManager::PushMetric( Lua *L, const RString &sClassName, const RString { RString sValue = GetMetricRaw( g_pLoadedThemeData->iniMetrics, sClassName, sValueName ); + RString sName = ssprintf( "%s::%s", sClassName.c_str(), sValueName.c_str() ); if( EndsWith(sValueName, "Command") ) { - ActorUtil::ParseActorCommands( L, sValue ); + ActorUtil::ParseActorCommands( L, sValue, sName ); } else { LuaHelpers::PrepareExpression( sValue ); - LuaHelpers::RunExpression( L, sValue, ssprintf("%s::%s", sClassName.c_str(), sValueName.c_str()) ); + LuaHelpers::RunExpression( L, sValue, sName ); } }