Fixed IniFile::RenameKey by adding RenameChildInByName to XmlFile. Only font loading uses RenameKey.

This commit is contained in:
Kyzentun
2015-03-15 13:23:23 -06:00
parent 3140c4f30f
commit 7be1a35d77
4 changed files with 11 additions and 2 deletions
+3 -2
View File
@@ -606,11 +606,12 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
const int row = StringToInt(row_str); const int row = StringToInt(row_str);
const int first_frame = row * num_frames_wide; const int first_frame = row * num_frames_wide;
if(row > num_frames_high) if(row >= num_frames_high)
{ {
LuaHelpers::ReportScriptErrorFmt( LuaHelpers::ReportScriptErrorFmt(
"The font definition \"%s\" tries to assign line %i, " "The font definition \"%s\" tries to assign line %i, "
"but the font is only %i characters high.", "but the font is only %i characters high."
"Line numbers start at 0.",
ini.GetPath().c_str(), first_frame, num_frames_high); ini.GetPath().c_str(), first_frame, num_frames_high);
continue; continue;
} }
+1
View File
@@ -188,6 +188,7 @@ bool IniFile::RenameKey(const RString &from, const RString &to)
return false; return false;
pNode->SetName( to ); pNode->SetName( to );
RenameChildInByName(pNode);
return true; return true;
} }
+6
View File
@@ -169,6 +169,12 @@ void XNode::RemoveChildFromByName(XNode* node)
} }
} }
void XNode::RenameChildInByName(XNode* node)
{
RemoveChildFromByName(node);
m_children_by_name.insert(make_pair(node->m_sName, node));
}
// detach attribute // detach attribute
bool XNode::RemoveAttr( const RString &sName ) bool XNode::RemoveAttr( const RString &sName )
+1
View File
@@ -124,6 +124,7 @@ public:
XNode *AppendChild( XNode *node ); XNode *AppendChild( XNode *node );
bool RemoveChild( XNode *node, bool bDelete = true ); bool RemoveChild( XNode *node, bool bDelete = true );
void RemoveChildFromByName(XNode *node); void RemoveChildFromByName(XNode *node);
void RenameChildInByName(XNode* node);
XNodeValue *AppendAttrFrom( const RString &sName, XNodeValue *pValue, bool bOverwrite = true ); XNodeValue *AppendAttrFrom( const RString &sName, XNodeValue *pValue, bool bOverwrite = true );
XNodeValue *AppendAttr( const RString &sName ); XNodeValue *AppendAttr( const RString &sName );