diff --git a/src/ActorMultiVertex.h b/src/ActorMultiVertex.h index 0e8967df80..eedf94d9b4 100644 --- a/src/ActorMultiVertex.h +++ b/src/ActorMultiVertex.h @@ -33,8 +33,8 @@ public: ActorMultiVertex( const ActorMultiVertex &cpy ); virtual ~ActorMultiVertex(); - void LoadFromNode( const XNode* Node ); - virtual ActorMultiVertex *Copy() const; + void LoadFromNode( const XNode* Node ) override; + virtual ActorMultiVertex *Copy() const override; struct AMV_TweenState { @@ -68,19 +68,19 @@ public: } const AMV_TweenState& AMV_DestTweenState() const { return const_cast(this)->AMV_DestTweenState(); } - virtual void EnableAnimation(bool bEnable); - virtual void Update(float fDelta); - virtual bool EarlyAbortDraw() const; - virtual void DrawPrimitives(); + virtual void EnableAnimation(bool bEnable) override; + virtual void Update(float fDelta) override; + virtual bool EarlyAbortDraw() const override; + virtual void DrawPrimitives() override; virtual void DrawInternal( const AMV_TweenState *TS ); - void SetCurrentTweenStart(); - void EraseHeadTween(); - void UpdatePercentThroughTween( float PercentThroughTween ); - void BeginTweening( float time, ITween *pInterp ); + void SetCurrentTweenStart() override; + void EraseHeadTween() override; + void UpdatePercentThroughTween( float PercentThroughTween ) override; + void BeginTweening( float time, ITween *pInterp ) override; - void StopTweening(); - void FinishTweening(); + void StopTweening() override; + void FinishTweening() override; void SetTexture( RageTexture *Texture ); RageTexture* GetTexture() { return _Texture; }; @@ -119,7 +119,7 @@ public: RectF rect; float delay; }; - int GetNumStates() const { return _states.size(); } + int GetNumStates() const override { return _states.size(); } void AddState(const State& new_state) { _states.push_back(new_state); } void RemoveState(size_t i) { ASSERT(i < _states.size()); _states.erase(_states.begin()+i); } @@ -130,10 +130,10 @@ public: { ASSERT(i < _states.size()); _states[i]= s; } void SetStateProperties(const std::vector& new_states) { _states= new_states; SetState(0); } - void SetState(int i); + void SetState(int i) override; void SetAllStateDelays(float delay); - float GetAnimationLengthSeconds() const; - void SetSecondsIntoAnimation(float seconds); + float GetAnimationLengthSeconds() const override; + void SetSecondsIntoAnimation(float seconds) override; void UpdateAnimationState(bool force_update= false); size_t GetNumQuadStates() const { return AMV_DestTweenState().quad_states.size(); } @@ -148,7 +148,7 @@ public: bool _use_animation_state; bool _decode_movie; - virtual void PushSelf( lua_State *L ); + virtual void PushSelf( lua_State *L ) override; private: RageTexture* _Texture; diff --git a/src/ArrowEffects.cpp b/src/ArrowEffects.cpp index 9c725e9e01..4465d06380 100644 --- a/src/ArrowEffects.cpp +++ b/src/ArrowEffects.cpp @@ -319,8 +319,8 @@ void ArrowEffects::Update() const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pn]; const SongPosition &position = GAMESTATE->m_bIsUsingStepTiming ? GAMESTATE->m_pPlayerState[pn]->m_Position : GAMESTATE->m_Position; - const auto& effects= GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_fEffects; - const auto& accels= GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_fAccels; + const float* effects= GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_fEffects; + const float* accels= GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_fAccels; PerPlayerData &data = g_EffectData[pn]; @@ -514,8 +514,8 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float return fYOffset * fScrollSpeed; } - const auto& fAccels = curr_options->m_fAccels; - const auto& fEffects = curr_options->m_fEffects; + const float* fAccels = curr_options->m_fAccels; + const float* fEffects = curr_options->m_fEffects; // TODO: Don't index by PlayerNumber. PerPlayerData &data = g_EffectData[pPlayerState->m_PlayerNumber]; @@ -636,7 +636,7 @@ float ArrowEffects::GetYPos( const PlayerState* pPlayerState, int iCol, float fY // TODO: Don't index by PlayerNumber. const Style* pStyle = GAMESTATE->GetCurrentStyle(pPlayerState->m_PlayerNumber); const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pPlayerState->m_PlayerNumber]; - const auto& fEffects = curr_options->m_fEffects; + const float* fEffects = curr_options->m_fEffects; // Doing the math with a precalculated result of 0 should be faster than // checking whether tipsy is on. -Kyz @@ -669,7 +669,7 @@ float ArrowEffects::GetYOffsetFromYPos(int iCol, float YPos, float fYReverseOffs { float f = YPos; - const auto& fEffects = curr_options->m_fEffects; + const float* fEffects = curr_options->m_fEffects; // Doing the math with a precalculated result of 0 should be faster than // checking whether tipsy is on. -Kyz // TODO: Don't index by PlayerNumber. @@ -694,7 +694,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float float fPixelOffsetFromCenter = 0; // fill this in below const Style* pStyle = GAMESTATE->GetCurrentStyle(pPlayerState->m_PlayerNumber); - const auto& fEffects = curr_options->m_fEffects; + const float* fEffects = curr_options->m_fEffects; // TODO: Don't index by PlayerNumber. const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pPlayerState->m_PlayerNumber]; @@ -864,7 +864,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float float ArrowEffects::GetRotationX(const PlayerState* pPlayerState, float fYOffset, bool bIsHoldCap, int iCol) { - const auto& fEffects = curr_options->m_fEffects; + const float* fEffects = curr_options->m_fEffects; float fRotation = 0; if( fEffects[PlayerOptions::EFFECT_CONFUSION_X] != 0 || fEffects[PlayerOptions::EFFECT_CONFUSION_X_OFFSET] != 0 || curr_options->m_fConfusionX[iCol] != 0 @@ -879,7 +879,7 @@ float ArrowEffects::GetRotationX(const PlayerState* pPlayerState, float fYOffset float ArrowEffects::GetRotationY(const PlayerState* pPlayerState, float fYOffset, int iCol) { - const auto& fEffects = curr_options->m_fEffects; + const float* fEffects = curr_options->m_fEffects; float fRotation = 0; if( fEffects[PlayerOptions::EFFECT_CONFUSION_Y] != 0 || fEffects[PlayerOptions::EFFECT_CONFUSION_Y_OFFSET] != 0 || curr_options->m_fConfusionY[iCol] != 0 @@ -894,7 +894,7 @@ float ArrowEffects::GetRotationY(const PlayerState* pPlayerState, float fYOffset float ArrowEffects::GetRotationZ( const PlayerState* pPlayerState, float fNoteBeat, bool bIsHoldHead, int iCol ) { - const auto& fEffects = curr_options->m_fEffects; + const float* fEffects = curr_options->m_fEffects; float fRotation = 0; if( fEffects[PlayerOptions::EFFECT_CONFUSION] != 0 || fEffects[PlayerOptions::EFFECT_CONFUSION_OFFSET] != 0 || curr_options->m_fConfusionZ[iCol] != 0 @@ -916,7 +916,7 @@ float ArrowEffects::GetRotationZ( const PlayerState* pPlayerState, float fNoteBe float ArrowEffects::ReceptorGetRotationZ( const PlayerState* pPlayerState, int iCol ) { - const auto& fEffects = curr_options->m_fEffects; + const float* fEffects = curr_options->m_fEffects; float fRotation = 0; if( curr_options->m_fConfusionZ[iCol] != 0 ) @@ -939,7 +939,7 @@ float ArrowEffects::ReceptorGetRotationZ( const PlayerState* pPlayerState, int i float ArrowEffects::ReceptorGetRotationX( const PlayerState* pPlayerState, int iCol ) { - const auto& fEffects = curr_options->m_fEffects; + const float* fEffects = curr_options->m_fEffects; float fRotation = 0; if( curr_options->m_fConfusionX[iCol] != 0 ) @@ -962,7 +962,7 @@ float ArrowEffects::ReceptorGetRotationX( const PlayerState* pPlayerState, int i float ArrowEffects::ReceptorGetRotationY( const PlayerState* pPlayerState, int iCol ) { - const auto& fEffects = curr_options->m_fEffects; + const float* fEffects = curr_options->m_fEffects; float fRotation = 0; if( curr_options->m_fConfusionY[iCol] != 0 ) @@ -985,7 +985,7 @@ float ArrowEffects::ReceptorGetRotationY( const PlayerState* pPlayerState, int i float ArrowEffects::GetMoveX(int iCol) { - const auto& fMoves = curr_options->m_fMovesX; + const float* fMoves = curr_options->m_fMovesX; float f = 0; if( fMoves[iCol] != 0 ) f += ARROW_SIZE * fMoves[iCol]; @@ -994,7 +994,7 @@ float ArrowEffects::GetMoveX(int iCol) float ArrowEffects::GetMoveY(int iCol) { - const auto& fMoves = curr_options->m_fMovesY; + const float* fMoves = curr_options->m_fMovesY; float f = 0; if( fMoves[iCol] != 0 ) f += ARROW_SIZE * fMoves[iCol]; @@ -1003,7 +1003,7 @@ float ArrowEffects::GetMoveY(int iCol) float ArrowEffects::GetMoveZ(int iCol) { - const auto& fMoves = curr_options->m_fMovesZ; + const float* fMoves = curr_options->m_fMovesZ; float f = 0; if( fMoves[iCol] != 0 ) f += ARROW_SIZE * fMoves[iCol]; @@ -1024,7 +1024,7 @@ static float GetCenterLine() static float GetHiddenSudden() { - const auto& fAppearances = curr_options->m_fAppearances; + const float* fAppearances = curr_options->m_fAppearances; return fAppearances[PlayerOptions::APPEARANCE_HIDDEN] * fAppearances[PlayerOptions::APPEARANCE_SUDDEN]; } @@ -1084,7 +1084,7 @@ float ArrowGetPercentVisible(float fYPosWithoutReverse, int iCol, float fYOffset if( fYPos < 0 && curr_options->m_bStealthPastReceptors == false) // past Gray Arrows return 1; // totally visible - const auto& fAppearances = curr_options->m_fAppearances; + const float* fAppearances = curr_options->m_fAppearances; float fVisibleAdjust = 0; @@ -1173,7 +1173,7 @@ float ArrowEffects::GetBrightness( const PlayerState* pPlayerState, float fNoteB float ArrowEffects::GetZPos( const PlayerState* pPlayerState, int iCol, float fYOffset) { float fZPos=0; - const auto& fEffects = curr_options->m_fEffects; + const float* fEffects = curr_options->m_fEffects; const Style* pStyle = GAMESTATE->GetCurrentStyle(pPlayerState->m_PlayerNumber); // TODO: Don't index by PlayerNumber. @@ -1295,7 +1295,7 @@ float ArrowEffects::GetZPos( const PlayerState* pPlayerState, int iCol, float fY bool ArrowEffects::NeedZBuffer() { - const auto& fEffects = curr_options->m_fEffects; + const float* fEffects = curr_options->m_fEffects; // We also need to use the Z buffer if twirl is in play, because of // hold modulation. -vyhd (OpenITG r623) if( fEffects[PlayerOptions::EFFECT_BUMPY] != 0 || diff --git a/src/Background.cpp b/src/Background.cpp index 6b53695651..8b2031ac87 100644 --- a/src/Background.cpp +++ b/src/Background.cpp @@ -669,7 +669,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong ) // Look for the random file marker, and replace the segment with LoadFromRandom. for( unsigned i=0; iGetGlyphsThatFit(line, &used_width); + const size_t fit= m_pFont->GetGlyphsThatFit(line, &used_width); if(fit < line.size()) { line.erase(line.begin()+fit, line.end()); diff --git a/src/BitmapText.h b/src/BitmapText.h index c2d829a9be..f8288b9088 100644 --- a/src/BitmapText.h +++ b/src/BitmapText.h @@ -16,8 +16,8 @@ public: BitmapText &operator=(const BitmapText &cpy); virtual ~BitmapText(); - virtual void LoadFromNode( const XNode* pNode ); - virtual BitmapText *Copy() const; + virtual void LoadFromNode( const XNode* pNode ) override; + virtual BitmapText *Copy() const override; struct BMT_TweenState { @@ -43,16 +43,16 @@ public: } BMT_TweenState const& BMT_DestTweenState() const { return const_cast(this)->BMT_DestTweenState(); } - virtual void SetCurrentTweenStart(); - virtual void EraseHeadTween(); - virtual void UpdatePercentThroughTween(float between); - virtual void BeginTweening(float time, ITween* interp); + virtual void SetCurrentTweenStart() override; + virtual void EraseHeadTween() override; + virtual void UpdatePercentThroughTween(float between) override; + virtual void BeginTweening(float time, ITween* interp) override; // This function exists because the compiler tried to connect a call of // "BeginTweening(1.2f)" to the function above. -Kyz - virtual void BeginTweening(float time, TweenType tt = TWEEN_LINEAR) + virtual void BeginTweening(float time, TweenType tt = TWEEN_LINEAR) override { Actor::BeginTweening(time, tt); } - virtual void StopTweening(); - virtual void FinishTweening(); + virtual void StopTweening() override; + virtual void FinishTweening() override; bool LoadFromFont( const RString& sFontName ); bool LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars ); @@ -65,8 +65,8 @@ public: void CropLineToWidth(size_t l, int width); void CropToWidth(int width); - virtual bool EarlyAbortDraw() const; - virtual void DrawPrimitives(); + virtual bool EarlyAbortDraw() const override; + virtual void DrawPrimitives() override; void SetUppercase( bool b ); void SetRainbowScroll( bool b ) { m_bRainbowScroll = b; } @@ -76,7 +76,7 @@ public: void set_mult_attrs_with_diffuse(bool m); bool get_mult_attrs_with_diffuse(); - void SetHorizAlign( float f ); + void SetHorizAlign( float f ) override; void SetStrokeColor(RageColor c) { BMT_DestTweenState().SetStrokeColor(c); } RageColor const& GetStrokeColor() { return BMT_DestTweenState().GetStrokeColor(); } @@ -107,7 +107,7 @@ public: void ClearAttributes(); // Commands - virtual void PushSelf( lua_State *L ); + virtual void PushSelf( lua_State *L ) override; protected: Font *m_pFont; diff --git a/src/CreateZip.cpp b/src/CreateZip.cpp index 6c2d1734fd..bcb9eeaa5c 100644 --- a/src/CreateZip.cpp +++ b/src/CreateZip.cpp @@ -543,20 +543,22 @@ ulg crc32(ulg crc, const uch *buf, size_t len) class TZip { public: - TZip() = default; + TZip() : pfout(nullptr),ooffset(0),oerr(false),writ(0),hasputcen(false),zfis(0),hfin(0) + { + } ~TZip() = default; // These variables say about the file we're writing into // We can write to pipe, file-by-handle, file-by-name, memory-to-memmapfile - RageFile *pfout{nullptr}; // if valid, we'll write here (for files or pipes) - unsigned ooffset{0}; // for pfout, this is where the pointer was initially - ZRESULT oerr{false}; // did a write operation give rise to an error? - unsigned writ{0}; // how have we written. This is maintained by Add, not write(), to avoid confusion over seeks - unsigned int opos{0}; // current pos in the mmap - unsigned int mapsize{0}; // the size of the map we created - bool hasputcen{false}; // have we yet placed the central directory? + RageFile *pfout; // if valid, we'll write here (for files or pipes) + unsigned ooffset; // for pfout, this is where the pointer was initially + ZRESULT oerr; // did a write operation give rise to an error? + unsigned writ; // how have we written. This is maintained by Add, not write(), to avoid confusion over seeks + unsigned int opos; // current pos in the mmap + unsigned int mapsize; // the size of the map we created + bool hasputcen; // have we yet placed the central directory? // - TZipFileInfo *zfis{nullptr}; // each file gets added onto this list, for writing the table at the end + TZipFileInfo *zfis; // each file gets added onto this list, for writing the table at the end ZRESULT Start(RageFile *f); static unsigned sflush(void *param,const char *buf, unsigned *size); @@ -571,7 +573,7 @@ public: ulg attr; iztimes times; ulg timestamp; // all open_* methods set these long isize,ired; // size is not set until close() on pips ulg crc; // crc is not set until close(). iwrit is cumulative - RageFile *hfin{nullptr}; // for input files and pipes + RageFile *hfin; // for input files and pipes const char *bufin; unsigned int lenin,posin; // for memory // and a variable for what we've done with the input: (i.e. compressed it!) ulg csize; // compressed size, set by the compression routines diff --git a/src/DifficultyList.cpp b/src/DifficultyList.cpp index 44b7186371..902157a150 100644 --- a/src/DifficultyList.cpp +++ b/src/DifficultyList.cpp @@ -14,7 +14,7 @@ /** @brief Specifies the max number of charts available for a song. * * This includes autogenned charts. */ -inline constexpr auto MAX_METERS = (Enum::to_integral(NUM_Difficulty) * Enum::to_integral(NUM_StepsType)) + MAX_EDITS_PER_SONG; +inline constexpr int MAX_METERS = (Enum::to_integral(NUM_Difficulty) * Enum::to_integral(NUM_StepsType)) + MAX_EDITS_PER_SONG; REGISTER_ACTOR_CLASS( StepsDisplayList ); diff --git a/src/ModIcon.cpp b/src/ModIcon.cpp index 758fc2478e..4cd202c407 100644 --- a/src/ModIcon.cpp +++ b/src/ModIcon.cpp @@ -45,7 +45,7 @@ void ModIcon::Load( RString sMetricsGroup ) // stop words STOP_WORDS.Load( sMetricsGroup, "StopWords" ); - // TODO should m_vStopWords be cleared? + m_vStopWords.clear(); split(STOP_WORDS, ",", m_vStopWords); Set(""); diff --git a/src/ModIconRow.cpp b/src/ModIconRow.cpp index b0ef451e3c..86a9817661 100644 --- a/src/ModIconRow.cpp +++ b/src/ModIconRow.cpp @@ -151,11 +151,11 @@ void ModIconRow::SetFromGameState() for( unsigned i=0; im_pSong ); - tmpMsg.SetParam( "Course", pWID->m_pCourse ); - tmpMsg.SetParam( "Text", pWID->m_sText ); - tmpMsg.SetParam( "Type", MusicWheelItemTypeToString(type) ); - tmpMsg.SetParam( "Color", pWID->m_color ); - tmpMsg.SetParam( "Label", pWID->m_sLabel ); - this->HandleMessage( tmpMsg ); + Message setMsg( "Set" ); + setMsg.SetParam( "Song", pWID->m_pSong ); + setMsg.SetParam( "Course", pWID->m_pCourse ); + setMsg.SetParam( "Text", pWID->m_sText ); + setMsg.SetParam( "Type", MusicWheelItemTypeToString(type) ); + setMsg.SetParam( "Color", pWID->m_color ); + setMsg.SetParam( "Label", pWID->m_sLabel ); + this->HandleMessage( setMsg ); RefreshGrades(); } diff --git a/src/NoteData.cpp b/src/NoteData.cpp index 0464d49dee..71f68cefde 100644 --- a/src/NoteData.cpp +++ b/src/NoteData.cpp @@ -30,7 +30,7 @@ bool NoteData::IsComposite() const { for( int track = 0; track < GetNumTracks(); ++track ) { - for (const auto& tn : m_TapNotes[track]) + for (const std::pair& tn : m_TapNotes[track]) if( tn.second.pn != PLAYER_INVALID ) return true; } @@ -1339,6 +1339,15 @@ NoteData::_all_tracks_iterator::_all_tracks_iterator( const _all_t m_pNoteData->AddATIToList(this); } +template +NoteData::_all_tracks_iterator::~_all_tracks_iterator() +{ + if(m_pNoteData != nullptr) + { + m_pNoteData->RemoveATIFromList(this); + } +} + template NoteData::_all_tracks_iterator &NoteData::_all_tracks_iterator::operator=( const _all_tracks_iterator &other ) { diff --git a/src/NoteData.h b/src/NoteData.h index 306b7e01f6..d1bb84c5fd 100644 --- a/src/NoteData.h +++ b/src/NoteData.h @@ -81,7 +81,7 @@ public: public: _all_tracks_iterator( ND &nd, int iStartRow, int iEndRow, bool bReverse, bool bInclusive ); _all_tracks_iterator( const _all_tracks_iterator &other ); - ~_all_tracks_iterator() { if(m_pNoteData != nullptr) { m_pNoteData->RemoveATIFromList(this); } } + ~_all_tracks_iterator(); _all_tracks_iterator &operator=( const _all_tracks_iterator &other ); _all_tracks_iterator &operator++(); // preincrement _all_tracks_iterator operator++( int dummy ); // postincrement diff --git a/src/NoteDisplay.h b/src/NoteDisplay.h index 0e8fb59643..58590fa929 100644 --- a/src/NoteDisplay.h +++ b/src/NoteDisplay.h @@ -297,8 +297,8 @@ struct NoteColumnRenderer : public Actor // and receptor positions follow the splines. It's called by their row // update functions. -Kyz void UpdateReceptorGhostStuff(Actor* receptor) const; - virtual void DrawPrimitives(); - virtual void PushSelf(lua_State* L); + virtual void DrawPrimitives() override; + virtual void PushSelf(lua_State* L) override; struct NCR_TweenState { @@ -321,12 +321,12 @@ struct NoteColumnRenderer : public Actor } const NCR_TweenState& NCR_DestTweenState() const { return const_cast(this)->NCR_DestTweenState(); } - virtual void SetCurrentTweenStart(); - virtual void EraseHeadTween(); - virtual void UpdatePercentThroughTween(float between); - virtual void BeginTweening(float time, ITween* interp); - virtual void StopTweening(); - virtual void FinishTweening(); + virtual void SetCurrentTweenStart() override; + virtual void EraseHeadTween() override; + virtual void UpdatePercentThroughTween(float between) override; + virtual void BeginTweening(float time, ITween* interp) override; + virtual void StopTweening() override; + virtual void FinishTweening() override; NCSplineHandler* GetPosHandler() { return &NCR_DestTweenState().m_pos_handler; } NCSplineHandler* GetRotHandler() { return &NCR_DestTweenState().m_rot_handler; } diff --git a/src/NoteField.cpp b/src/NoteField.cpp index 66fd2d1001..d7ab802e06 100644 --- a/src/NoteField.cpp +++ b/src/NoteField.cpp @@ -674,7 +674,7 @@ float FindLastDisplayedBeat( const PlayerState* pPlayerState, int iDrawDistanceB bool bBoomerang; { - const auto& fAccels = pPlayerState->m_PlayerOptions.GetCurrent().m_fAccels; + const float* fAccels = pPlayerState->m_PlayerOptions.GetCurrent().m_fAccels; bBoomerang = (fAccels[PlayerOptions::ACCEL_BOOMERANG] != 0); } @@ -902,7 +902,7 @@ void NoteField::DrawPrimitives() AttackArray &attacks = GAMESTATE->m_bIsUsingStepTiming ? GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks : GAMESTATE->m_pCurSong->m_Attacks; - for (Attack const &a : attacks) + for (const Attack &a : attacks) { float fBeat = timing.GetBeatFromElapsedTime(a.fStartSecond); if (BeatToNoteRow(fBeat) >= m_FieldRenderArgs.first_row && diff --git a/src/NotesLoaderBMS.cpp b/src/NotesLoaderBMS.cpp index 6e694b8c8d..f1165da370 100644 --- a/src/NotesLoaderBMS.cpp +++ b/src/NotesLoaderBMS.cpp @@ -544,7 +544,7 @@ bool BMSChart::Load( const RString &chartPath ) std::vector lines; Tree.evaluateBMSTree(headers, lines); - for (const auto& line : lines) + for (const RString& line : lines) { RString data = line.substr(7); int measure = atoi(line.substr(1, 3).c_str()); diff --git a/src/OptionRowHandler.h b/src/OptionRowHandler.h index dad4bcd526..02c7009fb0 100644 --- a/src/OptionRowHandler.h +++ b/src/OptionRowHandler.h @@ -205,7 +205,7 @@ inline void VerifySelected(SelectType st, std::vector &selected, const RSt int num_selected = 0; if( st == SELECT_ONE ) { - int first_selected= -1; + size_t first_selected= std::numeric_limits::max(); if(selected.empty()) { LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one " @@ -213,14 +213,14 @@ inline void VerifySelected(SelectType st, std::vector &selected, const RSt "elements.", sName.c_str()); return; } - for(unsigned int e= 0; e < selected.size(); ++e) + for(size_t e= 0; e < selected.size(); ++e) { if(selected[e]) { num_selected++; - if(first_selected == -1) + if(first_selected == std::numeric_limits::max()) { - first_selected= static_cast(e); + first_selected= e; } } } @@ -229,9 +229,9 @@ inline void VerifySelected(SelectType st, std::vector &selected, const RSt LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one " "thing to be selected, but %i out of %i things are selected.", sName.c_str(), num_selected, static_cast(selected.size())); - for(unsigned int e= 0; e < selected.size(); ++e) + for(size_t e= 0; e < selected.size(); ++e) { - if(selected[e] && (first_selected < 0 || e != static_cast(first_selected))) + if(selected[e] && e != first_selected) { selected[e]= false; } diff --git a/src/OptionsCursor.h b/src/OptionsCursor.h index 2a5bdf1da4..cff05b3197 100644 --- a/src/OptionsCursor.h +++ b/src/OptionsCursor.h @@ -18,8 +18,8 @@ public: void Load( const RString &sMetricsGroup, bool bLoadCanGos ); - void StopTweening(); - void BeginTweening( float fSecs, TweenType tt = TWEEN_LINEAR ); + void StopTweening() override; + void BeginTweening( float fSecs, TweenType tt = TWEEN_LINEAR ) override; void SetBarWidth( int iWidth ); int GetBarWidth() const; void SetCanGo( bool bCanGoLeft, bool bCanGoRight ); diff --git a/src/Player.cpp b/src/Player.cpp index 4a2d5e0d25..29971600f8 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -1136,8 +1136,8 @@ void Player::Update( float fDeltaTime ) * .5 before the row. Use a very slow song (around 2 BPM) as a test case: without * rounding, autoplay steps early. -glenn */ const float fPositionSeconds = m_pPlayerState->m_Position.m_fMusicSeconds - PREFSMAN->m_fPadStickSeconds; - const float fSongBeatTmp = m_pPlayerState->GetDisplayedTiming().GetBeatFromElapsedTime( fPositionSeconds ); - const int iRowNow = BeatToNoteRowNotRounded( fSongBeatTmp ); + const float fDisplayedSongBeat = m_pPlayerState->GetDisplayedTiming().GetBeatFromElapsedTime( fPositionSeconds ); + const int iRowNow = BeatToNoteRowNotRounded( fDisplayedSongBeat ); if( iRowNow >= 0 ) { diff --git a/src/Profile.cpp b/src/Profile.cpp index b0443b6c7c..ab8694dfaa 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -96,7 +96,7 @@ void Profile::ClearSongs() int Profile::HighScoresForASong::GetNumTimesPlayed() const { int iCount = 0; - for (const auto& i : m_StepsHighScores) + for (const std::pair& i : m_StepsHighScores) { iCount += i.second.hsl.GetNumTimesPlayed(); } @@ -106,7 +106,7 @@ int Profile::HighScoresForASong::GetNumTimesPlayed() const int Profile::HighScoresForACourse::GetNumTimesPlayed() const { int iCount = 0; - for (const auto& i : m_TrailHighScores) + for (const std::pair& i : m_TrailHighScores) { iCount += i.second.hsl.GetNumTimesPlayed(); } @@ -1605,7 +1605,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const { XNode* pNumSongsPlayedByStyle = pGeneralDataNode->AppendChild("NumSongsPlayedByStyle"); - for (const auto& iter : m_iNumSongsPlayedByStyle) + for (const std::pair& iter : m_iNumSongsPlayedByStyle) { const StyleID &s = iter.first; int iNumPlays = iter.second; diff --git a/src/RageDisplay.h b/src/RageDisplay.h index 81705604a7..a6fb24f345 100644 --- a/src/RageDisplay.h +++ b/src/RageDisplay.h @@ -114,28 +114,33 @@ public: VideoModeParams(const VideoModeParams &other) = default; - VideoModeParams() = default; + VideoModeParams(): windowed(false), width(0), height(0), + bpp(0), rate(0), vsync(false), interlaced(false), + bSmoothLines(false), bTrilinearFiltering(false), + bAnisotropicFiltering(false), bWindowIsFullscreenBorderless(false), + sWindowTitle(RString()), sIconFile(RString()), + PAL(false), fDisplayAspectRatio(0.0f) {} // Subclassing VideoModeParams in ActualVideoModeParams. Make destructor virtual just in case // someone tries to delete one of those through a pointer to base... virtual ~VideoModeParams() = default; - bool windowed{false}; - RString sDisplayId{}; - int width{0}; - int height{0}; - int bpp{0}; - int rate{0}; - bool vsync{false}; - bool interlaced{false}; - bool bSmoothLines{false}; - bool bTrilinearFiltering{false}; - bool bAnisotropicFiltering{false}; - bool bWindowIsFullscreenBorderless{false}; - RString sWindowTitle{}; - RString sIconFile{}; - bool PAL{false}; - float fDisplayAspectRatio{0.0f}; + bool windowed; + RString sDisplayId; + int width; + int height; + int bpp; + int rate; + bool vsync; + bool interlaced; + bool bSmoothLines; + bool bTrilinearFiltering; + bool bAnisotropicFiltering; + bool bWindowIsFullscreenBorderless; + RString sWindowTitle; + RString sIconFile; + bool PAL; + float fDisplayAspectRatio; }; /** diff --git a/src/RageFileManager.cpp b/src/RageFileManager.cpp index ac6337cd7b..c871a49bbb 100644 --- a/src/RageFileManager.cpp +++ b/src/RageFileManager.cpp @@ -114,7 +114,7 @@ size_t zipRead(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n) { RageFile *f = static_cast(pOpaque); - const auto pos = f->Seek(file_ofs); + const int pos = f->Seek(file_ofs); if (pos >= 0 && static_cast(pos) != file_ofs) { return 0; diff --git a/src/RageMath.cpp b/src/RageMath.cpp index 1f270fe3cc..2d9626501d 100644 --- a/src/RageMath.cpp +++ b/src/RageMath.cpp @@ -616,7 +616,7 @@ float RageFastSin(float angle) { if(angle == 0) { return 0; } float index= angle * sine_table_index_mult; - auto first_index= static_cast(index); + auto first_index= static_cast(index); auto second_index= (first_index + 1) % sine_index_mod; float remainder= index - first_index; first_index%= sine_index_mod; diff --git a/src/RageSoundReader_Resample_Good.cpp b/src/RageSoundReader_Resample_Good.cpp index a8a3b4757c..a444ccec2c 100644 --- a/src/RageSoundReader_Resample_Good.cpp +++ b/src/RageSoundReader_Resample_Good.cpp @@ -110,16 +110,7 @@ namespace int GCD( int i1, int i2 ) { - for(;;) - { - unsigned iRem = i2 % i1; - if( iRem == 0 ) - { - return i1; - } - i2 = i1; - i1 = iRem; - } + return std::gcd(i1, i2); } } diff --git a/src/RageSurface.cpp b/src/RageSurface.cpp index 5800e9b7a4..774a77c20b 100644 --- a/src/RageSurface.cpp +++ b/src/RageSurface.cpp @@ -52,8 +52,9 @@ RageSurfaceFormat::RageSurfaceFormat( const RageSurfaceFormat &cpy ): Mask = cpy.Mask; Shift = cpy.Shift; Loss = cpy.Loss; - if( palette ) + if( palette ) { palette = std::make_unique(*palette); + } } void RageSurfaceFormat::GetRGB( uint32_t val, uint8_t *r, uint8_t *g, uint8_t *b ) const diff --git a/src/RageSurfaceUtils.cpp b/src/RageSurfaceUtils.cpp index 428b81af81..4dcadef2df 100644 --- a/src/RageSurfaceUtils.cpp +++ b/src/RageSurfaceUtils.cpp @@ -518,10 +518,10 @@ static bool blit_rgba_to_rgba( const RageSurface *src_surf, const RageSurface *d const int srcskip = src_surf->pitch - width*src_surf->format->BytesPerPixel; const int dstskip = dst_surf->pitch - width*dst_surf->format->BytesPerPixel; - const auto &src_shifts = src_surf->format->Shift; - const auto &dst_shifts = dst_surf->format->Shift; - const auto &src_masks = src_surf->format->Mask; - const auto &dst_masks = dst_surf->format->Mask; + const std::array &src_shifts = src_surf->format->Shift; + const std::array &dst_shifts = dst_surf->format->Shift; + const std::array &src_masks = src_surf->format->Mask; + const std::array &dst_masks = dst_surf->format->Mask; uint8_t lookup[4][256]; for( int c = 0; c < 4; ++c ) @@ -833,44 +833,44 @@ RageSurface *RageSurfaceUtils::LoadSurface( RString file ) * two bits are the alpha component. * * This gives us a generic way to handle arbitrary 8-bit texture formats. */ -RageSurface *RageSurfaceUtils::PalettizeToGrayscale( const RageSurface *src_surf, uint32_t GrayBits, uint32_t AlphaBits ) +RageSurface *RageSurfaceUtils::PalettizeToGrayscale( const RageSurface *src_surf, unsigned int GrayBits, unsigned int AlphaBits ) { AlphaBits = std::min( AlphaBits, 8-src_surf->format->Loss[3] ); - const auto TotalBits = GrayBits + AlphaBits; + const unsigned int TotalBits = GrayBits + AlphaBits; ASSERT( TotalBits <= 8 ); RageSurface *dst_surf = CreateSurface(src_surf->w, src_surf->h, 8, 0,0,0,0 ); // Set up the palette. - const auto TotalColors = 1u << TotalBits; - const auto Ivalues = 1u << GrayBits; // number of intensity values - const auto Ishift = 0u; // intensity shift - const auto Imask = ((1u << GrayBits) - 1u) << Ishift; // intensity mask - const auto Iloss = 8u-GrayBits; + const unsigned int TotalColors = 1u << TotalBits; + const unsigned int Ivalues = 1u << GrayBits; // number of intensity values + const unsigned int Ishift = 0u; // intensity shift + const unsigned int Imask = ((1u << GrayBits) - 1u) << Ishift; // intensity mask + const unsigned int Iloss = 8u-GrayBits; - const auto Avalues = 1u << AlphaBits; // number of alpha values - const auto Ashift = GrayBits; // alpha shift - const auto Amask = ((1u << AlphaBits) - 1u) << Ashift; // alpha mask - const auto Aloss = 8u-AlphaBits; + const unsigned int Avalues = 1u << AlphaBits; // number of alpha values + const unsigned int Ashift = GrayBits; // alpha shift + const unsigned int Amask = ((1u << AlphaBits) - 1u) << Ashift; // alpha mask + const unsigned int Aloss = 8u-AlphaBits; for( size_t index = 0; index < TotalColors; ++index ) { - const auto I = (index & Imask) >> Ishift; - const auto A = (index & Amask) >> Ashift; + const unsigned int I = (index & Imask) >> Ishift; + const unsigned int A = (index & Amask) >> Ashift; // if only one intensity value, always fullbright - const auto ScaledI = Ivalues == 1 ? 255 : clamp( lrintf(I * (255.0f / (Ivalues-1))), 0L, 255L ); + const uint8_t ScaledI = Ivalues == 1 ? 255 : clamp( lrintf(I * (255.0f / (Ivalues-1))), 0L, 255L ); // if only one alpha value, always opaque - const auto ScaledA = Avalues == 1 ? 255 : clamp( lrintf(A * (255.0f / (Avalues-1))), 0L, 255L ); + const uint8_t ScaledA = Avalues == 1 ? 255 : clamp( lrintf(A * (255.0f / (Avalues-1))), 0L, 255L ); RageSurfaceColor c; - c.r = uint8_t(ScaledI); - c.g = uint8_t(ScaledI); - c.b = uint8_t(ScaledI); - c.a = uint8_t(ScaledA); + c.r = ScaledI; + c.g = ScaledI; + c.b = ScaledI; + c.a = ScaledA; dst_surf->fmt.palette->colors[index] = c; } diff --git a/src/RageSurfaceUtils.h b/src/RageSurfaceUtils.h index a39dbcffe4..9eb1c07f33 100644 --- a/src/RageSurfaceUtils.h +++ b/src/RageSurfaceUtils.h @@ -55,7 +55,7 @@ namespace RageSurfaceUtils RageSurface *LoadSurface( RString file ); /* Quickly palettize to an gray/alpha texture. */ - RageSurface *PalettizeToGrayscale( const RageSurface *src_surf, uint32_t GrayBits, uint32_t AlphaBits ); + RageSurface *PalettizeToGrayscale( const RageSurface *src_surf, unsigned int GrayBits, unsigned int AlphaBits ); RageSurface *MakeDummySurface( int height, int width ); diff --git a/src/RageSurfaceUtils_Palettize.cpp b/src/RageSurfaceUtils_Palettize.cpp index d3afdd1e0e..b4a81d186a 100644 --- a/src/RageSurfaceUtils_Palettize.cpp +++ b/src/RageSurfaceUtils_Palettize.cpp @@ -156,7 +156,7 @@ void RageSurfaceUtils::Palettize( RageSurface *&pImg, int iColors, bool bDither // Rescale the palette colors to a maxval of 255. { - auto& pal = pRet->format->palette; + std::unique_ptr& pal = pRet->format->palette; for( int x = 0; x < pal->ncolors; ++x ) { // This is really just PAM_DEPTH() broken out for the palette. diff --git a/src/RageSurface_Load_JPEG.cpp b/src/RageSurface_Load_JPEG.cpp index d839263d10..1d731996e2 100644 --- a/src/RageSurface_Load_JPEG.cpp +++ b/src/RageSurface_Load_JPEG.cpp @@ -26,13 +26,9 @@ extern "C" { struct my_jpeg_error_mgr { struct jpeg_error_mgr pub; /* "public" fields */ - - uint8_t pad1[8]; // Explicitly add padding that's implicitly added by the compiler - - jmp_buf setjmp_buffer; /* for return to caller */ + char errorbuf[JMSG_LENGTH_MAX]; - - uint8_t pad2[8]; // Explicitly add padding that's implicitly added by the compiler + jmp_buf setjmp_buffer; /* for return to caller */ }; void my_output_message( j_common_ptr cinfo ) diff --git a/src/RageTypes.h b/src/RageTypes.h index 4b13941783..fb86290392 100644 --- a/src/RageTypes.h +++ b/src/RageTypes.h @@ -103,7 +103,7 @@ struct lua_State; struct RageVector2 { public: - RageVector2() = default; + RageVector2(): x(0), y(0) {} RageVector2( const float * f ): x(f[0]), y(f[1]) {} RageVector2( float x1, float y1 ): x(x1), y(y1) {} @@ -125,14 +125,14 @@ public: friend RageVector2 operator * ( float f, const RageVector2& other ) { return other*f; } - float x{0}, y{0}; + float x, y; }; struct RageVector3 { public: - RageVector3() = default; + RageVector3(): x(0), y(0), z(0) {} RageVector3( const float * f ): x(f[0]), y(f[1]), z(f[2]) {} RageVector3( float x1, float y1, float z1 ): x(x1), y(y1), z(z1) {} @@ -154,14 +154,14 @@ public: friend RageVector3 operator * ( float f, const RageVector3& other ) { return other*f; } - float x{0}, y{0}, z{0}; + float x, y, z; }; struct RageVector4 { public: - RageVector4() = default; + RageVector4(): x(0), y(0), z(0), w(0) {} RageVector4( const float * f ): x(f[0]), y(f[1]), z(f[2]), w(f[3]) {} RageVector4( float x1, float y1, float z1, float w1 ): x(x1), y(y1), z(z1), w(w1) {} @@ -183,13 +183,13 @@ public: friend RageVector4 operator * ( float f, const RageVector4& other ) { return other*f; } - float x{0}, y{0}, z{0}, w{0}; + float x, y, z, w; }; struct RageColor { public: - RageColor() = default; + RageColor(): r(0), g(0), b(0), a(0) {} explicit RageColor( const float * f ): r(f[0]), g(f[1]), b(f[2]), a(f[3]) {} RageColor( float r1, float g1, float b1, float a1 ): r(r1), g(g1), b(b1), a(a1) {} @@ -261,7 +261,7 @@ public: void FromStack( lua_State *L, int iPos ); void FromStackCompat( lua_State *L, int iPos ); - float r{0}, g{0}, b{0}, a{0}; + float r, g, b, a; }; /* Convert floating-point 0..1 value to integer 0..255 value. * @@ -320,9 +320,9 @@ inline unsigned char FTOC(float a) class RageVColor { public: - uint8_t b{0},g{0},r{0},a{0}; // specific ordering required by Direct3D + uint8_t b,g,r,a; // specific ordering required by Direct3D - RageVColor() = default; + RageVColor(): b(0), g(0), r(0), a(0) { } RageVColor(const RageColor &rc): b(0), g(0), r(0), a(0) { *this = rc; } RageVColor &operator= (const RageColor &rc) { @@ -337,7 +337,7 @@ namespace StepMania class Rect { public: - Rect() = default; + Rect(): left(0), top(0), right(0), bottom(0) {} Rect(T l, T t, T r, T b): left(l), top(t), right(r), bottom(b) {} T GetWidth() const { return right-left; }; @@ -357,7 +357,7 @@ public: } bool operator!=( const Rect &other ) const { return !operator==(other); } - T left{}, top{}, right{}, bottom{}; + T left, top, right, bottom; }; } typedef StepMania::Rect RectI; @@ -367,11 +367,11 @@ typedef StepMania::Rect RectF; * have the same layout that D3D expects. */ struct RageSpriteVertex // has color { - RageSpriteVertex() = default; - RageVector3 p{}; // position - RageVector3 n{}; // normal - RageVColor c{}; // diffuse color - RageVector2 t{}; // texture coordinates + RageSpriteVertex(): p(), n(), c(), t() {} + RageVector3 p; // position + RageVector3 n; // normal + RageVColor c; // diffuse color + RageVector2 t; // texture coordinates }; void lerp_rage_color(RageColor& out, RageColor const& a, RageColor const& b, float t); @@ -379,12 +379,19 @@ void WeightedAvergeOfRSVs(RageSpriteVertex& average_out, RageSpriteVertex const& struct RageModelVertex // doesn't have color. Relies on material color { - RageModelVertex() = default; - RageVector3 p{}; // position - RageVector3 n{}; // normal - RageVector2 t{}; // texture coordinates - int8_t bone{0}; - RageVector2 TextureMatrixScale{1,1}; // usually 1,1 + /* Zero out by default. */ + RageModelVertex(): + p(0,0,0), + n(0,0,0), + t(0,0), + bone(0), + TextureMatrixScale(1,1) + { } + RageVector3 p; // position + RageVector3 n; // normal + RageVector2 t; // texture coordinates + int8_t bone; + RageVector2 TextureMatrixScale; // usually 1,1 }; diff --git a/src/RageUtil.cpp b/src/RageUtil.cpp index e68bae4ec9..b75054834b 100644 --- a/src/RageUtil.cpp +++ b/src/RageUtil.cpp @@ -1981,7 +1981,7 @@ void ReplaceEntityText( RString &sText, const std::map &m ) { RString sFind; - for (const auto &c : m) + for (const std::pair &c : m) sFind.append( 1, c.first ); RString sRet; diff --git a/src/RageUtil_AutoPtr.h b/src/RageUtil_AutoPtr.h index 4ba59b6bae..6cfb301007 100644 --- a/src/RageUtil_AutoPtr.h +++ b/src/RageUtil_AutoPtr.h @@ -176,7 +176,7 @@ public: } #endif - bool isNull() const { return !m_pPtr; } + bool isNull() const { return m_pPtr != nullptr; } private: T *m_pPtr; diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 1d7a9137c5..fafa50050e 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -5256,7 +5256,7 @@ void ScreenEdit::HandleAlterMenuChoice(AlterMenuChoice c, const std::vector case tempo: { // This affects all steps. - const auto tt = static_cast(answers[c]); + const TempoType tt = static_cast(answers[c]); float fScale = -1; switch( tt ) diff --git a/src/ScreenSelectMaster.cpp b/src/ScreenSelectMaster.cpp index 571a8c90aa..fc32af0fe0 100644 --- a/src/ScreenSelectMaster.cpp +++ b/src/ScreenSelectMaster.cpp @@ -374,7 +374,7 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM ) if( SM == SM_PlayPostSwitchPage ) { - const auto iNewChoice = m_iChoice[ GAMESTATE->GetMasterPlayerNumber() ]; + const int iNewChoice = m_iChoice[ GAMESTATE->GetMasterPlayerNumber() ]; Page newPage = GetPage( iNewChoice ); Message msg("PostSwitchPage"); @@ -390,7 +390,7 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM ) { for (PlayerNumber const &p : vpns) { - const auto iChoice = m_iChoice[p]; + const int iChoice = m_iChoice[p]; m_vsprScroll[p][iChoice]->HandleMessage( msg ); } } @@ -460,7 +460,7 @@ void ScreenSelectMaster::UpdateSelectableChoices() for ( PlayerNumber &p : vpns) { - if(disabled && m_iChoice[p] == static_cast(c)) + if(disabled && m_iChoice[p] == static_cast(c)) { on_unplayable[p]= true; } @@ -503,7 +503,7 @@ bool ScreenSelectMaster::Move( PlayerNumber pn, MenuDir dir ) if( !AnyOptionsArePlayable() ) return false; - auto iSwitchToIndex = m_iChoice[pn]; + int iSwitchToIndex = m_iChoice[pn]; std::set seen; do diff --git a/src/SongManager.cpp b/src/SongManager.cpp index 94a1c3102c..e6de89464f 100644 --- a/src/SongManager.cpp +++ b/src/SongManager.cpp @@ -575,7 +575,7 @@ void SongManager::UnlistSong(Song *song) // remove all occurences of the song in each of our song vectors std::vector* songVectors[3] = { &m_pSongs, &m_pPopularSongs, &m_pShuffledSongs }; for (int songVecIdx=0; songVecIdx<3; ++songVecIdx) { - auto& v = *songVectors[songVecIdx]; + std::vector& v = *songVectors[songVecIdx]; std::erase_if( v, [song](Song* vSong){return vSong == song;} ); } } diff --git a/src/SongOptions.h b/src/SongOptions.h index d6752e9b19..94152ea32a 100644 --- a/src/SongOptions.h +++ b/src/SongOptions.h @@ -33,18 +33,27 @@ LuaDeclareType( SoundEffectType ); class SongOptions { public: - bool m_bAssistClap{false}; - bool m_bAssistMetronome{false}; - float m_fMusicRate{1.0f}, m_SpeedfMusicRate{1.0f}; - float m_fHaste{0.0f}, m_SpeedfHaste{1.0f}; - AutosyncType m_AutosyncType{AutosyncType_Off}; - SoundEffectType m_SoundEffectType{SoundEffectType_Off}; - bool m_bStaticBackground{false}; - bool m_bRandomBGOnly{false}; - bool m_bSaveScore{true}; - bool m_bSaveReplay{false}; + bool m_bAssistClap; + bool m_bAssistMetronome; + float m_fMusicRate, m_SpeedfMusicRate; + float m_fHaste, m_SpeedfHaste; + AutosyncType m_AutosyncType; + SoundEffectType m_SoundEffectType; + bool m_bStaticBackground; + bool m_bRandomBGOnly; + bool m_bSaveScore; + bool m_bSaveReplay; - SongOptions() = default; + /** + * @brief Set up the SongOptions with reasonable defaults. + */ + SongOptions(): m_bAssistClap(false), + m_bAssistMetronome(false), m_fMusicRate(1.0f), + m_SpeedfMusicRate(1.0f), m_fHaste(0.0f), + m_SpeedfHaste(1.0f), m_AutosyncType(AutosyncType_Off), + m_SoundEffectType(SoundEffectType_Off), + m_bStaticBackground(false), m_bRandomBGOnly(false), + m_bSaveScore(true), m_bSaveReplay(false) {}; void Init() { *this = {}; } void Approach( const SongOptions& other, float fDeltaSeconds ); void GetMods( std::vector &AddTo ) const; diff --git a/src/Sprite.h b/src/Sprite.h index b04aff4cdd..100f145c44 100644 --- a/src/Sprite.h +++ b/src/Sprite.h @@ -27,14 +27,14 @@ public: // See explanation in source. static Sprite* NewBlankSprite(); - virtual void InitState(); + virtual void InitState() override; - void LoadFromNode( const XNode* pNode ); - virtual Sprite *Copy() const; + void LoadFromNode( const XNode* pNode ) override; + virtual Sprite *Copy() const override; - virtual bool EarlyAbortDraw() const; - virtual void DrawPrimitives(); - virtual void Update( float fDeltaTime ); + virtual bool EarlyAbortDraw() const override; + virtual void DrawPrimitives() override; + virtual void Update( float fDeltaTime ) override; void UpdateAnimationState(); // take m_fSecondsIntoState, and move to a new state @@ -50,15 +50,15 @@ public: void UnloadTexture(); RageTexture* GetTexture() { return m_pTexture; }; - virtual void EnableAnimation( bool bEnable ); + virtual void EnableAnimation( bool bEnable ) override; - virtual int GetNumStates() const; - virtual void SetState( int iNewState ); + virtual int GetNumStates() const override; + virtual void SetState( int iNewState ) override; int GetState() { return m_iCurState; } - virtual float GetAnimationLengthSeconds() const + virtual float GetAnimationLengthSeconds() const override { return m_animation_length_seconds; } virtual void RecalcAnimationLengthSeconds(); - virtual void SetSecondsIntoAnimation( float fSeconds ); + virtual void SetSecondsIntoAnimation( float fSeconds ) override; void SetStateProperties(const std::vector& new_states) { m_States= new_states; RecalcAnimationLengthSeconds(); SetState(0); } @@ -91,7 +91,7 @@ public: void CropTo( float fWidth, float fHeight ); // Commands - virtual void PushSelf( lua_State *L ); + virtual void PushSelf( lua_State *L ) override; void SetAllStateDelays(float fDelay); diff --git a/src/StageStats.cpp b/src/StageStats.cpp index b04522ae17..097f6ad8d4 100644 --- a/src/StageStats.cpp +++ b/src/StageStats.cpp @@ -314,7 +314,7 @@ bool StageStats::PlayerHasHighScore( PlayerNumber pn ) const PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse, pTrail) : PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong, pSteps); - const auto iScore = m_player[pn].m_iScore; + const unsigned int iScore = m_player[pn].m_iScore; float fPercentDP = m_player[pn].GetPercentDancePoints(); for( int h=0; h<(int)hsl.vHighScores.size() && hm_iMaxHighScoresPerListForMachine; ++h ) { diff --git a/src/StepsUtil.cpp b/src/StepsUtil.cpp index 00983c74d9..da9432e17c 100644 --- a/src/StepsUtil.cpp +++ b/src/StepsUtil.cpp @@ -65,7 +65,7 @@ void StepsUtil::GetAllMatchingEndless( Song *pSong, const StepsCriteria &stc, st { const std::vector &vSteps = ( stc.m_st == StepsType_Invalid ? pSong->GetAllSteps() : pSong->GetStepsByStepsType( stc.m_st ) ); - const auto previousSize = out.size(); + const size_t previousSize = out.size(); int successful = false; GetAllMatching( pSong, stc, out ); diff --git a/src/TimingData.cpp b/src/TimingData.cpp index 263fe9703c..e77b296a74 100644 --- a/src/TimingData.cpp +++ b/src/TimingData.cpp @@ -274,7 +274,7 @@ void TimingData::ShiftRange(int start_row, int end_row, // the rows of the segments, the second time removing segments that // have been run over by a segment being moved. Attempts to combine // both operations into a single loop were error prone. -Kyz - for(size_t i= first_affected; last_affected >= 0 && i <= static_cast(last_affected) && i < segs.size(); ++i) + for(size_t i= first_affected; i <= static_cast(last_affected) && i < segs.size(); ++i) { int seg_row= segs[i]->GetRow(); if(seg_row > 0 && seg_row >= start_row && seg_row <= end_row) @@ -284,7 +284,7 @@ void TimingData::ShiftRange(int start_row, int end_row, } } #define ERASE_SEG(s) if(segs.size() > 1) { EraseSegment(segs, s, segs[s]); --i; --last_affected; erased= true; } - for(size_t i= first_affected; last_affected >= 0 && i <= static_cast(last_affected) && i < segs.size(); ++i) + for(size_t i= first_affected; i <= static_cast(last_affected) && i < segs.size(); ++i) { bool erased= false; int seg_row= segs[i]->GetRow(); diff --git a/src/arch/InputHandler/InputHandler_DirectInput.cpp b/src/arch/InputHandler/InputHandler_DirectInput.cpp index 6f15efec41..b38ee10f42 100644 --- a/src/arch/InputHandler/InputHandler_DirectInput.cpp +++ b/src/arch/InputHandler/InputHandler_DirectInput.cpp @@ -771,8 +771,8 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm } } -inline constexpr auto XINPUT_GAMEPAD_THUMB_MIN = std::numeric_limits::min(); -inline constexpr auto XINPUT_GAMEPAD_THUMB_MAX = std::numeric_limits::max(); +inline constexpr short XINPUT_GAMEPAD_THUMB_MIN = std::numeric_limits::min(); +inline constexpr short XINPUT_GAMEPAD_THUMB_MAX = std::numeric_limits::max(); void InputHandler_DInput::UpdateXInput( XIDevice &device, const RageTimer &tm ) { diff --git a/src/arch/InputHandler/InputHandler_Linux_Event.cpp b/src/arch/InputHandler/InputHandler_Linux_Event.cpp index c9a0896bed..332d627fbe 100644 --- a/src/arch/InputHandler/InputHandler_Linux_Event.cpp +++ b/src/arch/InputHandler/InputHandler_Linux_Event.cpp @@ -263,6 +263,9 @@ EventDevice::~EventDevice() } InputHandler_Linux_Event::InputHandler_Linux_Event() + : m_NextDevice(DEVICE_JOY10) + , m_bShutdown(true) + , m_bDevicesChanged(false) { if(LINUXINPUT == nullptr) LINUXINPUT = new LinuxInputManager; LINUXINPUT->InitDriver(this); diff --git a/src/arch/InputHandler/InputHandler_Linux_Event.h b/src/arch/InputHandler/InputHandler_Linux_Event.h index d6ce9cde5b..1028a5af2e 100644 --- a/src/arch/InputHandler/InputHandler_Linux_Event.h +++ b/src/arch/InputHandler/InputHandler_Linux_Event.h @@ -23,8 +23,8 @@ private: void InputThread(); RageThread m_InputThread; - InputDevice m_NextDevice{DEVICE_JOY10}; - bool m_bShutdown{true}, m_bDevicesChanged{false}; + InputDevice m_NextDevice; + bool m_bShutdown, m_bDevicesChanged; }; #define USE_INPUT_HANDLER_LINUX_JOYSTICK diff --git a/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp b/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp index 65740f184e..702b973626 100644 --- a/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp +++ b/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp @@ -388,8 +388,8 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe // with as close to our desired refresh rate as possible. for (int i = 0; i < scrRes->nmode; i++) { const XRRModeInfo &thisMI = scrRes->modes[i]; - const auto modeWidth = bPortrait ? thisMI.height : thisMI.width; - const auto modeHeight = bPortrait ? thisMI.width : thisMI.height; + const unsigned int modeWidth = bPortrait ? thisMI.height : thisMI.width; + const unsigned int modeHeight = bPortrait ? thisMI.width : thisMI.height; if (p.width >= 0 && p.height >= 0 && modeWidth == static_cast(p.width) && modeHeight == static_cast(p.height)) { float fTempRefresh = calcRandRRefresh(thisMI.dotClock, thisMI.hTotal, thisMI.vTotal); float fTempDiff = std::abs(p.rate - fTempRefresh);