diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index d28d178ae5..cf123cfa0d 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -110,8 +110,7 @@ void BGAnimation::LoadFromAniDir( const RString &_sAniDir ) AddLayersFromAniDir( sAniDir, &ini ); // TODO: Check for circular load XNode* pBGAnimation = ini.GetChild( "BGAnimation" ); - XNode dummy; - dummy.m_sName = "BGAnimation"; + XNode dummy( "BGAnimation" ); if( pBGAnimation == NULL ) pBGAnimation = &dummy; diff --git a/stepmania/src/BackgroundUtil.cpp b/stepmania/src/BackgroundUtil.cpp index ed8fafad28..d79e4b0450 100644 --- a/stepmania/src/BackgroundUtil.cpp +++ b/stepmania/src/BackgroundUtil.cpp @@ -33,8 +33,7 @@ bool BackgroundDef::operator==( const BackgroundDef &other ) const XNode *BackgroundDef::CreateNode() const { - XNode* pNode = new XNode; - pNode->m_sName = "BackgroundDef"; + XNode* pNode = new XNode( "BackgroundDef" ); if( !m_sEffect.empty() ) pNode->AppendAttr( "Effect", m_sEffect ); diff --git a/stepmania/src/Bookkeeper.cpp b/stepmania/src/Bookkeeper.cpp index 45a02eb46d..d635f30e83 100644 --- a/stepmania/src/Bookkeeper.cpp +++ b/stepmania/src/Bookkeeper.cpp @@ -93,8 +93,7 @@ void Bookkeeper::LoadFromNode( const XNode *pNode ) XNode* Bookkeeper::CreateNode() const { - XNode *xml = new XNode; - xml->m_sName = "Bookkeeping"; + XNode *xml = new XNode( "Bookkeeping" ); { XNode* pData = xml->AppendChild("Data"); diff --git a/stepmania/src/CatalogXml.cpp b/stepmania/src/CatalogXml.cpp index a3868d4931..ec3b83f68b 100644 --- a/stepmania/src/CatalogXml.cpp +++ b/stepmania/src/CatalogXml.cpp @@ -49,8 +49,7 @@ void CatalogXml::Save( LoadingWindow *loading_window ) LOG->Trace( "Writing %s ...", fn.c_str() ); - XNode xml; - xml.m_sName = "Catalog"; + XNode xml( "Catalog" ); const vector &vStepsTypesToShow = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue(); diff --git a/stepmania/src/CourseUtil.cpp b/stepmania/src/CourseUtil.cpp index 5c55d47a74..0b4e5408f3 100644 --- a/stepmania/src/CourseUtil.cpp +++ b/stepmania/src/CourseUtil.cpp @@ -376,8 +376,7 @@ Course *CourseID::ToCourse() const XNode* CourseID::CreateNode() const { - XNode* pNode = new XNode; - pNode->m_sName = "Course"; + XNode* pNode = new XNode( "Course" );; if( !sPath.empty() ) pNode->AppendAttr( "Path", sPath ); diff --git a/stepmania/src/HighScore.cpp b/stepmania/src/HighScore.cpp index b2df262a82..9202503348 100644 --- a/stepmania/src/HighScore.cpp +++ b/stepmania/src/HighScore.cpp @@ -79,8 +79,7 @@ HighScoreImpl::HighScoreImpl() XNode *HighScoreImpl::CreateNode() const { - XNode *pNode = new XNode; - pNode->m_sName = "HighScore"; + XNode *pNode = new XNode( "HighScore" ); // TRICKY: Don't write "name to fill in" markers. pNode->AppendChild( "Name", IsRankingToFillIn(sName) ? RString("") : sName ); @@ -284,8 +283,7 @@ const HighScore& HighScoreList::GetTopScore() const XNode* HighScoreList::CreateNode() const { - XNode* pNode = new XNode; - pNode->m_sName = "HighScoreList"; + XNode* pNode = new XNode( "HighScoreList" ); pNode->AppendChild( "NumTimesPlayed", iNumTimesPlayed ); pNode->AppendChild( "LastPlayed", dtLastPlayed ); @@ -352,12 +350,11 @@ void HighScoreList::ClampSize( bool bIsMachine ) XNode* Screenshot::CreateNode() const { - XNode* pNode = new XNode; - pNode->m_sName = "Screenshot"; + XNode* pNode = new XNode( "Screenshot" ); // TRICKY: Don't write "name to fill in" markers. - pNode->AppendChild( "FileName", sFileName ); - pNode->AppendChild( "MD5", sMD5 ); + pNode->AppendChild( "FileName", sFileName ); + pNode->AppendChild( "MD5", sMD5 ); pNode->AppendChild( highScore.CreateNode() ); return pNode; diff --git a/stepmania/src/IniFile.cpp b/stepmania/src/IniFile.cpp index 765e6c8055..21c3fc74dc 100644 --- a/stepmania/src/IniFile.cpp +++ b/stepmania/src/IniFile.cpp @@ -5,9 +5,8 @@ #include "RageFile.h" #include "Foreach.h" -IniFile::IniFile() +IniFile::IniFile(): XNode("IniFile") { - m_sName = "IniFile"; } bool IniFile::ReadFile( const RString &sPath ) diff --git a/stepmania/src/LuaManager.cpp b/stepmania/src/LuaManager.cpp index b6e5dfe8ee..10c4766bf0 100644 --- a/stepmania/src/LuaManager.cpp +++ b/stepmania/src/LuaManager.cpp @@ -240,8 +240,7 @@ namespace XNode *LuaManager::GetLuaInformation() const { - XNode *pLuaNode = new XNode; - pLuaNode->m_sName = "Lua"; + XNode *pLuaNode = new XNode( "Lua" ); XNode *pGlobalsNode = pLuaNode->AppendChild( "GlobalFunctions" ); XNode *pClassesNode = pLuaNode->AppendChild( "Classes" ); diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index d54f4219bb..de50ce8ee6 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -877,7 +877,7 @@ bool NoteData::GetPrevTapNoteRowForAllTracks( int &rowInOut ) const XNode* NoteData::CreateNode() const { - XNode *p = new XNode; + XNode *p = new XNode( "NoteData" ); p->m_sName = "NoteData"; all_tracks_const_iterator iter = GetTapNoteRangeAllTracks( 0, GetLastRow() ); diff --git a/stepmania/src/NoteTypes.cpp b/stepmania/src/NoteTypes.cpp index 3cb10e2dcb..a332fcdd2b 100644 --- a/stepmania/src/NoteTypes.cpp +++ b/stepmania/src/NoteTypes.cpp @@ -75,8 +75,7 @@ bool IsNoteOfType( int row, NoteType t ) XNode* TapNoteResult::CreateNode() const { - XNode *p = new XNode; - p->m_sName = "TapNoteResult"; + XNode *p = new XNode( "TapNoteResult" ); p->AppendAttr( "TapNoteScore", TapNoteScoreToString(tns) ); p->AppendAttr( "TapNoteOffset", fTapNoteOffset ); @@ -91,10 +90,8 @@ void TapNoteResult::LoadFromNode( const XNode* pNode ) XNode* HoldNoteResult::CreateNode() const { - XNode *p = new XNode; - p->m_sName = "HoldNoteResult"; - - return p; + // XXX: Should this do anything? + return new XNode( "HoldNoteResult" ); } void HoldNoteResult::LoadFromNode( const XNode* pNode ) @@ -104,8 +101,7 @@ void HoldNoteResult::LoadFromNode( const XNode* pNode ) XNode* TapNote::CreateNode() const { - XNode *p = new XNode; - p->m_sName = "TapNote"; + XNode *p = new XNode( "TapNote" ); p->AppendChild( result.CreateNode() ); p->AppendChild( HoldResult.CreateNode() ); diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 02e6f3ceff..c77f526a13 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -916,9 +916,8 @@ bool Profile::SaveAllToDir( RString sDir, bool bSignData ) const XNode *Profile::SaveStatsXmlCreateNode() const { - XNode *xml = new XNode; + XNode *xml = new XNode( "Stats" ); - xml->m_sName = "Stats"; xml->AppendChild( SaveGeneralDataCreateNode() ); xml->AppendChild( SaveSongScoresCreateNode() ); xml->AppendChild( SaveCourseScoresCreateNode() ); @@ -977,8 +976,7 @@ void Profile::SaveEditableDataToDir( RString sDir ) const XNode* Profile::SaveGeneralDataCreateNode() const { - XNode* pGeneralDataNode = new XNode; - pGeneralDataNode->m_sName = "GeneralData"; + XNode* pGeneralDataNode = new XNode( "GeneralData" ); // TRICKY: These are write-only elements that are normally never read again. // This data is required by other apps (like internet ranking), but is @@ -1285,8 +1283,7 @@ XNode* Profile::SaveSongScoresCreateNode() const const Profile* pProfile = this; ASSERT( pProfile ); - XNode* pNode = new XNode; - pNode->m_sName = "SongScores"; + XNode* pNode = new XNode( "SongScores" ); FOREACHM_CONST( SongID, HighScoresForASong, m_SongHighScores, i ) { @@ -1367,9 +1364,7 @@ XNode* Profile::SaveCourseScoresCreateNode() const const Profile* pProfile = this; ASSERT( pProfile ); - XNode* pNode = new XNode; - pNode->m_sName = "CourseScores"; - + XNode* pNode = new XNode( "CourseScores" ); FOREACHM_CONST( CourseID, HighScoresForACourse, m_CourseHighScores, i ) { @@ -1477,8 +1472,7 @@ XNode* Profile::SaveCategoryScoresCreateNode() const const Profile* pProfile = this; ASSERT( pProfile ); - XNode* pNode = new XNode; - pNode->m_sName = "CategoryScores"; + XNode* pNode = new XNode( "CategoryScores" ); FOREACH_StepsType( st ) { @@ -1591,8 +1585,7 @@ XNode* Profile::SaveScreenshotDataCreateNode() const const Profile* pProfile = this; ASSERT( pProfile ); - XNode* pNode = new XNode; - pNode->m_sName = "ScreenshotData"; + XNode* pNode = new XNode( "ScreenshotData" ); FOREACH_CONST( Screenshot, m_vScreenshots, ss ) { @@ -1634,8 +1627,7 @@ XNode* Profile::SaveCalorieDataCreateNode() const const Profile* pProfile = this; ASSERT( pProfile ); - XNode* pNode = new XNode; - pNode->m_sName = "CalorieData"; + XNode* pNode = new XNode( "CalorieData" ); FOREACHM_CONST( DateTime, Calories, m_mapDayToCaloriesBurned, i ) { @@ -1659,8 +1651,7 @@ float Profile::GetCaloriesBurnedForDay( DateTime day ) const XNode* Profile::HighScoreForASongAndSteps::CreateNode() const { - XNode* pNode = new XNode; - pNode->m_sName = "HighScoreForASongAndSteps"; + XNode* pNode = new XNode( "HighScoreForASongAndSteps" ); pNode->AppendChild( songID.CreateNode() ); pNode->AppendChild( stepsID.CreateNode() ); @@ -1711,8 +1702,7 @@ XNode* Profile::SaveRecentSongScoresCreateNode() const const Profile* pProfile = this; ASSERT( pProfile ); - XNode* pNode = new XNode; - pNode->m_sName = "RecentSongScores"; + XNode* pNode = new XNode( "RecentSongScores" ); FOREACHD_CONST( HighScoreForASongAndSteps, m_vRecentStepsScores, i ) pNode->AppendChild( i->CreateNode() ); @@ -1741,8 +1731,7 @@ void Profile::AddStepsRecentScore( const Song* pSong, const Steps* pSteps, HighS XNode* Profile::HighScoreForACourseAndTrail::CreateNode() const { - XNode* pNode = new XNode; - pNode->m_sName = "HighScoreForACourseAndTrail"; + XNode* pNode = new XNode( "HighScoresForACourseAndTrail" ); pNode->AppendChild( courseID.CreateNode() ); pNode->AppendChild( trailID.CreateNode() ); @@ -1793,8 +1782,7 @@ XNode* Profile::SaveRecentCourseScoresCreateNode() const const Profile* pProfile = this; ASSERT( pProfile ); - XNode* pNode = new XNode; - pNode->m_sName = "RecentCourseScores"; + XNode* pNode = new XNode( "RecentCourseScores" ); FOREACHD_CONST( HighScoreForACourseAndTrail, m_vRecentCourseScores, i ) pNode->AppendChild( i->CreateNode() ); @@ -1856,8 +1844,7 @@ XNode* Profile::SaveCoinDataCreateNode() const const Profile* pProfile = this; ASSERT( pProfile ); - XNode* pNode = new XNode; - pNode->m_sName = "CoinData"; + XNode* pNode = new XNode( "CoinData" ); { int coins[NUM_LAST_DAYS]; diff --git a/stepmania/src/RadarValues.cpp b/stepmania/src/RadarValues.cpp index 241649a551..c5040d6fd9 100644 --- a/stepmania/src/RadarValues.cpp +++ b/stepmania/src/RadarValues.cpp @@ -27,8 +27,7 @@ void RadarValues::Zero() XNode* RadarValues::CreateNode() const { - XNode* pNode = new XNode; - pNode->m_sName = "RadarValues"; + XNode* pNode = new XNode( "RadarValues" ); // TRICKY: Don't print a remainder for the integer values. FOREACH_RadarCategory( rc ) diff --git a/stepmania/src/SongUtil.cpp b/stepmania/src/SongUtil.cpp index 2cb858f69a..0fd556a60f 100644 --- a/stepmania/src/SongUtil.cpp +++ b/stepmania/src/SongUtil.cpp @@ -839,8 +839,7 @@ Song *SongID::ToSong() const XNode* SongID::CreateNode() const { - XNode* pNode = new XNode; - pNode->m_sName = "Song"; + XNode* pNode = new XNode( "Song" ); pNode->AppendAttr( "Dir", sDir ); diff --git a/stepmania/src/StepsUtil.cpp b/stepmania/src/StepsUtil.cpp index f365fc884b..4642a258b4 100644 --- a/stepmania/src/StepsUtil.cpp +++ b/stepmania/src/StepsUtil.cpp @@ -260,8 +260,7 @@ Steps *StepsID::ToSteps( const Song *p, bool bAllowNull, bool bUseCache ) const XNode* StepsID::CreateNode() const { - XNode* pNode = new XNode; - pNode->m_sName = "Steps"; + XNode* pNode = new XNode( "Steps" ); pNode->AppendAttr( "StepsType", GameManager::StepsTypeToString(st) ); pNode->AppendAttr( "Difficulty", DifficultyToString(dc) ); diff --git a/stepmania/src/StyleUtil.cpp b/stepmania/src/StyleUtil.cpp index 37e7404b09..2604e957be 100644 --- a/stepmania/src/StyleUtil.cpp +++ b/stepmania/src/StyleUtil.cpp @@ -31,8 +31,7 @@ const Style *StyleID::ToStyle() const XNode* StyleID::CreateNode() const { - XNode* pNode = new XNode; - pNode->m_sName = "Style"; + XNode* pNode = new XNode( "Style" ); pNode->AppendAttr( "Game", sGame ); pNode->AppendAttr( "Style", sStyle );