summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-17 14:24:57 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-17 14:24:57 +0100
commit38445238820da20d86e864de54dc4c1f9a22febd (patch)
tree4b8effcbf08939ae3acc7dfe0a148d00d0939a43 /source
parentFluid simulator: fixed an out-of-bounds read when determining fluid direction (diff)
downloadcuberite-38445238820da20d86e864de54dc4c1f9a22febd.tar
cuberite-38445238820da20d86e864de54dc4c1f9a22febd.tar.gz
cuberite-38445238820da20d86e864de54dc4c1f9a22febd.tar.bz2
cuberite-38445238820da20d86e864de54dc4c1f9a22febd.tar.lz
cuberite-38445238820da20d86e864de54dc4c1f9a22febd.tar.xz
cuberite-38445238820da20d86e864de54dc4c1f9a22febd.tar.zst
cuberite-38445238820da20d86e864de54dc4c1f9a22febd.zip
Diffstat (limited to '')
-rw-r--r--source/ProbabDistrib.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/ProbabDistrib.cpp b/source/ProbabDistrib.cpp
index fbc9f9428..98c18b8e1 100644
--- a/source/ProbabDistrib.cpp
+++ b/source/ProbabDistrib.cpp
@@ -31,10 +31,11 @@ void cProbabDistrib::SetPoints(const cProbabDistrib::cPoints & a_Points)
m_Cumulative.reserve(a_Points.size() + 1);
int ProbSum = 0;
int LastProb = 0;
- int LastValue = 0;
+ int LastValue = -1;
if (a_Points[0].m_Value != 0)
{
m_Cumulative.push_back(cPoint(0, 0)); // Always push in the [0, 0] point for easier search algorithm bounds
+ LastValue = 0;
}
for (cPoints::const_iterator itr = a_Points.begin(), end = a_Points.end(); itr != end; ++itr)
{