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.
install-platforms
Lukas Werling 2017-12-22 23:14:54 +01:00
parent 2c4f1a0b6d
commit d42e23a503
2 changed files with 6 additions and 1 deletions

View File

@ -248,7 +248,7 @@
<row>
<literal_col>AutoScanSideOpen</literal_col>
<col>Integer</col>
<col>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.</col>
<col>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.</col>
</row>
<row>
<literal_col>MapWidth</literal_col>

View File

@ -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);
}
}