Adjust vehicle position filter in ViewportMapDrawVehicles

This commit is contained in:
Jonathan G Rennison
2019-04-16 22:45:49 +01:00
parent 0d93ecb6bf
commit 2a41d783cd

View File

@@ -1578,8 +1578,6 @@ void ViewportMapDrawVehicles(DrawPixelInfo *dpi)
/* The hash area to scan */
const ViewportHashBound vhb = GetViewportHashBound(l, r, t, b);
const int w = UnScaleByZoom(dpi->width, dpi->zoom);
const int h = UnScaleByZoom(dpi->height, dpi->zoom);
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
for (int y = vhb.yl;; y = (y + (1 << 6)) & (0x3F << 6)) {
for (int x = vhb.xl;; x = (x + 1) & 0x3F) {
@@ -1588,10 +1586,9 @@ void ViewportMapDrawVehicles(DrawPixelInfo *dpi)
while (v != nullptr) {
if (!(v->vehstatus & (VS_HIDDEN | VS_UNCLICKABLE)) && (v->type != VEH_EFFECT)) {
Point pt = RemapCoords(v->x_pos, v->y_pos, v->z_pos);
if (pt.x >= l && pt.x < r && pt.y >= t && pt.y < b) {
const int pixel_x = UnScaleByZoomLower(pt.x - dpi->left, dpi->zoom);
if (IsInsideMM(pixel_x, 0, w)) {
const int pixel_y = UnScaleByZoomLower(pt.y - dpi->top, dpi->zoom);
if (IsInsideMM(pixel_y, 0, h))
blitter->SetPixel(dpi->dst_ptr, pixel_x, pixel_y, PC_WHITE);
}
}