mirror of https://github.com/OpenTTD/OpenTTD
(svn r27328) -Codechange: Add an assertion to check for uninitialised variables when tracing variety distribution's control curves.
parent
662408f71a
commit
8437726cca
|
@ -667,6 +667,7 @@ static void HeightMapCurves(uint level)
|
||||||
for (uint t = 0; t < lengthof(curve_maps); t++) {
|
for (uint t = 0; t < lengthof(curve_maps); t++) {
|
||||||
if (!HasBit(corner_bits, t)) continue;
|
if (!HasBit(corner_bits, t)) continue;
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
const control_point_t *cm = curve_maps[t].list;
|
const control_point_t *cm = curve_maps[t].list;
|
||||||
for (uint i = 0; i < curve_maps[t].length - 1; i++) {
|
for (uint i = 0; i < curve_maps[t].length - 1; i++) {
|
||||||
const control_point_t &p1 = cm[i];
|
const control_point_t &p1 = cm[i];
|
||||||
|
@ -674,9 +675,11 @@ static void HeightMapCurves(uint level)
|
||||||
|
|
||||||
if (*h >= p1.x && *h < p2.x) {
|
if (*h >= p1.x && *h < p2.x) {
|
||||||
ht[t] = p1.y + (*h - p1.x) * (p2.y - p1.y) / (p2.x - p1.x);
|
ht[t] = p1.y + (*h - p1.x) * (p2.y - p1.y) / (p2.x - p1.x);
|
||||||
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert(found);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply interpolation of curve map results. */
|
/* Apply interpolation of curve map results. */
|
||||||
|
|
Loading…
Reference in New Issue