(svn r16660) -Codechange: get rid of more dummy tile_type_procs

This commit is contained in:
smatz 2009-06-25 20:08:59 +00:00
parent c30a87758f
commit c0ac230e3e
12 changed files with 34 additions and 102 deletions

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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