Chunnel patch 28396: Codechange: Chunnel portal must have minimal length of 4 tiles.

https://www.tt-forums.net/viewtopic.php?p=1183416#p1183416
This commit is contained in:
HackaLittleBit
2017-03-04 11:47:20 +00:00
committed by Jonathan G Rennison
parent dee526c6d6
commit dfce9cc4c0
6 changed files with 24 additions and 5 deletions

View File

@@ -44,9 +44,10 @@ TileIndex GetOtherTunnelEnd(TileIndex tile)
* Is there a tunnel in the way in any direction?
* @param tile the tile to search from.
* @param z the 'z' to search on.
* @param not_allowed Only terra forming does not search between tunnel portals.
* @return true if and only if there is a tunnel.
*/
bool IsTunnelInWay(TileIndex tile, int z)
bool IsTunnelInWay(TileIndex tile, int z, bool not_allowed)
{
uint x = TileX(tile);
uint y = TileY(tile);
@@ -61,6 +62,12 @@ bool IsTunnelInWay(TileIndex tile, int z)
if (TileY(t->tile_n) != y || (int)TileHeight(t->tile_n) != z) continue; // dir DIAGDIR_SW
}
if (t->is_chunnel > not_allowed) {
/* Only if tunnel was build over water terraforming is allowed between portals. */
TileIndexDiff delta = GetTunnelBridgeDirection(t->tile_n) == DIAGDIR_SE ? TileOffsByDiagDir(DIAGDIR_SE) * 4 : 4; // 4 tiles ramp.
if (tile < t->tile_n + delta || t->tile_s - delta < tile) return true;
continue;
}
return true;
}
return false;