From 8e8a10f56ceaaab139692612f294e98c225d3d8d Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 9 Oct 2006 08:08:17 +0000 Subject: [PATCH] ActorUtil::GetWhere --- stepmania/src/ActorUtil.cpp | 18 ++++++++++++++---- stepmania/src/ActorUtil.h | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index d44df2ca75..af240289fd 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -194,11 +194,11 @@ Actor* ActorUtil::LoadFromNode( const RString& sDir, const XNode* pNode, Actor * { RString sName; if( !pChild->GetAttrValue( "Name", sName ) ) - Dialog::OK( ssprintf("Param node in '%s' is missing the attribute \"Name\"", sDir.c_str()), "MISSING_ATTRIBUTE" ); + Dialog::OK( ssprintf("%s: Param: missing the attribute \"Name\"", ActorUtil::GetWhere(pNode).c_str()), "MISSING_ATTRIBUTE" ); Lua *L = LUA->Get(); if( !pChild->PushAttrValue( L, "Value" ) ) - Dialog::OK( ssprintf("Param node in '%s' is missing the attribute \"Value\"", sDir.c_str()), "MISSING_ATTRIBUTE" ); + Dialog::OK( ssprintf("%s: Param: missing the attribute \"Value\"", ActorUtil::GetWhere(pNode).c_str()), "MISSING_ATTRIBUTE" ); SetParamFromStack( L, sName, &setOldParams[sName] ); LUA->Release(L); @@ -241,8 +241,8 @@ Actor* ActorUtil::LoadFromNode( const RString& sDir, const XNode* pNode, Actor * * loading the layer we're in. */ if( sFile == "" ) { - RString sError = ssprintf( "The file \"%s\" is missing the File attribute or has an invalid Class \"%s\"", - ActorUtil::GetSourcePath(pNode).c_str(), sClass.c_str() ); + RString sError = ssprintf( "%s: missing the File attribute or has an invalid Class \"%s\"", + ActorUtil::GetWhere(pNode).c_str(), sClass.c_str() ); Dialog::OK( sError ); pReturn = new Actor; // Return a dummy object so that we don't crash in AutoActor later. goto all_done; @@ -470,6 +470,16 @@ RString ActorUtil::GetSourcePath( const XNode *pNode ) return sRet; } +RString ActorUtil::GetWhere( const XNode *pNode ) +{ + RString sPath = GetSourcePath( pNode ); + + int iLine; + if( pNode->GetAttrValue("_Line", iLine) ) + sPath += ssprintf( ":%i", iLine ); + return sPath; +} + bool ActorUtil::GetAttrPath( const XNode *pNode, const RString &sName, RString &sOut ) { if( !pNode->GetAttrValue(sName, sOut) ) diff --git a/stepmania/src/ActorUtil.h b/stepmania/src/ActorUtil.h index 88fa40e2e8..7bb9591217 100644 --- a/stepmania/src/ActorUtil.h +++ b/stepmania/src/ActorUtil.h @@ -72,6 +72,7 @@ namespace ActorUtil Actor* LoadFromNode( const RString& sAniDir, const XNode* pNode, Actor *pParentActor = NULL ); Actor* MakeActor( const RString &sPath, const XNode *pParent = NULL, Actor *pParentActor = NULL ); RString GetSourcePath( const XNode *pNode ); + RString GetWhere( const XNode *pNode ); bool GetAttrPath( const XNode *pNode, const RString &sName, RString &sOut ); void ResolvePath( RString &sPath, const RString &sName );