From 22b7b3489723bda4a213c8a85178ad421d32ed3e Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sat, 19 Mar 2011 18:26:55 -0400 Subject: [PATCH] More effective fixes. Course playing still results in it playing fine. --- src/BackgroundUtil.h | 34 ++++++++++++++++------------ src/Command.h | 3 +++ src/Course.cpp | 13 +++++++++-- src/Course.h | 6 +++-- src/CourseUtil.h | 2 +- src/Font.cpp | 11 +++------ src/Font.h | 12 +++++----- src/MessageManager.h | 2 +- src/MsdFile.h | 3 +++ src/RageBitmapTexture.cpp | 2 +- src/RageDisplay.cpp | 2 +- src/RageSound.cpp | 5 ++-- src/RageTexturePreloader.h | 6 ++--- src/RageTypes.h | 1 + src/RageUtil_CachedObject.h | 7 ++---- src/SongUtil.h | 7 +++--- src/StepsUtil.h | 2 +- src/UnlockManager.h | 7 +++--- src/arch/InputHandler/InputHandler.h | 2 +- 19 files changed, 72 insertions(+), 55 deletions(-) diff --git a/src/BackgroundUtil.h b/src/BackgroundUtil.h index ca813484d8..80d36b8a92 100644 --- a/src/BackgroundUtil.h +++ b/src/BackgroundUtil.h @@ -27,15 +27,26 @@ struct BackgroundDef RString m_sColor2; // "" == use default XNode *CreateNode() const; + + /** @brief Set up the BackgroundDef with default values. */ + BackgroundDef(): m_sEffect(""), m_sFile1(""), m_sFile2(""), + m_sColor1(""), m_sColor2("") {} + + /** + * @brief Set up the BackgroundDef with some defined values. + * @param effect the intended effect. + * @param f1 the primary filename for the definition. + * @param f2 the secondary filename (optional). */ + BackgroundDef(RString effect, RString f1, RString f2): + m_sEffect(effect), m_sFile1(f1), m_sFile2(f2), + m_sColor1(""), m_sColor2("") {} }; struct BackgroundChange { - BackgroundChange() - { - m_fStartBeat=-1; - m_fRate=1; - } + BackgroundChange(): m_def(), m_fStartBeat(-1), m_fRate(1), + m_sTransition("") {} + BackgroundChange( float s, RString f1, @@ -43,15 +54,10 @@ struct BackgroundChange float r=1.f, RString e=SBE_Centered, RString t=RString() - ) - { - m_fStartBeat=s; - m_def.m_sFile1=f1; - m_def.m_sFile2=f2; - m_fRate=r; - m_def.m_sEffect=e; - m_sTransition=t; - } + ): + m_def(e, f1, f2), m_fStartBeat(s), + m_fRate(r), m_sTransition(t) {} + BackgroundDef m_def; float m_fStartBeat; float m_fRate; diff --git a/src/Command.h b/src/Command.h index 88f5110bfc..71adceb282 100644 --- a/src/Command.h +++ b/src/Command.h @@ -16,10 +16,13 @@ public: struct Arg { RString s; + Arg(): s("") {} }; Arg GetArg( unsigned index ) const; vector m_vsArgs; + + Command(): m_vsArgs() {} }; class Commands diff --git a/src/Course.cpp b/src/Course.cpp index 10dc2c7f0f..ce37abc628 100644 --- a/src/Course.cpp +++ b/src/Course.cpp @@ -88,9 +88,18 @@ int CourseEntry::GetNumModChanges() const -Course::Course() +Course::Course(): m_bIsAutogen(false), m_sPath(""), m_sMainTitle(""), + m_sMainTitleTranslit(""), m_sSubTitle(""), m_sSubTitleTranslit(""), + m_sBannerPath(""), m_sBackgroundPath(""), m_sCDTitlePath(""), + m_sGroupName(""), m_bRepeat(false), m_fGoalSeconds(0), + m_bShuffle(false), m_iLives(-1), m_bSortByMeter(false), + m_bIncomplete(false), m_vEntries(), m_SortOrder_TotalDifficulty(0), + m_SortOrder_Ranking(0), m_LoadedFromProfile(ProfileSlot_Invalid), + m_TrailCache(), m_iTrailCacheSeed(0), m_RadarCache(), + m_setStyles(), m_CachedObject() { - Init(); + FOREACH_ENUM( Difficulty,dc) + m_iCustomMeter[dc] = -1; } CourseType Course::GetCourseType() const diff --git a/src/Course.h b/src/Course.h index 25864c12f6..7ba37eb3f0 100644 --- a/src/Course.h +++ b/src/Course.h @@ -55,9 +55,11 @@ public: float fGainSeconds; // time gained back at the beginning of the song. LifeMeterTime only. int iGainLives; // lives gained back at the beginning of the next song - CourseEntry(): bSecret(false), bNoDifficult(false), + CourseEntry(): bSecret(false), songID(), songCriteria(), + stepsCriteria(), bNoDifficult(false), songSort(SongSort_Randomize), iChooseIndex(0), - sModifiers(RString("")), fGainSeconds(0), iGainLives(-1) {} + sModifiers(RString("")), attacks(), fGainSeconds(0), + iGainLives(-1) {} bool IsFixedSong() const { return songID.IsValid(); } diff --git a/src/CourseUtil.h b/src/CourseUtil.h index f897617888..e338c9c3e7 100644 --- a/src/CourseUtil.h +++ b/src/CourseUtil.h @@ -68,7 +68,7 @@ namespace EditCourseUtil class CourseID { public: - CourseID() { Unset(); } + CourseID(): sPath(""), sFullTitle(""), m_Cache() { Unset(); } void Unset() { FromCourse(NULL); } void FromCourse( const Course *p ); Course *ToCourse() const; diff --git a/src/Font.cpp b/src/Font.cpp index 10c89f5ad8..fed6ed7835 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -220,14 +220,9 @@ int Font::GetLineHeightInSourcePixels( const wstring &szLine ) const } -Font::Font() -{ - m_iRefCount = 1; - m_pDefault = NULL; - m_bRightToLeft = false; - // [sm-ssc] don't show strokes by default - m_DefaultStrokeColor = RageColor(0,0,0,0); -} +Font::Font(): m_iRefCount(1), path(""), m_apPages(), m_pDefault(NULL), + m_bRightToLeft(false), m_DefaultStrokeColor(RageColor(0,0,0,0)), + m_sChars("") {} // strokes aren't shown by default, hence the Color. Font::~Font() { diff --git a/src/Font.h b/src/Font.h index ef1eeb1f73..4242693a34 100644 --- a/src/Font.h +++ b/src/Font.h @@ -23,11 +23,7 @@ struct FontPageTextures RageTexture *m_pTextureStroke; /** @brief Set up the initial textures. */ - FontPageTextures() - { - m_pTextureMain = NULL; - m_pTextureStroke = NULL; - } + FontPageTextures(): m_pTextureMain(NULL), m_pTextureStroke(NULL) {} }; /** @brief The components of a glyph (not technically a character). */ @@ -52,6 +48,10 @@ struct glyph /** @brief Texture coordinate rect. */ RectF m_TexRect; + + /** @brief Set up the glyph with default values. */ + glyph() : m_pPage(NULL), m_FontPageTextures(), m_iHadvance(0), + m_fWidth(0), m_fHeight(0), m_fHshift(0), m_TexRect() {} }; /** @brief The settings used for the FontPage. */ @@ -75,7 +75,7 @@ struct FontPageSettings map m_mapGlyphWidths; /** @brief The initial settings for the FontPage. */ - FontPageSettings(): + FontPageSettings(): m_sTexturePath(""), m_iDrawExtraPixelsLeft(0), m_iDrawExtraPixelsRight(0), m_iAddToAllWidths(0), m_iLineSpacing(-1), diff --git a/src/MessageManager.h b/src/MessageManager.h index c067bbbe24..020868fb4a 100644 --- a/src/MessageManager.h +++ b/src/MessageManager.h @@ -156,7 +156,7 @@ private: class MessageSubscriber : public IMessageSubscriber { public: - MessageSubscriber() {} + MessageSubscriber(): m_vsSubscribedTo() {} MessageSubscriber( const MessageSubscriber &cpy ); MessageSubscriber &operator=(const MessageSubscriber &cpy); diff --git a/src/MsdFile.h b/src/MsdFile.h index 1c5f50f645..aaae912b14 100644 --- a/src/MsdFile.h +++ b/src/MsdFile.h @@ -13,6 +13,9 @@ public: { /** @brief The list of parameters. */ vector params; + /** @brief Set up the parameters with default values. */ + value_t(): params() {} + /** * @brief Access the proper parameter. * @param i the index. diff --git a/src/RageBitmapTexture.cpp b/src/RageBitmapTexture.cpp index 0579ebd56a..e6743722c2 100644 --- a/src/RageBitmapTexture.cpp +++ b/src/RageBitmapTexture.cpp @@ -31,7 +31,7 @@ static void GetResolutionFromFileName( RString sPath, int &iWidth, int &iHeight } RageBitmapTexture::RageBitmapTexture( RageTextureID name ) : - RageTexture( name ) + RageTexture( name ), m_uTexHandle(0) { Create(); } diff --git a/src/RageDisplay.cpp b/src/RageDisplay.cpp index 4519a623be..273d68a4c8 100644 --- a/src/RageDisplay.cpp +++ b/src/RageDisplay.cpp @@ -264,7 +264,7 @@ class MatrixStack vector stack; public: - MatrixStack() + MatrixStack(): stack() { stack.resize(1); LoadIdentity(); diff --git a/src/RageSound.cpp b/src/RageSound.cpp index 258023c5ce..a89ff3018a 100644 --- a/src/RageSound.cpp +++ b/src/RageSound.cpp @@ -48,9 +48,10 @@ RageSoundLoadParams::RageSoundLoadParams(): m_bSupportRateChanging(false), m_bSupportPan(false) {} RageSound::RageSound(): - m_Mutex( "RageSound" ), m_pSource(NULL), m_iStreamFrame(0), + m_Mutex( "RageSound" ), m_pSource(NULL), + m_sFilePath(""), m_Param(), m_iStreamFrame(0), m_iStoppedSourceFrame(0), m_bPlaying(false), - m_bDeleteWhenFinished(false) + m_sError(""), m_bDeleteWhenFinished(false) { ASSERT( SOUNDMAN ); } diff --git a/src/RageTexturePreloader.h b/src/RageTexturePreloader.h index a7bfb04805..1a45ffe28b 100644 --- a/src/RageTexturePreloader.h +++ b/src/RageTexturePreloader.h @@ -1,15 +1,13 @@ -/* RageTexturePreloader - Load textures in advance, for use later. */ - #ifndef RAGE_TEXTURE_PRELOADER_H #define RAGE_TEXTURE_PRELOADER_H class RageTexture; struct RageTextureID; - +/** @brief Load the textures in advance for using them later. */ class RageTexturePreloader { public: - RageTexturePreloader() { } + RageTexturePreloader(): m_apTextures() { } RageTexturePreloader( const RageTexturePreloader &cpy ) { *this = cpy; } RageTexturePreloader &operator=( const RageTexturePreloader &rhs ); ~RageTexturePreloader(); diff --git a/src/RageTypes.h b/src/RageTypes.h index 7e7238f383..610b058329 100644 --- a/src/RageTypes.h +++ b/src/RageTypes.h @@ -335,6 +335,7 @@ typedef StepMania::Rect RectF; * have the same layout that D3D expects. */ struct RageSpriteVertex // has color { + RageSpriteVertex(): p(), n(), c(), t() {} RageVector3 p; // position RageVector3 n; // normal RageVColor c; // diffuse color diff --git a/src/RageUtil_CachedObject.h b/src/RageUtil_CachedObject.h index d0305e43f9..a74c80e2a7 100644 --- a/src/RageUtil_CachedObject.h +++ b/src/RageUtil_CachedObject.h @@ -18,17 +18,14 @@ template class CachedObject { public: - CachedObject() + CachedObject(): m_pObject(NULL) { - m_pObject = NULL; - /* A new object is being constructed, so invalidate negative caching. */ ClearCacheNegative(); } - CachedObject( const CachedObject &cpy ) + CachedObject( const CachedObject &cpy ): m_pObject(NULL) { - m_pObject = NULL; ClearCacheNegative(); } diff --git a/src/SongUtil.h b/src/SongUtil.h index 368594adb5..0c0a18043d 100644 --- a/src/SongUtil.h +++ b/src/SongUtil.h @@ -47,8 +47,9 @@ public: } m_Locked; /** @brief Set up some initial song criteria. */ - SongCriteria(): m_sGroupName(""), m_bUseSongGenreAllowedList(false), - m_Selectable(Selectable_DontCare), m_bUseSongAllowedList(false), + SongCriteria(): m_sGroupName(""), m_bUseSongGenreAllowedList(false), + m_vsSongGenreAllowedList(), m_Selectable(Selectable_DontCare), + m_bUseSongAllowedList(false), m_vpSongAllowedList(), m_iMaxStagesForSong(-1), m_Tutorial(Tutorial_DontCare), m_Locked(Locked_DontCare) { @@ -182,7 +183,7 @@ public: * @brief Set up the SongID with default values. * * This used to call Unset() to do the same thing. */ - SongID(): sDir("") { m_Cache.Unset(); } + SongID(): sDir(""), m_Cache() { m_Cache.Unset(); } void Unset() { FromSong(NULL); } void FromSong( const Song *p ); Song *ToSong() const; diff --git a/src/StepsUtil.h b/src/StepsUtil.h index 05aa5a6155..fa61a61900 100644 --- a/src/StepsUtil.h +++ b/src/StepsUtil.h @@ -169,7 +169,7 @@ public: * This used to call Unset(), which set the variables to * the same thing. */ StepsID(): st(StepsType_Invalid), dc(Difficulty_Invalid), - sDescription(""), uHash(0) {} + sDescription(""), uHash(0), m_Cache() {} void Unset() { FromSteps(NULL); } void FromSteps( const Steps *p ); Steps *ToSteps( const Song *p, bool bAllowNull ) const; diff --git a/src/UnlockManager.h b/src/UnlockManager.h index 9874e5401c..f042b60da2 100644 --- a/src/UnlockManager.h +++ b/src/UnlockManager.h @@ -57,9 +57,10 @@ public: * * m_sEntryID starts as an empty string. It will be filled automatically * if not specified. */ - UnlockEntry(): m_Type(UnlockRewardType_Invalid), - m_dc(Difficulty_Invalid), m_bRequirePassHardSteps(false), - m_bRoulette(false), m_sEntryID(RString("")) + UnlockEntry(): m_Type(UnlockRewardType_Invalid), m_cmd(), + m_Song(), m_dc(Difficulty_Invalid), m_Course(), + m_bRequirePassHardSteps(false), m_bRoulette(false), + m_sEntryID(RString("")) { ZERO( m_fRequirement ); } diff --git a/src/arch/InputHandler/InputHandler.h b/src/arch/InputHandler/InputHandler.h index 307f78617b..3564a73552 100644 --- a/src/arch/InputHandler/InputHandler.h +++ b/src/arch/InputHandler/InputHandler.h @@ -25,7 +25,7 @@ public: static void Create( const RString &sDrivers, vector &apAdd ); static DriverList m_pDriverList; - InputHandler(): m_iInputsSinceUpdate(0) {} + InputHandler(): m_LastUpdate(), m_iInputsSinceUpdate(0) {} virtual ~InputHandler() { } virtual void Update() { } virtual bool DevicesChanged() { return false; }