summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2015-07-11 10:41:20 +0000
committerfrosch <frosch@openttd.org>2015-07-11 10:41:20 +0000
commit8437726cca9662f4494a7101ce920425e46133a2 (patch)
tree716f23cdad7cca1af2ae0a08078e5cb85b2cf08c
parent662408f71a87d74b411aeee03151d59ecf19d298 (diff)
downloadopenttd-8437726cca9662f4494a7101ce920425e46133a2.tar.xz
(svn r27328) -Codechange: Add an assertion to check for uninitialised variables when tracing variety distribution's control curves.
-rw-r--r--src/tgp.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tgp.cpp b/src/tgp.cpp
index 8177b5720..cf597ea87 100644
--- a/src/tgp.cpp
+++ b/src/tgp.cpp
@@ -667,6 +667,7 @@ static void HeightMapCurves(uint level)
for (uint t = 0; t < lengthof(curve_maps); t++) {
if (!HasBit(corner_bits, t)) continue;
+ bool found = false;
const control_point_t *cm = curve_maps[t].list;
for (uint i = 0; i < curve_maps[t].length - 1; i++) {
const control_point_t &p1 = cm[i];
@@ -674,9 +675,11 @@ static void HeightMapCurves(uint level)
if (*h >= p1.x && *h < p2.x) {
ht[t] = p1.y + (*h - p1.x) * (p2.y - p1.y) / (p2.x - p1.x);
+ found = true;
break;
}
}
+ assert(found);
}
/* Apply interpolation of curve map results. */