From 286824b22dafba18fa3cc1d4b09a9671f43353da Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 2 Oct 2006 06:37:00 +0000 Subject: [PATCH] simplify --- stepmania/src/IniFile.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/stepmania/src/IniFile.cpp b/stepmania/src/IniFile.cpp index 5acc4b1478..cf2ba33048 100644 --- a/stepmania/src/IniFile.cpp +++ b/stepmania/src/IniFile.cpp @@ -175,20 +175,16 @@ bool IniFile::DeleteKey(const RString &keyname) bool IniFile::RenameKey(const RString &from, const RString &to) { /* If to already exists, do nothing. */ - XNode* pTo = GetChild( to ); - if( pTo ) + if( GetChild(to) != NULL ) return false; - multimap::iterator it = m_childs.find( from ); - if( it == m_childs.end() ) + XNode* pNode = GetChild( from ); + if( pNode == NULL ) return false; - XNode* pNode = it->second; - - m_childs.erase( it ); - - pNode->m_sName = to; - m_childs.insert( make_pair(pNode->m_sName, pNode) ); + RemoveChild( pNode, false ); + pNode->SetName( to ); + AppendChild( pNode ); return true; }