summaryrefslogtreecommitdiffstats
path: root/src/ProbabDistrib.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:45:45 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:50:18 +0100
commitca6ef58b1ee8521e4b940ee4883dee714960e413 (patch)
tree8532add455224b07c07a759e3d906f50c0695888 /src/ProbabDistrib.cpp
parentMerge pull request #2972 from marvinkopf/PlayerAutoComplete (diff)
downloadcuberite-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.cpp8
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;