1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-18 01:42:38 +01:00

Codechange: Implement tile proc handler to test for building bridge over tile.

This commit is contained in:
Peter Nelson
2025-08-14 19:35:32 +01:00
committed by Peter Nelson
parent 77503776b6
commit f30f808b50
12 changed files with 77 additions and 40 deletions

View File

@@ -929,6 +929,16 @@ static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlags flags, in
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
}
static CommandCost CheckBuildAbove_Object(TileIndex tile, DoCommandFlags flags, Axis, int height)
{
const ObjectSpec *spec = ObjectSpec::GetByTile(tile);
if (spec->flags.Test(ObjectFlag::AllowUnderBridge) && GetTileMaxZ(tile) + spec->height <= height) {
return CommandCost();
}
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
}
extern const TileTypeProcs _tile_type_object_procs = {
DrawTile_Object, // draw_tile_proc
GetSlopePixelZ_Object, // get_slope_z_proc
@@ -944,4 +954,5 @@ extern const TileTypeProcs _tile_type_object_procs = {
nullptr, // vehicle_enter_tile_proc
GetFoundation_Object, // get_foundation_proc
TerraformTile_Object, // terraform_tile_proc
CheckBuildAbove_Object, // check_build_above_proc
};