Fix #15138: Sometimes small scenery stays when building through it

This commit is contained in:
Hielke Morsink 2021-11-17 11:08:26 +01:00 committed by GitHub
parent 072597f080
commit 8a1bd1f7d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -2,6 +2,7 @@
------------------------------------------------------------------------
- Improved: [#12869] The Tile Inspector windows layout has been tweaked slightly.
- Change: [#15899] Weird bonus for path 0 - likely intended as a queue bonus (original bug).
- Fix: [#15138] Sometimes small scenery stays when building through it.
- Fix: [#15620] Placing track designs at locations blocked by anything results in wrong error message.
- Fix: [#15843] Tile Inspector can be resized too small.
- Fix: [#15844] Tile Inspector has inconsistent text colours.

View File

@ -71,18 +71,19 @@ int32_t map_place_non_scenery_clear_func(TileElement** tile_element, const Coord
}
static bool MapLoc68BABCShouldContinue(
TileElement* tileElement, const CoordsXYRangedZ& pos, CLEAR_FUNC clearFunc, uint8_t flags, money32& price,
TileElement** tileElementPtr, const CoordsXYRangedZ& pos, CLEAR_FUNC clearFunc, uint8_t flags, money32& price,
uint8_t crossingMode, bool canBuildCrossing)
{
if (clearFunc != nullptr)
{
if (!clearFunc(&tileElement, pos, flags, &price))
if (!clearFunc(tileElementPtr, pos, flags, &price))
{
return true;
}
}
// Crossing mode 1: building track over path
auto tileElement = *tileElementPtr;
if (crossingMode == 1 && canBuildCrossing && tileElement->GetType() == TILE_ELEMENT_TYPE_PATH
&& tileElement->GetBaseZ() == pos.baseZ && !tileElement->AsPath()->IsQueue() && !tileElement->AsPath()->IsSloped())
{
@ -153,7 +154,7 @@ GameActions::Result::Ptr MapCanConstructWithClearAt(
if (tileElement->GetOccupiedQuadrants() & (quarterTile.GetBaseQuarterOccupied()))
{
if (MapLoc68BABCShouldContinue(
tileElement, pos, clearFunc, flags, res->Cost, crossingMode, canBuildCrossing))
&tileElement, pos, clearFunc, flags, res->Cost, crossingMode, canBuildCrossing))
{
continue;
}
@ -250,7 +251,7 @@ GameActions::Result::Ptr MapCanConstructWithClearAt(
continue;
}
if (MapLoc68BABCShouldContinue(tileElement, pos, clearFunc, flags, res->Cost, crossingMode, canBuildCrossing))
if (MapLoc68BABCShouldContinue(&tileElement, pos, clearFunc, flags, res->Cost, crossingMode, canBuildCrossing))
{
continue;
}