forked from 0ad/0ad
Fix averaging of heightmaps which broke on giant mapsizes. Thanks Sandarac for reporting.
This was SVN commit r18524.
This commit is contained in:
parent
33e3e6c2ab
commit
ea3492a9a5
@ -1296,12 +1296,12 @@ function paintHeightmap(heightmap, tilemap, pallet, func = undefined)
|
||||
let nearby = [i];
|
||||
|
||||
if (i + hmSize < heightmap.length)
|
||||
{
|
||||
nearby.push(i + hmSize);
|
||||
height = (heightmap[nearby[0]] + heightmap[nearby[1]]) / 2;
|
||||
}
|
||||
|
||||
tile = pallet[tilemap[nearby[randInt(0, nearby.length - 1)]]];
|
||||
|
||||
// Average
|
||||
height = nearby.reduce((sum, value) => sum + value) / nearby.length;
|
||||
}
|
||||
|
||||
setHeight(x, y, height);
|
||||
|
Loading…
Reference in New Issue
Block a user