Fixed IniFile::RenameKey by adding RenameChildInByName to XmlFile. Only font loading uses RenameKey.
This commit is contained in:
+3
-2
@@ -606,11 +606,12 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
|
||||
const int row = StringToInt(row_str);
|
||||
const int first_frame = row * num_frames_wide;
|
||||
|
||||
if(row > num_frames_high)
|
||||
if(row >= num_frames_high)
|
||||
{
|
||||
LuaHelpers::ReportScriptErrorFmt(
|
||||
"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);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -188,6 +188,7 @@ bool IniFile::RenameKey(const RString &from, const RString &to)
|
||||
return false;
|
||||
|
||||
pNode->SetName( to );
|
||||
RenameChildInByName(pNode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
bool XNode::RemoveAttr( const RString &sName )
|
||||
|
||||
@@ -124,6 +124,7 @@ public:
|
||||
XNode *AppendChild( XNode *node );
|
||||
bool RemoveChild( XNode *node, bool bDelete = true );
|
||||
void RemoveChildFromByName(XNode *node);
|
||||
void RenameChildInByName(XNode* node);
|
||||
|
||||
XNodeValue *AppendAttrFrom( const RString &sName, XNodeValue *pValue, bool bOverwrite = true );
|
||||
XNodeValue *AppendAttr( const RString &sName );
|
||||
|
||||
Reference in New Issue
Block a user