@@ -301,17 +301,17 @@ static void GrayscaleToMapHeights(uint i
return;
}
if ((img_width * num_div) / img_height > ((width * num_div) / height)) {
/* Image is wider than map - center vertically */
img_scale = (width * num_div) / img_width;
row_pad = (height - ((img_height * img_scale) / num_div)) / 2;
row_pad = (1 + height - ((img_height * img_scale) / num_div)) / 2;
} else {
/* Image is taller than map - center horizontally */
img_scale = (height * num_div) / img_height;
col_pad = (width - ((img_width * img_scale) / num_div)) / 2;
col_pad = (1 + width - ((img_width * img_scale) / num_div)) / 2;
/* Form the landscape */
for (row = 0; row < height - 1; row++) {
for (col = 0; col < width - 1; col++) {
switch (_patches.heightmap_rotation) {
@@ -319,14 +319,14 @@ static void GrayscaleToMapHeights(uint i
case HM_CLOCKWISE: tile = TileXY(row, col); break;
default: NOT_REACHED(); return;
/* Check if current tile is within the 1-pixel map edge or padding regions */
if ((DistanceFromEdge(tile) <= 1) ||
(row < row_pad) || (row >= (img_height + row_pad)) ||
(col < col_pad) || (col >= (img_width + col_pad))) {
(row < row_pad) || (row >= (height - row_pad - 1)) ||
(col < col_pad) || (col >= (width - col_pad - 1))) {
SetTileHeight(tile, 0);
/* Use nearest neighbor resizing to scale map data.
* We rotate the map 45 degrees (counter)clockwise */
img_row = (((row - row_pad) * num_div) / img_scale);
Status change: