From d42e23a503fed27f18fa7eba52402d5682884a4c Mon Sep 17 00:00:00 2001 From: Lukas Werling Date: Fri, 22 Dec 2017 23:14:54 +0100 Subject: [PATCH] Change AutoScanSideOpen to check fg as well per default The previous behaviour of only checking the background broke existing maps and triggered some (performance?) bug in the mass mover. It is still available by setting AutoScanSideOpen=2, for symmetry with Top/BottomOpen. --- docs/sdk/scenario/scenario.xml | 2 +- src/landscape/C4Landscape.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/sdk/scenario/scenario.xml b/docs/sdk/scenario/scenario.xml index 5c4bceff4..755b7cde1 100644 --- a/docs/sdk/scenario/scenario.xml +++ b/docs/sdk/scenario/scenario.xml @@ -248,7 +248,7 @@ AutoScanSideOpen Integer - 0 or 1. If 1, the left and right borders are closed if the corresponding map pixel in the left or right row has tunnel background and open otherwise. + 0, 1, or 2. If 1, the left and right borders are closed if the corresponding map pixel in the left or right row has non-sky foreground or background and open otherwise. If 2, it only checks the background. MapWidth diff --git a/src/landscape/C4Landscape.cpp b/src/landscape/C4Landscape.cpp index aafdc0639..a119eba06 100644 --- a/src/landscape/C4Landscape.cpp +++ b/src/landscape/C4Landscape.cpp @@ -2072,14 +2072,19 @@ bool C4Landscape::P::InitBorderPix() if (Game.C4S.Landscape.AutoScanSideOpen) { + // Compatibility: check both foreground and background material per + // default, Top/BottomOpen=2-like behavior with AutoScanSideOpen=2. + bool only_bg = Game.C4S.Landscape.AutoScanSideOpen == 2; LeftColPix.resize(Height); RightColPix.resize(Height); uint8_t map_pix; for (int32_t y = 0; y < Height; ++y) { map_pix = MapBkg->GetPix(0, y / MapZoom); + if (!only_bg) map_pix += Map->GetPix(0, y / MapZoom); LeftColPix[y] = ((map_pix != 0) ? MCVehic : 0); map_pix = MapBkg->GetPix(Map->Wdt - 1, y / MapZoom); + if (!only_bg) map_pix += Map->GetPix(Map->Wdt - 1, y / MapZoom); RightColPix[y] = ((map_pix != 0) ? MCVehic : 0); } }