diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2015-05-14 16:49:13 +0200 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2015-05-14 16:49:13 +0200 |
commit | 67b6b71a5b82e18d4d08bd80f311afc18187bd8a (patch) | |
tree | dfad16aabbf07d9a6c1fba46996fd20ae21b563d | |
parent | Merge pull request #1946 from SafwatHalaby/lean (diff) | |
download | cuberite-67b6b71a5b82e18d4d08bd80f311afc18187bd8a.tar cuberite-67b6b71a5b82e18d4d08bd80f311afc18187bd8a.tar.gz cuberite-67b6b71a5b82e18d4d08bd80f311afc18187bd8a.tar.bz2 cuberite-67b6b71a5b82e18d4d08bd80f311afc18187bd8a.tar.lz cuberite-67b6b71a5b82e18d4d08bd80f311afc18187bd8a.tar.xz cuberite-67b6b71a5b82e18d4d08bd80f311afc18187bd8a.tar.zst cuberite-67b6b71a5b82e18d4d08bd80f311afc18187bd8a.zip |
-rw-r--r-- | src/ProbabDistrib.cpp | 1 |
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; } |