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:
Kyzentun
2014-07-14 18:02:28 -06:00
parent 6cf23c4dc3
commit 273b76d3c7
3 changed files with 23 additions and 20 deletions
+15 -13
View File
@@ -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 );