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