XML update

This commit is contained in:
Glenn Maynard
2006-10-02 22:52:57 +00:00
parent 65d23319f1
commit 83defce27b
7 changed files with 23 additions and 22 deletions
+12 -12
View File
@@ -212,7 +212,7 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
{
FOREACH_CONST_Child( pNode, pChild )
{
if( pChild->m_sName == "Input" )
if( pChild->GetName() == "Input" )
{
/* If parameters are specified here, save their values to the actor. */
RString sName;
@@ -235,7 +235,7 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
LUA->Release( L );
}
if( pChild->m_sName == "Context" )
if( pChild->GetName() == "Context" )
{
RString sName;
if( !pChild->GetAttrValue( "Name", sName ) )
@@ -262,17 +262,17 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
{
// Load Name, if any.
const RString &sKeyName = pAttr->first;
const RString &sValue = pAttr->second;
if( sKeyName == "Name" ) SetName( sValue );
else if( sKeyName == "BaseRotationX" ) SetBaseRotationX( StringToFloat(sValue) );
else if( sKeyName == "BaseRotationY" ) SetBaseRotationY( StringToFloat(sValue) );
else if( sKeyName == "BaseRotationZ" ) SetBaseRotationZ( StringToFloat(sValue) );
else if( sKeyName == "BaseZoomX" ) SetBaseZoomX( StringToFloat(sValue) );
else if( sKeyName == "BaseZoomY" ) SetBaseZoomY( StringToFloat(sValue) );
else if( sKeyName == "BaseZoomZ" ) SetBaseZoomZ( StringToFloat(sValue) );
const XNodeValue &sValue = pAttr->second;
if( sKeyName == "Name" ) SetName( sValue.GetValue<RString>() );
else if( sKeyName == "BaseRotationX" ) SetBaseRotationX( sValue.GetValue<float>() );
else if( sKeyName == "BaseRotationY" ) SetBaseRotationY( sValue.GetValue<float>() );
else if( sKeyName == "BaseRotationZ" ) SetBaseRotationZ( sValue.GetValue<float>() );
else if( sKeyName == "BaseZoomX" ) SetBaseZoomX( sValue.GetValue<float>() );
else if( sKeyName == "BaseZoomY" ) SetBaseZoomY( sValue.GetValue<float>() );
else if( sKeyName == "BaseZoomZ" ) SetBaseZoomZ( sValue.GetValue<float>() );
else if( EndsWith(sKeyName,"Command") )
{
apActorCommands apac = ActorUtil::ParseActorCommands( sValue );
apActorCommands apac = ActorUtil::ParseActorCommands( sValue.GetValue<RString>(), ssprintf("%s: %s", sDir.c_str(), sKeyName.c_str()) );
RString sCmdName = sKeyName.Left( sKeyName.size()-7 );
AddCommand( sCmdName, apac );
@@ -284,7 +284,7 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
//
FOREACH_CONST_Child( pNode, c )
{
RString sKeyName = c->m_sName;
RString sKeyName = c->GetName();
if( sKeyName != "Command" )
continue; /* not a command */
+1 -1
View File
@@ -315,7 +315,7 @@ static void MergeActorXML( XNode *pChild, const XNode *pParent )
RString sWarning =
ssprintf( "Overriding \"%s\" (\"%s\") in XML node \"%s\" with \"%s\" in XML node \"%s\"",
p->first.c_str(),
p->second.c_str(),
p->second.GetValue<RString>().c_str(),
pChild->GetName().c_str(),
sOld.c_str(),
pParent->GetName().c_str() );
+1 -1
View File
@@ -36,7 +36,7 @@ void ExportStrings::Nsis()
FOREACH_CONST_Attr( child, attr )
{
RString sName = attr->first;
RString sValue = attr->second;
RString sValue = attr->second.GetValue<RString>();
sValue.Replace( "\\n", "$\\n" );
RString sLine = ssprintf( "LangString %s ${LANG_%s} \"%s\"", sName.c_str(), sLangNameUpper.c_str(), sValue.c_str() );
out.PutLine( sLine );
+5 -5
View File
@@ -396,14 +396,14 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
FOREACH_CONST_Attr( pNode, pAttr )
{
RString sName = pAttr->first;
const RString &sValue = pAttr->second;
const XNodeValue &sValue = pAttr->second;
sName.MakeUpper();
/* If val is an integer, it's a width, eg. "10=27". */
if( IsAnInt(sName) )
{
cfg.m_mapGlyphWidths[atoi(sName)] = atoi( sValue );
cfg.m_mapGlyphWidths[atoi(sName)] = sValue.GetValue<int>();
continue;
}
@@ -439,7 +439,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
continue;
}
cfg.CharToGlyphNo[c] = atoi( sValue );
cfg.CharToGlyphNo[c] = sValue.GetValue<int>();
continue;
}
@@ -488,7 +488,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
iCount = iLast - iFirst + 1;
}
RString sRet = cfg.MapRange( asMatches[0], iFirst, atoi(sValue), iCount );
RString sRet = cfg.MapRange( asMatches[0], iFirst, sValue.GetValue<int>(), iCount );
if( !sRet.empty() )
RageException::Throw( "Font definition \"%s\" has an invalid range \"%s\": %s.",
ini.GetPath().c_str(), sName.c_str(), sRet.c_str() );
@@ -514,7 +514,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
ini.GetPath().c_str(), iFirstFrame, iNumFramesHigh );
/* Decode the string. */
const wstring wdata( RStringToWstring(sValue) );
const wstring wdata( RStringToWstring(sValue.GetValue<RString>()) );
if( int(wdata.size()) > iNumFramesWide )
RageException::Throw( "The font definition \"%s\" assigns %i characters to row %i (\"%ls\"), but the font is only %i characters wide.",
+1 -1
View File
@@ -98,7 +98,7 @@ bool IniFile::WriteFile( RageFileBasic &f ) const
FOREACH_CONST_Attr( pKey, pAttr )
{
const RString &sName = pAttr->first;
const RString &sValue = pAttr->second;
const RString &sValue = pAttr->second.GetValue<RString>();
// TODO: Are there esacpe rules for these?
DEBUG_ASSERT( sName.find('\n') == sName.npos );
+2 -1
View File
@@ -561,7 +561,8 @@ void InputMapper::ReadMappingsFromDisk()
FOREACH_CONST_Attr( Key, i )
{
const RString &name = i->first;
const RString &value = i->second;
RString value;
i->second.GetValue( value );
GameInput GameI;
GameI.FromString( m_pInputScheme, name );
+1 -1
View File
@@ -50,7 +50,7 @@ void TitleTrans::LoadFromNode( const XNode* pNode )
/* Surround each regex with ^(...)$, to force all comparisons to default
* to being a full-line match. (Add ".*" manually if this isn't wanted.) */
const RString &sKeyName = attr->first;
const RString &sValue = attr->second;
const RString &sValue = attr->second.GetValue<RString>();
if( sKeyName == "DontTransliterate" ) translit = false;
else if( sKeyName == "TitleFrom" ) TitleFrom = "^(" + sValue + ")$";
else if( sKeyName == "ArtistFrom" ) ArtistFrom = "^(" + sValue + ")$";