Simplify.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<StepsType> &vStepsTypesToShow = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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" );
|
||||
|
||||
@@ -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() );
|
||||
|
||||
@@ -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() );
|
||||
|
||||
+12
-25
@@ -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];
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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) );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user