Simplify.

This commit is contained in:
Steve Checkoway
2006-10-01 14:51:50 +00:00
parent 65007cf941
commit 01fb4540f3
15 changed files with 33 additions and 64 deletions
+1 -2
View File
@@ -110,8 +110,7 @@ void BGAnimation::LoadFromAniDir( const RString &_sAniDir )
AddLayersFromAniDir( sAniDir, &ini ); // TODO: Check for circular load AddLayersFromAniDir( sAniDir, &ini ); // TODO: Check for circular load
XNode* pBGAnimation = ini.GetChild( "BGAnimation" ); XNode* pBGAnimation = ini.GetChild( "BGAnimation" );
XNode dummy; XNode dummy( "BGAnimation" );
dummy.m_sName = "BGAnimation";
if( pBGAnimation == NULL ) if( pBGAnimation == NULL )
pBGAnimation = &dummy; pBGAnimation = &dummy;
+1 -2
View File
@@ -33,8 +33,7 @@ bool BackgroundDef::operator==( const BackgroundDef &other ) const
XNode *BackgroundDef::CreateNode() const XNode *BackgroundDef::CreateNode() const
{ {
XNode* pNode = new XNode; XNode* pNode = new XNode( "BackgroundDef" );
pNode->m_sName = "BackgroundDef";
if( !m_sEffect.empty() ) if( !m_sEffect.empty() )
pNode->AppendAttr( "Effect", m_sEffect ); pNode->AppendAttr( "Effect", m_sEffect );
+1 -2
View File
@@ -93,8 +93,7 @@ void Bookkeeper::LoadFromNode( const XNode *pNode )
XNode* Bookkeeper::CreateNode() const XNode* Bookkeeper::CreateNode() const
{ {
XNode *xml = new XNode; XNode *xml = new XNode( "Bookkeeping" );
xml->m_sName = "Bookkeeping";
{ {
XNode* pData = xml->AppendChild("Data"); XNode* pData = xml->AppendChild("Data");
+1 -2
View File
@@ -49,8 +49,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
LOG->Trace( "Writing %s ...", fn.c_str() ); LOG->Trace( "Writing %s ...", fn.c_str() );
XNode xml; XNode xml( "Catalog" );
xml.m_sName = "Catalog";
const vector<StepsType> &vStepsTypesToShow = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue(); const vector<StepsType> &vStepsTypesToShow = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
+1 -2
View File
@@ -376,8 +376,7 @@ Course *CourseID::ToCourse() const
XNode* CourseID::CreateNode() const XNode* CourseID::CreateNode() const
{ {
XNode* pNode = new XNode; XNode* pNode = new XNode( "Course" );;
pNode->m_sName = "Course";
if( !sPath.empty() ) if( !sPath.empty() )
pNode->AppendAttr( "Path", sPath ); pNode->AppendAttr( "Path", sPath );
+3 -6
View File
@@ -79,8 +79,7 @@ HighScoreImpl::HighScoreImpl()
XNode *HighScoreImpl::CreateNode() const XNode *HighScoreImpl::CreateNode() const
{ {
XNode *pNode = new XNode; XNode *pNode = new XNode( "HighScore" );
pNode->m_sName = "HighScore";
// TRICKY: Don't write "name to fill in" markers. // TRICKY: Don't write "name to fill in" markers.
pNode->AppendChild( "Name", IsRankingToFillIn(sName) ? RString("") : sName ); pNode->AppendChild( "Name", IsRankingToFillIn(sName) ? RString("") : sName );
@@ -284,8 +283,7 @@ const HighScore& HighScoreList::GetTopScore() const
XNode* HighScoreList::CreateNode() const XNode* HighScoreList::CreateNode() const
{ {
XNode* pNode = new XNode; XNode* pNode = new XNode( "HighScoreList" );
pNode->m_sName = "HighScoreList";
pNode->AppendChild( "NumTimesPlayed", iNumTimesPlayed ); pNode->AppendChild( "NumTimesPlayed", iNumTimesPlayed );
pNode->AppendChild( "LastPlayed", dtLastPlayed ); pNode->AppendChild( "LastPlayed", dtLastPlayed );
@@ -352,8 +350,7 @@ void HighScoreList::ClampSize( bool bIsMachine )
XNode* Screenshot::CreateNode() const XNode* Screenshot::CreateNode() const
{ {
XNode* pNode = new XNode; XNode* pNode = new XNode( "Screenshot" );
pNode->m_sName = "Screenshot";
// TRICKY: Don't write "name to fill in" markers. // TRICKY: Don't write "name to fill in" markers.
pNode->AppendChild( "FileName", sFileName ); pNode->AppendChild( "FileName", sFileName );
+1 -2
View File
@@ -5,9 +5,8 @@
#include "RageFile.h" #include "RageFile.h"
#include "Foreach.h" #include "Foreach.h"
IniFile::IniFile() IniFile::IniFile(): XNode("IniFile")
{ {
m_sName = "IniFile";
} }
bool IniFile::ReadFile( const RString &sPath ) bool IniFile::ReadFile( const RString &sPath )
+1 -2
View File
@@ -240,8 +240,7 @@ namespace
XNode *LuaManager::GetLuaInformation() const XNode *LuaManager::GetLuaInformation() const
{ {
XNode *pLuaNode = new XNode; XNode *pLuaNode = new XNode( "Lua" );
pLuaNode->m_sName = "Lua";
XNode *pGlobalsNode = pLuaNode->AppendChild( "GlobalFunctions" ); XNode *pGlobalsNode = pLuaNode->AppendChild( "GlobalFunctions" );
XNode *pClassesNode = pLuaNode->AppendChild( "Classes" ); XNode *pClassesNode = pLuaNode->AppendChild( "Classes" );
+1 -1
View File
@@ -877,7 +877,7 @@ bool NoteData::GetPrevTapNoteRowForAllTracks( int &rowInOut ) const
XNode* NoteData::CreateNode() const XNode* NoteData::CreateNode() const
{ {
XNode *p = new XNode; XNode *p = new XNode( "NoteData" );
p->m_sName = "NoteData"; p->m_sName = "NoteData";
all_tracks_const_iterator iter = GetTapNoteRangeAllTracks( 0, GetLastRow() ); all_tracks_const_iterator iter = GetTapNoteRangeAllTracks( 0, GetLastRow() );
+4 -8
View File
@@ -75,8 +75,7 @@ bool IsNoteOfType( int row, NoteType t )
XNode* TapNoteResult::CreateNode() const XNode* TapNoteResult::CreateNode() const
{ {
XNode *p = new XNode; XNode *p = new XNode( "TapNoteResult" );
p->m_sName = "TapNoteResult";
p->AppendAttr( "TapNoteScore", TapNoteScoreToString(tns) ); p->AppendAttr( "TapNoteScore", TapNoteScoreToString(tns) );
p->AppendAttr( "TapNoteOffset", fTapNoteOffset ); p->AppendAttr( "TapNoteOffset", fTapNoteOffset );
@@ -91,10 +90,8 @@ void TapNoteResult::LoadFromNode( const XNode* pNode )
XNode* HoldNoteResult::CreateNode() const XNode* HoldNoteResult::CreateNode() const
{ {
XNode *p = new XNode; // XXX: Should this do anything?
p->m_sName = "HoldNoteResult"; return new XNode( "HoldNoteResult" );
return p;
} }
void HoldNoteResult::LoadFromNode( const XNode* pNode ) void HoldNoteResult::LoadFromNode( const XNode* pNode )
@@ -104,8 +101,7 @@ void HoldNoteResult::LoadFromNode( const XNode* pNode )
XNode* TapNote::CreateNode() const XNode* TapNote::CreateNode() const
{ {
XNode *p = new XNode; XNode *p = new XNode( "TapNote" );
p->m_sName = "TapNote";
p->AppendChild( result.CreateNode() ); p->AppendChild( result.CreateNode() );
p->AppendChild( HoldResult.CreateNode() ); p->AppendChild( HoldResult.CreateNode() );
+12 -25
View File
@@ -916,9 +916,8 @@ bool Profile::SaveAllToDir( RString sDir, bool bSignData ) const
XNode *Profile::SaveStatsXmlCreateNode() const XNode *Profile::SaveStatsXmlCreateNode() const
{ {
XNode *xml = new XNode; XNode *xml = new XNode( "Stats" );
xml->m_sName = "Stats";
xml->AppendChild( SaveGeneralDataCreateNode() ); xml->AppendChild( SaveGeneralDataCreateNode() );
xml->AppendChild( SaveSongScoresCreateNode() ); xml->AppendChild( SaveSongScoresCreateNode() );
xml->AppendChild( SaveCourseScoresCreateNode() ); xml->AppendChild( SaveCourseScoresCreateNode() );
@@ -977,8 +976,7 @@ void Profile::SaveEditableDataToDir( RString sDir ) const
XNode* Profile::SaveGeneralDataCreateNode() const XNode* Profile::SaveGeneralDataCreateNode() const
{ {
XNode* pGeneralDataNode = new XNode; XNode* pGeneralDataNode = new XNode( "GeneralData" );
pGeneralDataNode->m_sName = "GeneralData";
// TRICKY: These are write-only elements that are normally never read again. // TRICKY: These are write-only elements that are normally never read again.
// This data is required by other apps (like internet ranking), but is // This data is required by other apps (like internet ranking), but is
@@ -1285,8 +1283,7 @@ XNode* Profile::SaveSongScoresCreateNode() const
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile ); ASSERT( pProfile );
XNode* pNode = new XNode; XNode* pNode = new XNode( "SongScores" );
pNode->m_sName = "SongScores";
FOREACHM_CONST( SongID, HighScoresForASong, m_SongHighScores, i ) FOREACHM_CONST( SongID, HighScoresForASong, m_SongHighScores, i )
{ {
@@ -1367,9 +1364,7 @@ XNode* Profile::SaveCourseScoresCreateNode() const
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile ); ASSERT( pProfile );
XNode* pNode = new XNode; XNode* pNode = new XNode( "CourseScores" );
pNode->m_sName = "CourseScores";
FOREACHM_CONST( CourseID, HighScoresForACourse, m_CourseHighScores, i ) FOREACHM_CONST( CourseID, HighScoresForACourse, m_CourseHighScores, i )
{ {
@@ -1477,8 +1472,7 @@ XNode* Profile::SaveCategoryScoresCreateNode() const
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile ); ASSERT( pProfile );
XNode* pNode = new XNode; XNode* pNode = new XNode( "CategoryScores" );
pNode->m_sName = "CategoryScores";
FOREACH_StepsType( st ) FOREACH_StepsType( st )
{ {
@@ -1591,8 +1585,7 @@ XNode* Profile::SaveScreenshotDataCreateNode() const
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile ); ASSERT( pProfile );
XNode* pNode = new XNode; XNode* pNode = new XNode( "ScreenshotData" );
pNode->m_sName = "ScreenshotData";
FOREACH_CONST( Screenshot, m_vScreenshots, ss ) FOREACH_CONST( Screenshot, m_vScreenshots, ss )
{ {
@@ -1634,8 +1627,7 @@ XNode* Profile::SaveCalorieDataCreateNode() const
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile ); ASSERT( pProfile );
XNode* pNode = new XNode; XNode* pNode = new XNode( "CalorieData" );
pNode->m_sName = "CalorieData";
FOREACHM_CONST( DateTime, Calories, m_mapDayToCaloriesBurned, i ) FOREACHM_CONST( DateTime, Calories, m_mapDayToCaloriesBurned, i )
{ {
@@ -1659,8 +1651,7 @@ float Profile::GetCaloriesBurnedForDay( DateTime day ) const
XNode* Profile::HighScoreForASongAndSteps::CreateNode() const XNode* Profile::HighScoreForASongAndSteps::CreateNode() const
{ {
XNode* pNode = new XNode; XNode* pNode = new XNode( "HighScoreForASongAndSteps" );
pNode->m_sName = "HighScoreForASongAndSteps";
pNode->AppendChild( songID.CreateNode() ); pNode->AppendChild( songID.CreateNode() );
pNode->AppendChild( stepsID.CreateNode() ); pNode->AppendChild( stepsID.CreateNode() );
@@ -1711,8 +1702,7 @@ XNode* Profile::SaveRecentSongScoresCreateNode() const
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile ); ASSERT( pProfile );
XNode* pNode = new XNode; XNode* pNode = new XNode( "RecentSongScores" );
pNode->m_sName = "RecentSongScores";
FOREACHD_CONST( HighScoreForASongAndSteps, m_vRecentStepsScores, i ) FOREACHD_CONST( HighScoreForASongAndSteps, m_vRecentStepsScores, i )
pNode->AppendChild( i->CreateNode() ); pNode->AppendChild( i->CreateNode() );
@@ -1741,8 +1731,7 @@ void Profile::AddStepsRecentScore( const Song* pSong, const Steps* pSteps, HighS
XNode* Profile::HighScoreForACourseAndTrail::CreateNode() const XNode* Profile::HighScoreForACourseAndTrail::CreateNode() const
{ {
XNode* pNode = new XNode; XNode* pNode = new XNode( "HighScoresForACourseAndTrail" );
pNode->m_sName = "HighScoreForACourseAndTrail";
pNode->AppendChild( courseID.CreateNode() ); pNode->AppendChild( courseID.CreateNode() );
pNode->AppendChild( trailID.CreateNode() ); pNode->AppendChild( trailID.CreateNode() );
@@ -1793,8 +1782,7 @@ XNode* Profile::SaveRecentCourseScoresCreateNode() const
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile ); ASSERT( pProfile );
XNode* pNode = new XNode; XNode* pNode = new XNode( "RecentCourseScores" );
pNode->m_sName = "RecentCourseScores";
FOREACHD_CONST( HighScoreForACourseAndTrail, m_vRecentCourseScores, i ) FOREACHD_CONST( HighScoreForACourseAndTrail, m_vRecentCourseScores, i )
pNode->AppendChild( i->CreateNode() ); pNode->AppendChild( i->CreateNode() );
@@ -1856,8 +1844,7 @@ XNode* Profile::SaveCoinDataCreateNode() const
const Profile* pProfile = this; const Profile* pProfile = this;
ASSERT( pProfile ); ASSERT( pProfile );
XNode* pNode = new XNode; XNode* pNode = new XNode( "CoinData" );
pNode->m_sName = "CoinData";
{ {
int coins[NUM_LAST_DAYS]; int coins[NUM_LAST_DAYS];
+1 -2
View File
@@ -27,8 +27,7 @@ void RadarValues::Zero()
XNode* RadarValues::CreateNode() const XNode* RadarValues::CreateNode() const
{ {
XNode* pNode = new XNode; XNode* pNode = new XNode( "RadarValues" );
pNode->m_sName = "RadarValues";
// TRICKY: Don't print a remainder for the integer values. // TRICKY: Don't print a remainder for the integer values.
FOREACH_RadarCategory( rc ) FOREACH_RadarCategory( rc )
+1 -2
View File
@@ -839,8 +839,7 @@ Song *SongID::ToSong() const
XNode* SongID::CreateNode() const XNode* SongID::CreateNode() const
{ {
XNode* pNode = new XNode; XNode* pNode = new XNode( "Song" );
pNode->m_sName = "Song";
pNode->AppendAttr( "Dir", sDir ); pNode->AppendAttr( "Dir", sDir );
+1 -2
View File
@@ -260,8 +260,7 @@ Steps *StepsID::ToSteps( const Song *p, bool bAllowNull, bool bUseCache ) const
XNode* StepsID::CreateNode() const XNode* StepsID::CreateNode() const
{ {
XNode* pNode = new XNode; XNode* pNode = new XNode( "Steps" );
pNode->m_sName = "Steps";
pNode->AppendAttr( "StepsType", GameManager::StepsTypeToString(st) ); pNode->AppendAttr( "StepsType", GameManager::StepsTypeToString(st) );
pNode->AppendAttr( "Difficulty", DifficultyToString(dc) ); pNode->AppendAttr( "Difficulty", DifficultyToString(dc) );
+1 -2
View File
@@ -31,8 +31,7 @@ const Style *StyleID::ToStyle() const
XNode* StyleID::CreateNode() const XNode* StyleID::CreateNode() const
{ {
XNode* pNode = new XNode; XNode* pNode = new XNode( "Style" );
pNode->m_sName = "Style";
pNode->AppendAttr( "Game", sGame ); pNode->AppendAttr( "Game", sGame );
pNode->AppendAttr( "Style", sStyle ); pNode->AppendAttr( "Style", sStyle );