From acde26b76a9fdd33bfda71611029f9a15ce27b60 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Tue, 22 Aug 2006 14:06:24 +0000 Subject: [PATCH] Cleanup. --- stepmania/src/Steps.cpp | 7 +------ stepmania/src/Steps.h | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/stepmania/src/Steps.cpp b/stepmania/src/Steps.cpp index fa9a5ce262..02ee4368af 100644 --- a/stepmania/src/Steps.cpp +++ b/stepmania/src/Steps.cpp @@ -343,11 +343,6 @@ void Steps::CreateBlank( StepsType ntTo ) this->SetNoteData( noteData ); } -bool Steps::IsAutogen() const -{ - return parent != NULL; -} - void Steps::SetDifficultyAndDescription( Difficulty dc, RString sDescription ) { DeAutogen(); @@ -403,7 +398,7 @@ public: return 1; } - static void Register(lua_State *L) + static void Register( lua_State *L ) { ADD_METHOD( GetStepsType ); ADD_METHOD( GetDifficulty ); diff --git a/stepmania/src/Steps.h b/stepmania/src/Steps.h index 98d197af75..541fe0ad0e 100644 --- a/stepmania/src/Steps.h +++ b/stepmania/src/Steps.h @@ -29,31 +29,31 @@ public: void Compress() const; void Decompress() const; void DeAutogen(); /* If this Steps is autogenerated, make it a real Steps. */ + bool IsAutogen() const { return parent != NULL; } // Was created by autogen? // Use a special value of difficulty - bool IsAnEdit() const { return m_Difficulty == DIFFICULTY_EDIT; } - bool IsAPlayerEdit() const { return m_Difficulty == DIFFICULTY_EDIT && GetLoadedFromProfileSlot() < ProfileSlot_Machine; } - bool WasLoadedFromProfile() const { return m_LoadedFromProfile != ProfileSlot_INVALID; } - ProfileSlot GetLoadedFromProfileSlot() const { return m_LoadedFromProfile; } - unsigned GetHash() const { return Real()->m_uHash; } - RString GetDescription() const { return Real()->m_sDescription; } - Difficulty GetDifficulty() const { return Real()->m_Difficulty; } - int GetMeter() const { return Real()->m_iMeter; } + bool IsAnEdit() const { return m_Difficulty == DIFFICULTY_EDIT; } + bool IsAPlayerEdit() const { return IsAnEdit() && GetLoadedFromProfileSlot() < ProfileSlot_Machine; } + bool WasLoadedFromProfile() const { return m_LoadedFromProfile != ProfileSlot_INVALID; } + ProfileSlot GetLoadedFromProfileSlot() const { return m_LoadedFromProfile; } + unsigned GetHash() const { return Real()->m_uHash; } + RString GetDescription() const { return Real()->m_sDescription; } + Difficulty GetDifficulty() const { return Real()->m_Difficulty; } + int GetMeter() const { return Real()->m_iMeter; } const RadarValues& GetRadarValues( PlayerNumber pn ) const { return Real()->m_CachedRadarValues[pn]; } - void SetFilename( RString fn ) { m_sFilename = fn; } - RString GetFilename() const { return m_sFilename; } - void SetSavedToDisk( bool b ) { m_bSavedToDisk = b; } - bool GetSavedToDisk() const { return m_bSavedToDisk; } + void SetFilename( RString fn ) { m_sFilename = fn; } + RString GetFilename() const { return m_sFilename; } + void SetSavedToDisk( bool b ) { m_bSavedToDisk = b; } + bool GetSavedToDisk() const { return m_bSavedToDisk; } + void SetDifficulty( Difficulty dc ) { SetDifficultyAndDescription( dc, GetDescription() ); } + void SetDescription( RString sDescription ) { SetDifficultyAndDescription( this->GetDifficulty(), sDescription ); } void SetDifficultyAndDescription( Difficulty dc, RString sDescription ); - void SetDifficulty( Difficulty dc ) { SetDifficultyAndDescription( dc, this->GetDescription() ); } - void SetDescription( RString sDescription ) { SetDifficultyAndDescription( this->GetDifficulty(), sDescription ); } static bool MakeValidEditDescription( RString &sPreferredDescription ); // return true if was modified - void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; } + void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; } void SetMeter( int meter ); void SetCachedRadarValues( const RadarValues v[NUM_PLAYERS] ); - bool IsAutogen() const; // Was created by autogen? float PredictMeter() const; void GetNoteData( NoteData& noteDataOut ) const; @@ -69,7 +69,7 @@ public: StepsType m_StepsType; private: - inline const Steps *Real() const { return parent ? parent : this; } + inline const Steps *Real() const { return parent ? parent : this; } /* If this Steps is autogenerated, this will point to the autogen * source. If this is true, m_sNoteDataCompressed will always be empty. */ @@ -84,9 +84,9 @@ private: RString m_sFilename; bool m_bSavedToDisk; // true if this was loaded from disk or has been saved to disk. + ProfileSlot m_LoadedFromProfile; // ProfileSlot_INVALID if wasn't loaded from a profile /* These values are pulled from the autogen source first, if there is one. */ - ProfileSlot m_LoadedFromProfile; // ProfileSlot_INVALID if wasn't loaded from a profile unsigned m_uHash; // only used if m_Difficulty == DIFFICULTY_EDIT RString m_sDescription; // Step author, edit name, or something meaningful Difficulty m_Difficulty; // difficulty classification