Skip to content

Commit

Permalink
clang-tidy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Apr 3, 2018
1 parent 1b8c1a7 commit 640ceea
Show file tree
Hide file tree
Showing 31 changed files with 17 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/BitmapText.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class BitmapText : public Actor
class ColorBitmapText : public BitmapText
{
public:
ColorBitmapText * Copy() const;
ColorBitmapText * Copy() const override;
void SetText(const RString &sText, const RString &sAlternateText = "", int iWrapWidthPixels = -1) override;
void ResetText();
void DrawPrimitives() override;
Expand Down
15 changes: 6 additions & 9 deletions src/DownloadManager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#pragma once

#include "global.h"
#if !defined(WITHOUT_NETWORKING)
#include "RageFileManager.h"
Expand Down Expand Up @@ -399,7 +397,7 @@ void DownloadManager::UpdateHTTP(float fDeltaSeconds)

mc = curl_multi_fdset(mHTTPHandle, &fdread, &fdwrite, &fdexcep, &maxfd);
if (mc != CURLM_OK) {
error = "curl_multi_fdset() failed, code " + mc;
error = "curl_multi_fdset() failed, code " + to_string(mc);
return;
}
if (maxfd == -1) {
Expand All @@ -410,7 +408,7 @@ void DownloadManager::UpdateHTTP(float fDeltaSeconds)
}
switch (rc) {
case -1:
error = "select error" + mc;
error = "select error" + to_string(mc);
break;
case 0: /* timeout */
default: /* action */
Expand All @@ -421,7 +419,7 @@ void DownloadManager::UpdateHTTP(float fDeltaSeconds)
//Check for finished downloads
CURLMsg *msg;
int msgs_left;
while (msg = curl_multi_info_read(mHTTPHandle, &msgs_left)) {
while ((msg = curl_multi_info_read(mHTTPHandle, &msgs_left))) {
/* Find out which handle this message is about */
for (int i = 0; i < HTTPRequests.size();++i) {
if (msg->easy_handle == HTTPRequests[i]->handle) {
Expand Down Expand Up @@ -477,7 +475,7 @@ void DownloadManager::UpdatePacks(float fDeltaSeconds)

mc = curl_multi_fdset(mPackHandle, &fdread, &fdwrite, &fdexcep, &maxfd);
if (mc != CURLM_OK) {
error = "curl_multi_fdset() failed, code " + mc;
error = "curl_multi_fdset() failed, code " + to_string(mc);
return;
}
if (maxfd == -1) {
Expand All @@ -488,7 +486,7 @@ void DownloadManager::UpdatePacks(float fDeltaSeconds)
}
switch (rc) {
case -1:
error = "select error" + mc;
error = "select error" + to_string(mc);
break;
case 0: /* timeout */
default: /* action */
Expand All @@ -503,7 +501,7 @@ void DownloadManager::UpdatePacks(float fDeltaSeconds)
int msgs_left;
bool installedPacks = false;
bool finishedADownload = false;
while (msg = curl_multi_info_read(mPackHandle, &msgs_left)) {
while ((msg = curl_multi_info_read(mPackHandle, &msgs_left))) {
/* Find out which handle this message is about */
for (auto i = downloads.begin(); i != downloads.end(); i++) {
if (msg->easy_handle == i->second->handle) {
Expand Down Expand Up @@ -619,7 +617,6 @@ void DownloadManager::UploadScoreWithReplayData(HighScore* hs)
string url = serverURL.Get() + "/upload_score";
curl_httppost *form = nullptr;
curl_httppost *lastPtr = nullptr;
curl_slist *headerlist = nullptr;
SetCURLPOSTScore(curlHandle, form, lastPtr, hs);
string replayString;
vector<float> offsets = hs->GetOffsetVector();
Expand Down
1 change: 0 additions & 1 deletion src/GameCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ void GameCommand::Apply( const vector<PlayerNumber> &vpns ) const

void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
{
const PlayMode OldPlayMode = GAMESTATE->m_PlayMode;

if( m_pm != PlayMode_Invalid )
GAMESTATE->m_PlayMode.Set( m_pm );
Expand Down
1 change: 0 additions & 1 deletion src/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ void GameState::CommitStageStats()
void GameState::FinishStage()
{
// Increment the stage counter.
const int iOldStageIndex = m_iCurrentStageIndex;
++m_iCurrentStageIndex;

m_iNumStagesOfThisSong = 0;
Expand Down
1 change: 0 additions & 1 deletion src/LifeMeterBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ void LifeMeterBar::Load( const PlayerState *pPlayerState, PlayerStageStats *pPla
{
LifeMeter::Load( pPlayerState, pPlayerStageStats );

PlayerNumber pn = pPlayerState->m_PlayerNumber;

DrainType dtype = pPlayerState->m_PlayerOptions.GetStage().m_DrainType;
switch( dtype )
Expand Down
1 change: 0 additions & 1 deletion src/LifeMeterBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class LifeMeterBar : public LifeMeter
float m_fPassingAlpha;
float m_fHotAlpha;

bool m_bMercifulBeginnerInEffect;
float m_fBaseLifeDifficulty;
float m_fLifeDifficulty; // essentially same as pref

Expand Down
2 changes: 1 addition & 1 deletion src/MenuTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void MenuTimer::SetText( float fSeconds )
LuaHelpers::Push( L, fSeconds );

// call function with 1 argument and 1 result
RString Error= "Error running Text" + (i+1);
RString Error= "Error running Text " + to_string(i+1);
Error+= "FormatFunction: ";
LuaHelpers::RunScriptOnStack(L, Error, 1, 1, true);

Expand Down
12 changes: 6 additions & 6 deletions src/MusicWheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,16 +438,16 @@ void MusicWheel::FilterBySearch(vector<Song*>& inv, RString findme) {
else {
if (findauthor == "") {
if (findtitle == "")
check = [&findauthor, &findartist, &findtitle](Song* x) {
check = [&findartist](Song* x) {
return contains(x->GetDisplayArtist(), findartist);
};
else {
if (findartist == "")
check = [&findauthor, &findartist, &findtitle](Song* x) {
check = [&findtitle](Song* x) {
return contains(x->GetDisplayMainTitle(), findtitle);
};
else
check = [&findauthor, &findartist, &findtitle](Song* x) {
check = [&findartist, &findtitle](Song* x) {
return contains(x->GetDisplayArtist(), findartist) ||
contains(x->GetDisplayMainTitle(), findtitle);
};
Expand All @@ -456,17 +456,17 @@ void MusicWheel::FilterBySearch(vector<Song*>& inv, RString findme) {
else {
if (findtitle == "") {
if (findartist == "")
check = [&findauthor, &findartist, &findtitle](Song* x) {
check = [&findauthor](Song* x) {
return contains(x->GetOrTryAtLeastToGetSimfileAuthor(), findauthor);
};
else
check = [&findauthor, &findartist, &findtitle](Song* x) {
check = [&findauthor, &findartist](Song* x) {
return contains(x->GetDisplayArtist(), findartist) ||
contains(x->GetOrTryAtLeastToGetSimfileAuthor(), findauthor);
};
}
else {
check = [&findauthor, &findartist, &findtitle](Song* x) {
check = [&findauthor, &findtitle](Song* x) {
return contains(x->GetDisplayMainTitle(), findtitle) ||
contains(x->GetOrTryAtLeastToGetSimfileAuthor(), findauthor);
};
Expand Down
5 changes: 0 additions & 5 deletions src/MusicWheelItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,6 @@ void MusicWheelItem::RefreshGrades()

m_pGradeDisplay[p]->SetVisible( true );


Profile *pProfile = PROFILEMAN->GetProfile(ps);

HighScoreList *pHSL = NULL;
HighScoreList *BestpHSL = NULL;
Grade gradeBest = Grade_Invalid;
Difficulty dcBest = Difficulty_Invalid;
Expand Down Expand Up @@ -380,7 +376,6 @@ void MusicWheelItem::RefreshGrades()

void MusicWheelItem::HandleMessage( const Message &msg )
{
static const bool iskyzagoodprogrammer = false;
WheelItemBase::HandleMessage( msg );
}

Expand Down
5 changes: 0 additions & 5 deletions src/NoteDataWithScoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,6 @@ void NoteDataWithScoring::GetActualRadarValues(const NoteData &in,

// ScreenGameplay passes in the RadarValues that were calculated by
// NoteDataUtil::CalculateRadarValues, so those are reused here. -Kyz
int note_count= out[RadarCategory_Notes];
int jump_count= out[RadarCategory_Jumps];
int hold_count= out[RadarCategory_Holds];
int tap_count= out[RadarCategory_TapsAndHolds];
float hittable_steps_length= max(0, timing->WhereUAtBro(last_hittable_row) - timing->WhereUAtBro(first_hittable_row));
// The for loop and the assert are used to ensure that all fields of
// RadarValue get set in here.
FOREACH_ENUM(RadarCategory, rc)
Expand Down
1 change: 0 additions & 1 deletion src/NoteField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ void NoteField::DrawPrimitives()
{
ASSERT(GAMESTATE->m_pCurSong != NULL);

const TimingData &timing = *pTiming;
const RageColor text_glow= RageColor(1,1,1,RageFastCos(RageTimer::GetTimeSinceStartFast()*2)/2+0.5f);

float horiz_align= align_right;
Expand Down
17 changes: 0 additions & 17 deletions src/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@ void Player::Load()
if (!m_Timing->ValidSequentialAssumption)
m_pPlayerStageStats->luascriptwasloaded = true;

Profile *pProfile = PROFILEMAN->GetProfile(pn);
const HighScore* pb = SCOREMAN->GetChartPBAt(GAMESTATE->m_pCurSteps[pn]->GetChartKey(), GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate);
if (pb != nullptr)
wifescorepersonalbest = pb->GetWifeScore();
Expand Down Expand Up @@ -652,7 +651,6 @@ void Player::Load()
m_pNoteField->Load( &m_NoteData, iDrawDistanceAfterTargetsPixels, iDrawDistanceBeforeTargetsPixels );
}

bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->GetUsesCenteredArrows();

// set this in Update
//m_pJudgment->SetX( JUDGMENT_X.GetValue(pn,bPlayerUsingBothSides) );
Expand Down Expand Up @@ -1507,7 +1505,6 @@ void Player::DrawHoldJudgments()

void Player::ChangeLife( TapNoteScore tns )
{
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
if( m_pLifeMeter != nullptr )
m_pLifeMeter->ChangeLife( tns );

Expand All @@ -1516,7 +1513,6 @@ void Player::ChangeLife( TapNoteScore tns )

void Player::ChangeLife( HoldNoteScore hns, TapNoteScore tns )
{
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
if( m_pLifeMeter != nullptr )
m_pLifeMeter->ChangeLife( hns, tns );

Expand All @@ -1530,7 +1526,6 @@ void Player::ChangeLife(float delta)
// change) to the time of this change, instead of the sharp change that
// actually occurred. -Kyz
ChangeLifeRecord();
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
if(m_pLifeMeter != nullptr)
{
m_pLifeMeter->ChangeLife(delta);
Expand All @@ -1545,7 +1540,6 @@ void Player::SetLife(float value)
// change) to the time of this change, instead of the sharp change that
// actually occurred. -Kyz
ChangeLifeRecord();
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
if(m_pLifeMeter != nullptr)
{
m_pLifeMeter->SetLife(value);
Expand All @@ -1555,7 +1549,6 @@ void Player::SetLife(float value)

void Player::ChangeLifeRecord()
{
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
float fLife = -1;
if( m_pLifeMeter != nullptr )
{
Expand Down Expand Up @@ -1620,8 +1613,6 @@ int Player::GetClosestNote( int col, int iNoteRow, int iMaxRowsAhead, int iMaxRo
if( iPrevIndex == -1 )
return iNextIndex;

PlayerNumber pn = m_pPlayerState->m_PlayerNumber;

// Get the current time, previous time, and next time.
float fNoteTime = m_pPlayerState->m_Position.m_fMusicSeconds;
float fNextTime = m_Timing->WhereUAtBro(iNextIndex);
Expand Down Expand Up @@ -1676,8 +1667,6 @@ int Player::GetClosestNonEmptyRowDirectional( int iStartRow, int iEndRow, bool /
// Find the closest note to fBeat.
int Player::GetClosestNonEmptyRow( int iNoteRow, int iMaxRowsAhead, int iMaxRowsBehind, bool bAllowGraded ) const
{
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;

// Start at iIndexStartLookingAt and search outward.
int iNextRow = GetClosestNonEmptyRowDirectional( iNoteRow, iNoteRow+iMaxRowsAhead, bAllowGraded, true );
int iPrevRow = GetClosestNonEmptyRowDirectional( iNoteRow-iMaxRowsBehind, iNoteRow, bAllowGraded, false );
Expand Down Expand Up @@ -1726,8 +1715,6 @@ void Player::DoTapScoreNone()

if( m_pLifeMeter != nullptr )
m_pLifeMeter->HandleTapScoreNone();
// TODO: Remove use of PlayerNumber
PlayerNumber pn = PLAYER_INVALID;

if( PENALIZE_TAP_SCORE_NONE )
{
Expand Down Expand Up @@ -1803,9 +1790,6 @@ void Player::Step( int col, int row, const std::chrono::steady_clock::time_point
if( IsOniDead() )
return;

// TODO: remove use of PlayerNumber
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;

// Do everything that depends on a timer here;
// set your breakpoints somewhere after this block.
std::chrono::duration<float> stepDelta = std::chrono::steady_clock::now() - tm;
Expand Down Expand Up @@ -1980,7 +1964,6 @@ void Player::Step( int col, int row, const std::chrono::steady_clock::time_point

const float fSecondsFromExact = fabsf( fNoteOffset );

TapNote tnDummy = TAP_ORIGINAL_TAP;
TapNote *pTN = NULL;
NoteData::iterator iter = m_NoteData.FindTapNote( col, iRowOfOverlappingNoteOrRow );
DEBUG_ASSERT( iter!= m_NoteData.end(col) );
Expand Down
1 change: 0 additions & 1 deletion src/PlayerState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ void PlayerState::Update( float fDelta )
// TRICKY: GAMESTATE->Update is run before any of the Screen update's,
// so we'll clear these flags here and let them get turned on later

bool bRebuildPlayerOptions = false;

// Update after enabling attacks, so we approach the new state.
m_PlayerOptions.Update( fDelta );
Expand Down
4 changes: 2 additions & 2 deletions src/RageDisplay_D3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,12 @@ void RageDisplay_D3D::SendCurrentMatrices()
class RageCompiledGeometrySWD3D : public RageCompiledGeometry
{
public:
void Allocate( const vector<msMesh> &vMeshes )
void Allocate( const vector<msMesh> &vMeshes ) override
{
m_vVertex.resize( max(1u, GetTotalVertices()) );
m_vTriangles.resize( max(1u, GetTotalTriangles()) );
}
void Change( const vector<msMesh> &vMeshes )
void Change( const vector<msMesh> &vMeshes ) override
{
for( unsigned i=0; i<vMeshes.size(); i++ )
{
Expand Down
2 changes: 1 addition & 1 deletion src/RageDisplay_D3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RageDisplay_D3D: public RageDisplay
RString Init( const VideoModeParams &p, bool bAllowUnacceleratedRenderer ) override;

RString GetApiDescription() const override { return "D3D"; }
virtual void GetDisplayResolutions( DisplayResolutions &out ) const;
virtual void GetDisplayResolutions( DisplayResolutions &out ) const override;
void ResolutionChanged() override;
const RagePixelFormatDesc *GetPixelFormatDesc(RagePixelFormat pf) const override;

Expand Down
2 changes: 0 additions & 2 deletions src/RageDisplay_OGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ static int g_iMaxTextureUnits = 0;

/* We don't actually use normals (we don't turn on lighting), there's just
* no GL_T2F_C4F_V3F. */
static const GLenum RageSpriteVertexFormat = GL_T2F_C4F_N3F_V3F;

/* If we support texture matrix scaling, a handle to the vertex program: */
static GLhandleARB g_bTextureMatrixShader = 0;

Expand Down
1 change: 0 additions & 1 deletion src/RageFileDriverTimeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class RageFileDriverTimeout: public RageFileDriver
static void ResetTimeout() { SetTimeout( -1 ); }

private:
RageFileDriver *m_pChild;
ThreadedFileWorker *m_pWorker;
};

Expand Down
1 change: 0 additions & 1 deletion src/RageSurface_Save_PNG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ static void PNG_Warning( png_struct *png, const char *warning )
* objects, and needs to watch out for memleaks. */
static bool RageSurface_Save_PNG( RageFile &f, char szErrorbuf[1024], RageSurface *pImgIn )
{
bool bAlpha = pImgIn->fmt.Amask != 0;
RageSurface *pImg;
bool bDeleteImg = RageSurfaceUtils::ConvertSurface( pImgIn, pImg, pImgIn->w, pImgIn->h, 32,
Swap32BE( 0xFF000000 ),
Expand Down
2 changes: 0 additions & 2 deletions src/RageUtil_BackgroundLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ class BackgroundLoader

bool m_sThreadIsActive;
bool m_sThreadShouldAbort;

RageFileDriverCached *m_pDriver;
};

#endif
Expand Down
2 changes: 0 additions & 2 deletions src/ScreenEvaluation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,6 @@ bool ScreenEvaluation::MenuStart( const InputEventPlus &input )

void ScreenEvaluation::HandleMenuStart()
{
Profile *prof = PROFILEMAN->GetProfile( static_cast<PlayerNumber>(0) );
HighScore * hs = &(m_pStageStats->m_player[0].m_HighScore);
StepsID stepsid;
stepsid.FromSteps(GAMESTATE->m_pCurSteps[PLAYER_1]);
SongID songid;
Expand Down
1 change: 0 additions & 1 deletion src/ScreenGameplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,6 @@ void ScreenGameplay::InitSongQueues()
{
Steps *pSteps = GAMESTATE->m_pCurSteps[pi->GetStepsAndTrailIndex()];
pi->m_vpStepsQueue.push_back(pSteps);
const PlayerOptions &p = pi->GetPlayerState()->m_PlayerOptions.GetCurrent();
}

if (GAMESTATE->IsPlaylistCourse()) {
Expand Down
2 changes: 0 additions & 2 deletions src/ScreenManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ class ScreenManager
void PlaySharedBackgroundOffCommand();
void ZeroNextUpdate();
private:
Screen *m_pInputFocus; // NULL = top of m_ScreenStack

// Screen loads, removals, and concurrent prepares are delayed until the next update.
RString m_sDelayedScreen;
RString m_sDelayedConcurrentPrepare;
Expand Down
1 change: 0 additions & 1 deletion src/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,6 @@ float Song::GetHighestOfSkillsetAllSteps(int x, float rate) const {
}

bool Song::IsSkillsetHighestOfAnySteps(Skillset ss, float rate) {
float o = 0.f;
vector<Steps*> vsteps = GetAllSteps();
FOREACH(Steps*, vsteps, steps) {
auto sortedstuffs = (*steps)->SortSkillsetsAtRate(rate, true);
Expand Down
Loading

0 comments on commit 640ceea

Please sign in to comment.