ActorUtil::ResolvePath updated for error reporting. Changed BitmapText to work with either a font name or a path. ThemeManager::GetPathInfoRaw fixed to use correct error dialog. ThemeManager::GetPathInfo fixed to report correct error for missing theme elements.
This commit is contained in:
+2
-2
@@ -55,7 +55,7 @@ bool ActorUtil::ResolvePath( RString &sPath, const RString &sName )
|
||||
if( asPaths.empty() )
|
||||
{
|
||||
RString sError = ssprintf( "%s: references a file \"%s\" which doesn't exist", sName.c_str(), sPath.c_str() );
|
||||
switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) )
|
||||
switch(LuaHelpers::ReportScriptError(sError, "BROKEN_FILE_REFERENCE", true))
|
||||
{
|
||||
case Dialog::abort:
|
||||
RageException::Throw( "%s", sError.c_str() );
|
||||
@@ -76,7 +76,7 @@ bool ActorUtil::ResolvePath( RString &sPath, const RString &sName )
|
||||
{
|
||||
RString sError = ssprintf( "%s: references a file \"%s\" which has multiple matches", sName.c_str(), sPath.c_str() );
|
||||
sError += "\n" + join( "\n", asPaths );
|
||||
switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) )
|
||||
switch(LuaHelpers::ReportScriptError(sError, "BROKEN_FILE_REFERENCE", true))
|
||||
{
|
||||
case Dialog::abort:
|
||||
RageException::Throw( "%s", sError.c_str() );
|
||||
|
||||
+15
-13
@@ -126,21 +126,23 @@ void BitmapText::LoadFromNode( const XNode* pNode )
|
||||
ThemeManager::EvaluateString( sAltText );
|
||||
|
||||
RString sFont;
|
||||
// The short circuiting loading condition that was here before wasn't short circuiting correctly on all platforms.
|
||||
if(!ActorUtil::GetAttrPath(pNode, "Font", sFont))
|
||||
// Allow the Font attribute to be either a path or simply the name of a font.
|
||||
// If it's a path, it will have a slash in it.
|
||||
// Also allow it to be set through either "Font" or through "File".
|
||||
if(!pNode->GetAttrValue("Font", sFont) && !pNode->GetAttrValue("File", sFont))
|
||||
{
|
||||
if(!ActorUtil::GetAttrPath(pNode, "File", sFont))
|
||||
{
|
||||
if( !pNode->GetAttrValue("Font", sFont) &&
|
||||
!pNode->GetAttrValue("File", sFont) ) // accept "File" for backward compatibility
|
||||
{
|
||||
LuaHelpers::ReportScriptErrorFmt( "%s: BitmapText: Font or File attribute not found",
|
||||
ActorUtil::GetWhere(pNode).c_str() );
|
||||
sFont = "Common Normal";
|
||||
}
|
||||
}
|
||||
LuaHelpers::ReportScriptErrorFmt("%s: BitmapText: Font or File attribute not found",
|
||||
ActorUtil::GetWhere(pNode).c_str());
|
||||
sFont = "Common Normal";
|
||||
}
|
||||
if(sFont.find("/") == RString::npos)
|
||||
{
|
||||
sFont= THEME->GetPathF("", sFont);
|
||||
}
|
||||
else if(!ActorUtil::ResolvePath(sFont, ActorUtil::GetWhere(pNode)))
|
||||
{
|
||||
sFont= THEME->GetPathF("", "Common Normal");
|
||||
}
|
||||
sFont = THEME->GetPathF( "", sFont );
|
||||
|
||||
LoadFromFont( sFont );
|
||||
|
||||
|
||||
@@ -722,7 +722,7 @@ bool ThemeManager::GetPathInfoToRaw( PathInfo &out, const RString &sThemeName_,
|
||||
"Verify that this redirect is correct.",
|
||||
sPath.c_str(), sNewFileName.c_str());
|
||||
|
||||
switch( LuaHelpers::ReportScriptError(sMessage) )
|
||||
switch(LuaHelpers::ReportScriptError(sMessage, "", true))
|
||||
{
|
||||
case Dialog::retry:
|
||||
ReloadMetrics();
|
||||
@@ -815,11 +815,12 @@ try_element_again:
|
||||
goto try_element_again;
|
||||
case Dialog::ignore:
|
||||
{
|
||||
RString error= ssprintf(sCategory + '/' + sFileName,
|
||||
"could not be found in \"%s\" or \"%s\".",
|
||||
GetThemeDirFromName(m_sCurThemeName).c_str(),
|
||||
GetThemeDirFromName(SpecialFiles::BASE_THEME_NAME).c_str() );
|
||||
RString error= sCategory + '/' + sFileName +
|
||||
" could not be found in \"" +
|
||||
GetThemeDirFromName(m_sCurThemeName).c_str() + "\" or \"" +
|
||||
GetThemeDirFromName(SpecialFiles::BASE_THEME_NAME).c_str() + "\".";
|
||||
LOG->UserLog("Theme element", "%s", error.c_str());
|
||||
LOG->Warn(error.c_str());
|
||||
LuaHelpers::ScriptErrorMessage(error);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user