Decouple <cstdint>

This commit is contained in:
Martin Natano
2023-04-20 12:34:12 +02:00
parent bcea05dd67
commit aa87f85eef
167 changed files with 1533 additions and 1307 deletions
+5 -4
View File
@@ -21,6 +21,7 @@
#include "NoteDataWithScoring.h"
#include <cstddef>
#include <cstdint>
static RString PercentScoreWeightName( std::size_t i ) { return "PercentScoreWeight" + ScoreEventToString( (ScoreEvent)i ); }
static RString GradeWeightName( std::size_t i ) { return "GradeWeight" + ScoreEventToString( (ScoreEvent)i ); }
@@ -200,7 +201,7 @@ void ScoreKeeperNormal::OnNextSong( int iSongInCourseIndex, const Steps* pSteps,
GAMESTATE->SetProcessedTimingData(nullptr);
}
static int GetScore(int p, int Z, int64_t S, int n)
static int GetScore(int p, int Z, std::int64_t S, int n)
{
/* There's a problem with the scoring system described below. Z/S is truncated
* to an int. However, in some cases we can end up with very small base scores.
@@ -218,7 +219,7 @@ static int GetScore(int p, int Z, int64_t S, int n)
return p * (Z / S) * n;
#elif 1
// This doesn't round down Z/S.
return int(int64_t(p) * n * Z / S);
return int(std::int64_t(p) * n * Z / S);
#else
// This also doesn't round down Z/S. Use this if you don't have 64-bit ints.
return int(p * n * (float(Z) / S));
@@ -279,8 +280,8 @@ void ScoreKeeperNormal::AddScoreInternal( TapNoteScore score )
m_iTapNotesHit++;
const int64_t N = uint64_t(m_iNumTapsAndHolds);
const int64_t sum = (N * (N + 1)) / 2;
const std::int64_t N = std::uint64_t(m_iNumTapsAndHolds);
const std::int64_t sum = (N * (N + 1)) / 2;
const int Z = m_iMaxPossiblePoints/10;
// Don't use a multiplier if the player has failed