mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-24 20:12:42 +00:00
Codechange: use designated initialisers for _tile_type_object_procs
This commit is contained in:
+33
-33
@@ -439,8 +439,14 @@ CommandCost CmdBuildObjectArea(DoCommandFlags flags, TileIndex tile, TileIndex s
|
||||
return had_success ? cost : last_error;
|
||||
}
|
||||
|
||||
static Foundation GetFoundation_Object(TileIndex tile, Slope tileh);
|
||||
/** @copydoc GetFoundationProc */
|
||||
static Foundation GetFoundation_Object(TileIndex tile, Slope tileh)
|
||||
{
|
||||
const ObjectSpec *spec = ObjectSpec::Get(GetObjectType(tile));
|
||||
return spec->IsEnabled() && spec->flags.Test(ObjectFlag::HasNoFoundation) ? FOUNDATION_NONE : FlatteningFoundation(tileh);
|
||||
}
|
||||
|
||||
/** @copydoc DrawTileProc */
|
||||
static void DrawTile_Object(TileInfo *ti)
|
||||
{
|
||||
ObjectType type = GetObjectType(ti->tile);
|
||||
@@ -489,7 +495,8 @@ static void DrawTile_Object(TileInfo *ti)
|
||||
DrawBridgeMiddle(ti, {});
|
||||
}
|
||||
|
||||
static int GetSlopePixelZ_Object(TileIndex tile, uint x, uint y, bool)
|
||||
/** @copydoc GetSlopePixelZProc */
|
||||
static int GetSlopePixelZ_Object(TileIndex tile, uint x, uint y, [[maybe_unused]] bool ground_vehicle)
|
||||
{
|
||||
if (IsObjectType(tile, OBJECT_OWNED_LAND)) {
|
||||
auto [tileh, z] = GetTilePixelSlope(tile);
|
||||
@@ -500,12 +507,6 @@ static int GetSlopePixelZ_Object(TileIndex tile, uint x, uint y, bool)
|
||||
}
|
||||
}
|
||||
|
||||
static Foundation GetFoundation_Object(TileIndex tile, Slope tileh)
|
||||
{
|
||||
const ObjectSpec *spec = ObjectSpec::Get(GetObjectType(tile));
|
||||
return spec->IsEnabled() && spec->flags.Test(ObjectFlag::HasNoFoundation) ? FOUNDATION_NONE : FlatteningFoundation(tileh);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the actual removal of the object from the map.
|
||||
* @param o The object to really clear.
|
||||
@@ -539,6 +540,7 @@ ClearedObjectArea *FindClearedObject(TileIndex tile)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/** @copydoc ClearTileProc */
|
||||
static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlags flags)
|
||||
{
|
||||
/* Get to the northern most tile. */
|
||||
@@ -618,6 +620,7 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlags flags)
|
||||
return cost;
|
||||
}
|
||||
|
||||
/** @copydoc AddAcceptedCargoProc */
|
||||
static void AddAcceptedCargo_Object(TileIndex tile, CargoArray &acceptance, CargoTypes &always_accepted)
|
||||
{
|
||||
if (!IsObjectType(tile, OBJECT_HQ)) return;
|
||||
@@ -647,6 +650,7 @@ static void AddAcceptedCargo_Object(TileIndex tile, CargoArray &acceptance, Carg
|
||||
}
|
||||
}
|
||||
|
||||
/** @copydoc AddProducedCargoProc */
|
||||
static void AddProducedCargo_Object(TileIndex tile, CargoArray &produced)
|
||||
{
|
||||
if (!IsObjectType(tile, OBJECT_HQ)) return;
|
||||
@@ -658,6 +662,7 @@ static void AddProducedCargo_Object(TileIndex tile, CargoArray &produced)
|
||||
}
|
||||
|
||||
|
||||
/** @copydoc GetTileDescProc */
|
||||
static void GetTileDesc_Object(TileIndex tile, TileDesc &td)
|
||||
{
|
||||
const ObjectSpec *spec = ObjectSpec::GetByTile(tile);
|
||||
@@ -670,6 +675,7 @@ static void GetTileDesc_Object(TileIndex tile, TileDesc &td)
|
||||
}
|
||||
}
|
||||
|
||||
/** @copydoc TileLoopProc */
|
||||
static void TileLoop_Object(TileIndex tile)
|
||||
{
|
||||
const ObjectSpec *spec = ObjectSpec::GetByTile(tile);
|
||||
@@ -725,11 +731,7 @@ static void TileLoop_Object(TileIndex tile)
|
||||
}
|
||||
|
||||
|
||||
static TrackStatus GetTileTrackStatus_Object(TileIndex, TransportType, uint, DiagDirection)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @copydoc ClickTileProc */
|
||||
static bool ClickTile_Object(TileIndex tile)
|
||||
{
|
||||
if (!IsObjectType(tile, OBJECT_HQ)) return false;
|
||||
@@ -738,10 +740,6 @@ static bool ClickTile_Object(TileIndex tile)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void AnimateTile_Object(TileIndex tile)
|
||||
{
|
||||
AnimateNewObjectTile(tile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to build a lighthouse.
|
||||
@@ -865,6 +863,7 @@ void GenerateObjects()
|
||||
}
|
||||
}
|
||||
|
||||
/** @copydoc ChangeTileOwnerProc */
|
||||
static void ChangeTileOwner_Object(TileIndex tile, Owner old_owner, Owner new_owner)
|
||||
{
|
||||
if (!IsTileOwner(tile, old_owner)) return;
|
||||
@@ -901,6 +900,7 @@ static void ChangeTileOwner_Object(TileIndex tile, Owner old_owner, Owner new_ow
|
||||
}
|
||||
}
|
||||
|
||||
/** @copydoc TerraformTileProc */
|
||||
static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlags flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
ObjectType type = GetObjectType(tile);
|
||||
@@ -936,7 +936,8 @@ static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlags flags, in
|
||||
return Command<Commands::LandscapeClear>::Do(flags, tile);
|
||||
}
|
||||
|
||||
static CommandCost CheckBuildAbove_Object(TileIndex tile, DoCommandFlags flags, Axis, int height)
|
||||
/** @copydoc CheckBuildAboveProc */
|
||||
static CommandCost CheckBuildAbove_Object(TileIndex tile, DoCommandFlags flags, [[maybe_unused]] Axis axis, int height)
|
||||
{
|
||||
const ObjectSpec *spec = ObjectSpec::GetByTile(tile);
|
||||
if (spec->flags.Test(ObjectFlag::AllowUnderBridge) && GetTileMaxZ(tile) + spec->height <= height) {
|
||||
@@ -946,20 +947,19 @@ static CommandCost CheckBuildAbove_Object(TileIndex tile, DoCommandFlags flags,
|
||||
return Command<Commands::LandscapeClear>::Do(flags, tile);
|
||||
}
|
||||
|
||||
/** TileTypeProcs definitions for TileType::Object tiles. */
|
||||
extern const TileTypeProcs _tile_type_object_procs = {
|
||||
DrawTile_Object, // draw_tile_proc
|
||||
GetSlopePixelZ_Object, // get_slope_z_proc
|
||||
ClearTile_Object, // clear_tile_proc
|
||||
AddAcceptedCargo_Object, // add_accepted_cargo_proc
|
||||
GetTileDesc_Object, // get_tile_desc_proc
|
||||
GetTileTrackStatus_Object, // get_tile_track_status_proc
|
||||
ClickTile_Object, // click_tile_proc
|
||||
AnimateTile_Object, // animate_tile_proc
|
||||
TileLoop_Object, // tile_loop_proc
|
||||
ChangeTileOwner_Object, // change_tile_owner_proc
|
||||
AddProducedCargo_Object, // add_produced_cargo_proc
|
||||
nullptr, // vehicle_enter_tile_proc
|
||||
GetFoundation_Object, // get_foundation_proc
|
||||
TerraformTile_Object, // terraform_tile_proc
|
||||
CheckBuildAbove_Object, // check_build_above_proc
|
||||
.draw_tile_proc = DrawTile_Object,
|
||||
.get_slope_pixel_z_proc = GetSlopePixelZ_Object,
|
||||
.clear_tile_proc = ClearTile_Object,
|
||||
.add_accepted_cargo_proc = AddAcceptedCargo_Object,
|
||||
.get_tile_desc_proc = GetTileDesc_Object,
|
||||
.click_tile_proc = ClickTile_Object,
|
||||
.animate_tile_proc = [](TileIndex tile) { AnimateNewObjectTile(tile); },
|
||||
.tile_loop_proc = TileLoop_Object,
|
||||
.change_tile_owner_proc = ChangeTileOwner_Object,
|
||||
.add_produced_cargo_proc = AddProducedCargo_Object,
|
||||
.get_foundation_proc = GetFoundation_Object,
|
||||
.terraform_tile_proc = TerraformTile_Object,
|
||||
.check_build_above_proc = CheckBuildAbove_Object,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user