diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-02-05 22:45:45 +0100 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-02-05 22:50:18 +0100 |
commit | ca6ef58b1ee8521e4b940ee4883dee714960e413 (patch) | |
tree | 8532add455224b07c07a759e3d906f50c0695888 /src/ProbabDistrib.cpp | |
parent | Merge pull request #2972 from marvinkopf/PlayerAutoComplete (diff) | |
download | cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.gz cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.bz2 cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.lz cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.xz cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.zst cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.zip |
Diffstat (limited to 'src/ProbabDistrib.cpp')
-rw-r--r-- | src/ProbabDistrib.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ProbabDistrib.cpp b/src/ProbabDistrib.cpp index ec3a4d85f..f63aa0605 100644 --- a/src/ProbabDistrib.cpp +++ b/src/ProbabDistrib.cpp @@ -43,7 +43,7 @@ void cProbabDistrib::SetPoints(const cProbabDistrib::cPoints & a_Points) { continue; } - + // Add the current trapezoid to the sum: ProbSum += (LastProb + itr->m_Probability) * (itr->m_Value - LastValue) / 2; LastProb = itr->m_Probability; @@ -89,7 +89,7 @@ bool cProbabDistrib::SetDefString(const AString & a_DefString) } Pts.push_back(cPoint(Value, Prob)); } // for itr - Points[] - + SetPoints(Pts); return true; } @@ -112,7 +112,7 @@ int cProbabDistrib::MapValue(int a_OrigValue) const { ASSERT(a_OrigValue >= 0); ASSERT(a_OrigValue < m_Sum); - + // Binary search through m_Cumulative for placement: size_t Lo = 0; size_t Hi = m_Cumulative.size() - 1; @@ -130,7 +130,7 @@ int cProbabDistrib::MapValue(int a_OrigValue) const } } ASSERT(Hi - Lo == 1); - + // Linearly interpolate between Lo and Hi: int ProbDif = m_Cumulative[Hi].m_Probability - m_Cumulative[Lo].m_Probability; ProbDif = (ProbDif != 0) ? ProbDif : 1; |