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:
committed by
Peter Nelson
parent
77503776b6
commit
f30f808b50
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user