From c0ac230e3ea48e2e640dc74bc257f6f22d37bca3 Mon Sep 17 00:00:00 2001 From: smatz Date: Thu, 25 Jun 2009 20:08:59 +0000 Subject: (svn r16660) -Codechange: get rid of more dummy tile_type_procs --- src/clear_cmd.cpp | 17 +++-------------- src/dummy_land.cpp | 17 +++-------------- src/landscape.cpp | 10 ---------- src/rail_cmd.cpp | 9 ++------- src/road_cmd.cpp | 2 +- src/station_cmd.cpp | 2 +- src/tile_cmd.h | 16 ++++++++++++++-- src/town_cmd.cpp | 12 +----------- src/tree_cmd.cpp | 17 +++-------------- src/tunnelbridge_cmd.cpp | 18 +++--------------- src/unmovable_cmd.cpp | 7 +------ src/water_cmd.cpp | 9 ++------- 12 files changed, 34 insertions(+), 102 deletions(-) (limited to 'src') diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index 2a28dc95f..0fc082eeb 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -118,11 +118,6 @@ static Foundation GetFoundation_Clear(TileIndex tile, Slope tileh) return FOUNDATION_NONE; } -static void AnimateTile_Clear(TileIndex tile) -{ - /* unused */ -} - void TileLoopClearHelper(TileIndex tile) { bool self = (IsTileType(tile, MP_CLEAR) && IsClearGround(tile, CLEAR_FIELDS)); @@ -309,12 +304,6 @@ get_out:; } while (--i); } -static bool ClickTile_Clear(TileIndex tile) -{ - /* not used */ - return false; -} - static TrackStatus GetTileTrackStatus_Clear(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) { return 0; @@ -358,11 +347,11 @@ extern const TileTypeProcs _tile_type_clear_procs = { DrawTile_Clear, ///< draw_tile_proc GetSlopeZ_Clear, ///< get_slope_z_proc ClearTile_Clear, ///< clear_tile_proc - NULL, ///< get_accepted_cargo_proc + NULL, ///< add_accepted_cargo_proc GetTileDesc_Clear, ///< get_tile_desc_proc GetTileTrackStatus_Clear, ///< get_tile_track_status_proc - ClickTile_Clear, ///< click_tile_proc - AnimateTile_Clear, ///< animate_tile_proc + NULL, ///< click_tile_proc + NULL, ///< animate_tile_proc TileLoop_Clear, ///< tile_loop_clear ChangeTileOwner_Clear, ///< change_tile_owner_clear NULL, ///< get_produced_cargo_proc diff --git a/src/dummy_land.cpp b/src/dummy_land.cpp index 837762da4..8bc5e888e 100644 --- a/src/dummy_land.cpp +++ b/src/dummy_land.cpp @@ -39,22 +39,11 @@ static void GetTileDesc_Dummy(TileIndex tile, TileDesc *td) td->owner[0] = OWNER_NONE; } -static void AnimateTile_Dummy(TileIndex tile) -{ - /* not used */ -} - static void TileLoop_Dummy(TileIndex tile) { /* not used */ } -static bool ClickTile_Dummy(TileIndex tile) -{ - /* not used */ - return false; -} - static void ChangeTileOwner_Dummy(TileIndex tile, Owner old_owner, Owner new_owner) { /* not used */ @@ -74,11 +63,11 @@ extern const TileTypeProcs _tile_type_dummy_procs = { DrawTile_Dummy, // draw_tile_proc GetSlopeZ_Dummy, // get_slope_z_proc ClearTile_Dummy, // clear_tile_proc - NULL, // get_accepted_cargo_proc + NULL, // add_accepted_cargo_proc GetTileDesc_Dummy, // get_tile_desc_proc GetTileTrackStatus_Dummy, // get_tile_track_status_proc - ClickTile_Dummy, // click_tile_proc - AnimateTile_Dummy, // animate_tile_proc + NULL, // click_tile_proc + NULL, // animate_tile_proc TileLoop_Dummy, // tile_loop_clear ChangeTileOwner_Dummy, // change_tile_owner_clear NULL, // get_produced_cargo_proc diff --git a/src/landscape.cpp b/src/landscape.cpp index 854b0ba61..372cf5d50 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -500,16 +500,6 @@ void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner) _tile_type_procs[GetTileType(tile)]->change_tile_owner_proc(tile, old_owner, new_owner); } -void AnimateTile(TileIndex tile) -{ - _tile_type_procs[GetTileType(tile)]->animate_tile_proc(tile); -} - -bool ClickTile(TileIndex tile) -{ - return _tile_type_procs[GetTileType(tile)]->click_tile_proc(tile); -} - void GetTileDesc(TileIndex tile, TileDesc *td) { _tile_type_procs[GetTileType(tile)]->get_tile_desc_proc(tile, td); diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index eef5bf46d..b279b164b 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -2074,11 +2074,6 @@ static Foundation GetFoundation_Track(TileIndex tile, Slope tileh) return IsPlainRail(tile) ? GetRailFoundation(tileh, GetTrackBits(tile)) : FlatteningFoundation(tileh); } -static void AnimateTile_Track(TileIndex tile) -{ - /* not used */ -} - static void TileLoop_Track(TileIndex tile) { RailGroundType old_ground = GetRailGroundType(tile); @@ -2615,11 +2610,11 @@ extern const TileTypeProcs _tile_type_rail_procs = { DrawTile_Track, // draw_tile_proc GetSlopeZ_Track, // get_slope_z_proc ClearTile_Track, // clear_tile_proc - NULL, // get_accepted_cargo_proc + NULL, // add_accepted_cargo_proc GetTileDesc_Track, // get_tile_desc_proc GetTileTrackStatus_Track, // get_tile_track_status_proc ClickTile_Track, // click_tile_proc - AnimateTile_Track, // animate_tile_proc + NULL, // animate_tile_proc TileLoop_Track, // tile_loop_clear ChangeTileOwner_Track, // change_tile_owner_clear NULL, // get_produced_cargo_proc diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index e38404c87..caa365766 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1632,7 +1632,7 @@ extern const TileTypeProcs _tile_type_road_procs = { DrawTile_Road, // draw_tile_proc GetSlopeZ_Road, // get_slope_z_proc ClearTile_Road, // clear_tile_proc - NULL, // get_accepted_cargo_proc + NULL, // add_accepted_cargo_proc GetTileDesc_Road, // get_tile_desc_proc GetTileTrackStatus_Road, // get_tile_track_status_proc ClickTile_Road, // click_tile_proc diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 761a7543e..443321a92 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3152,7 +3152,7 @@ extern const TileTypeProcs _tile_type_station_procs = { DrawTile_Station, // draw_tile_proc GetSlopeZ_Station, // get_slope_z_proc ClearTile_Station, // clear_tile_proc - NULL, // get_accepted_cargo_proc + NULL, // add_accepted_cargo_proc GetTileDesc_Station, // get_tile_desc_proc GetTileTrackStatus_Station, // get_tile_track_status_proc ClickTile_Station, // click_tile_proc diff --git a/src/tile_cmd.h b/src/tile_cmd.h index 3f3673698..a1cd92fda 100644 --- a/src/tile_cmd.h +++ b/src/tile_cmd.h @@ -155,8 +155,6 @@ extern const TileTypeProcs * const _tile_type_procs[16]; TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side = INVALID_DIAGDIR); VehicleEnterTileStatus VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y); void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner); -void AnimateTile(TileIndex tile); -bool ClickTile(TileIndex tile); void GetTileDesc(TileIndex tile, TileDesc *td); static inline void AddAcceptedCargo(TileIndex tile, AcceptedCargo ac) @@ -166,4 +164,18 @@ static inline void AddAcceptedCargo(TileIndex tile, AcceptedCargo ac) proc(tile, ac); } +static inline void AnimateTile(TileIndex tile) +{ + AnimateTileProc *proc = _tile_type_procs[GetTileType(tile)]->animate_tile_proc; + if (proc == NULL) return; + proc(tile); +} + +static inline bool ClickTile(TileIndex tile) +{ + ClickTileProc *proc = _tile_type_procs[GetTileType(tile)]->click_tile_proc; + if (proc == NULL) return false; + return proc(tile); +} + #endif /* TILE_CMD_H */ diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index f65a7afab..085d6f250 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -503,16 +503,6 @@ static void TileLoop_Town(TileIndex tile) _current_company = OWNER_NONE; } -/** - * Dummy tile callback function for handling tile clicks in towns - * @param tile unused - */ -static bool ClickTile_Town(TileIndex tile) -{ - /* not used */ - return false; -} - static CommandCost ClearTile_Town(TileIndex tile, DoCommandFlag flags) { if (flags & DC_AUTO) return_cmd_error(STR_ERROR_BUILDING_MUST_BE_DEMOLISHED); @@ -2886,7 +2876,7 @@ extern const TileTypeProcs _tile_type_town_procs = { AddAcceptedCargo_Town, // add_accepted_cargo_proc GetTileDesc_Town, // get_tile_desc_proc GetTileTrackStatus_Town, // get_tile_track_status_proc - ClickTile_Town, // click_tile_proc + NULL, // click_tile_proc AnimateTile_Town, // animate_tile_proc TileLoop_Town, // tile_loop_clear ChangeTileOwner_Town, // change_tile_owner_clear diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index 7bc521ad2..2801383a3 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -557,11 +557,6 @@ static void GetTileDesc_Trees(TileIndex tile, TileDesc *td) td->owner[0] = GetTileOwner(tile); } -static void AnimateTile_Trees(TileIndex tile) -{ - /* not used */ -} - static void TileLoopTreesDesert(TileIndex tile) { switch (GetTropicZone(tile)) { @@ -737,12 +732,6 @@ void OnTick_Trees() } } -static bool ClickTile_Trees(TileIndex tile) -{ - /* not used */ - return false; -} - static TrackStatus GetTileTrackStatus_Trees(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) { return 0; @@ -768,11 +757,11 @@ extern const TileTypeProcs _tile_type_trees_procs = { DrawTile_Trees, // draw_tile_proc GetSlopeZ_Trees, // get_slope_z_proc ClearTile_Trees, // clear_tile_proc - NULL, // get_accepted_cargo_proc + NULL, // add_accepted_cargo_proc GetTileDesc_Trees, // get_tile_desc_proc GetTileTrackStatus_Trees, // get_tile_track_status_proc - ClickTile_Trees, // click_tile_proc - AnimateTile_Trees, // animate_tile_proc + NULL, // click_tile_proc + NULL, // animate_tile_proc TileLoop_Trees, // tile_loop_clear ChangeTileOwner_Trees, // change_tile_owner_clear NULL, // get_produced_cargo_proc diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 66eb4ffb8..91132c4b1 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -1281,11 +1281,6 @@ static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td) } -static void AnimateTile_TunnelBridge(TileIndex tile) -{ - /* not used */ -} - static void TileLoop_TunnelBridge(TileIndex tile) { bool snow_or_desert = HasTunnelBridgeSnowOrDesert(tile); @@ -1309,13 +1304,6 @@ static void TileLoop_TunnelBridge(TileIndex tile) } } -static bool ClickTile_TunnelBridge(TileIndex tile) -{ - /* not used */ - return false; -} - - static TrackStatus GetTileTrackStatus_TunnelBridge(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) { TransportType transport_type = GetTunnelBridgeTransportType(tile); @@ -1540,11 +1528,11 @@ extern const TileTypeProcs _tile_type_tunnelbridge_procs = { DrawTile_TunnelBridge, // draw_tile_proc GetSlopeZ_TunnelBridge, // get_slope_z_proc ClearTile_TunnelBridge, // clear_tile_proc - NULL, // get_accepted_cargo_proc + NULL, // add_accepted_cargo_proc GetTileDesc_TunnelBridge, // get_tile_desc_proc GetTileTrackStatus_TunnelBridge, // get_tile_track_status_proc - ClickTile_TunnelBridge, // click_tile_proc - AnimateTile_TunnelBridge, // animate_tile_proc + NULL, // click_tile_proc + NULL, // animate_tile_proc TileLoop_TunnelBridge, // tile_loop_clear ChangeTileOwner_TunnelBridge, // change_tile_owner_clear NULL, // get_produced_cargo_proc diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp index 534778437..c223263b7 100644 --- a/src/unmovable_cmd.cpp +++ b/src/unmovable_cmd.cpp @@ -319,11 +319,6 @@ static void GetTileDesc_Unmovable(TileIndex tile, TileDesc *td) td->owner[0] = GetTileOwner(tile); } -static void AnimateTile_Unmovable(TileIndex tile) -{ - /* not used */ -} - static void TileLoop_Unmovable(TileIndex tile) { if (!IsCompanyHQ(tile)) return; @@ -505,7 +500,7 @@ extern const TileTypeProcs _tile_type_unmovable_procs = { GetTileDesc_Unmovable, // get_tile_desc_proc GetTileTrackStatus_Unmovable, // get_tile_track_status_proc ClickTile_Unmovable, // click_tile_proc - AnimateTile_Unmovable, // animate_tile_proc + NULL, // animate_tile_proc TileLoop_Unmovable, // tile_loop_clear ChangeTileOwner_Unmovable, // change_tile_owner_clear NULL, // get_produced_cargo_proc diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index a154f62a1..e82a0b3b6 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -702,11 +702,6 @@ static void GetTileDesc_Water(TileIndex tile, TileDesc *td) td->owner[0] = GetTileOwner(tile); } -static void AnimateTile_Water(TileIndex tile) -{ - /* not used */ -} - static void FloodVehicle(Vehicle *v); /** @@ -1155,11 +1150,11 @@ extern const TileTypeProcs _tile_type_water_procs = { DrawTile_Water, // draw_tile_proc GetSlopeZ_Water, // get_slope_z_proc ClearTile_Water, // clear_tile_proc - NULL, // get_accepted_cargo_proc + NULL, // add_accepted_cargo_proc GetTileDesc_Water, // get_tile_desc_proc GetTileTrackStatus_Water, // get_tile_track_status_proc ClickTile_Water, // click_tile_proc - AnimateTile_Water, // animate_tile_proc + NULL, // animate_tile_proc TileLoop_Water, // tile_loop_clear ChangeTileOwner_Water, // change_tile_owner_clear NULL, // get_produced_cargo_proc -- cgit v1.2.3-70-g09d2