summaryrefslogtreecommitdiffstats
path: root/src/ProbabDistrib.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2015-05-19 19:43:19 +0200
committerAlexander Harkness <bearbin@gmail.com>2015-05-19 19:43:19 +0200
commitcbb425f027a7b51c4aed5d3399b26cf325c4c8ce (patch)
tree6a35f2c9c44b7d3d5142635178bf1ec9ca5e428c /src/ProbabDistrib.cpp
parentUpdated Core. (diff)
parentMerge pull request #2057 from Seadragon91/master (diff)
downloadcuberite-cbb425f027a7b51c4aed5d3399b26cf325c4c8ce.tar
cuberite-cbb425f027a7b51c4aed5d3399b26cf325c4c8ce.tar.gz
cuberite-cbb425f027a7b51c4aed5d3399b26cf325c4c8ce.tar.bz2
cuberite-cbb425f027a7b51c4aed5d3399b26cf325c4c8ce.tar.lz
cuberite-cbb425f027a7b51c4aed5d3399b26cf325c4c8ce.tar.xz
cuberite-cbb425f027a7b51c4aed5d3399b26cf325c4c8ce.tar.zst
cuberite-cbb425f027a7b51c4aed5d3399b26cf325c4c8ce.zip
Diffstat (limited to 'src/ProbabDistrib.cpp')
-rw-r--r--src/ProbabDistrib.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/ProbabDistrib.cpp b/src/ProbabDistrib.cpp
index c34c75982..ec3a4d85f 100644
--- a/src/ProbabDistrib.cpp
+++ b/src/ProbabDistrib.cpp
@@ -133,6 +133,7 @@ int cProbabDistrib::MapValue(int a_OrigValue) const
// Linearly interpolate between Lo and Hi:
int ProbDif = m_Cumulative[Hi].m_Probability - m_Cumulative[Lo].m_Probability;
+ ProbDif = (ProbDif != 0) ? ProbDif : 1;
int ValueDif = m_Cumulative[Hi].m_Value - m_Cumulative[Lo].m_Value;
return m_Cumulative[Lo].m_Value + (a_OrigValue - m_Cumulative[Lo].m_Probability) * ValueDif / ProbDif;
}