Mercurial > hg > openttd
changeset 3657:639eb242838c draft
(svn r4572) Remove vehicle_leave_tile_proc
There's exactly one implemented function (unbarring a level crossing) and one place where it can be triggered (a train leaves a level crossing)
It's a bit overkill, so just handle this one case where it can happen
author | tron <tron@openttd.org> |
---|---|
date | Tue, 25 Apr 2006 07:32:33 +0000 |
parents | b7dd8817b9dd |
children | 543e54c1cb7f |
files | clear_cmd.c dummy_land.c industry_cmd.c openttd.h rail_cmd.c road_cmd.c station_cmd.c town_cmd.c train_cmd.c tree_cmd.c tunnelbridge_cmd.c unmovable_cmd.c vehicle.c water_cmd.c |
diffstat | 14 files changed, 6 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/clear_cmd.c +++ b/clear_cmd.c @@ -745,6 +745,5 @@ ChangeTileOwner_Clear, /* change_tile_owner_clear */ NULL, /* get_produced_cargo_proc */ NULL, /* vehicle_enter_tile_proc */ - NULL, /* vehicle_leave_tile_proc */ GetSlopeTileh_Clear, /* get_slope_tileh_proc */ };
--- a/dummy_land.c +++ b/dummy_land.c @@ -79,6 +79,5 @@ ChangeTileOwner_Dummy, /* change_tile_owner_clear */ NULL, /* get_produced_cargo_proc */ NULL, /* vehicle_enter_tile_proc */ - NULL, /* vehicle_leave_tile_proc */ GetSlopeTileh_Dummy, /* get_slope_tileh_proc */ };
--- a/industry_cmd.c +++ b/industry_cmd.c @@ -1891,7 +1891,6 @@ ChangeTileOwner_Industry, /* change_tile_owner_proc */ GetProducedCargo_Industry, /* get_produced_cargo_proc */ NULL, /* vehicle_enter_tile_proc */ - NULL, /* vehicle_leave_tile_proc */ GetSlopeTileh_Industry, /* get_slope_tileh_proc */ };
--- a/openttd.h +++ b/openttd.h @@ -331,7 +331,6 @@ * bit 0x8 set, the vehicle could not and did not enter the tile. Are there * other bits that can be set? */ typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y); -typedef void VehicleLeaveTileProc(Vehicle *v, TileIndex tile, int x, int y); typedef Slope GetSlopeTilehProc(TileIndex, Slope tileh); typedef struct { @@ -347,7 +346,6 @@ ChangeTileOwnerProc *change_tile_owner_proc; GetProducedCargoProc *get_produced_cargo_proc; VehicleEnterTileProc *vehicle_enter_tile_proc; - VehicleLeaveTileProc *vehicle_leave_tile_proc; GetSlopeTilehProc *get_slope_tileh_proc; } TileTypeProcs;
--- a/rail_cmd.c +++ b/rail_cmd.c @@ -2028,6 +2028,5 @@ ChangeTileOwner_Track, /* change_tile_owner_clear */ NULL, /* get_produced_cargo_proc */ VehicleEnter_Track, /* vehicle_enter_tile_proc */ - NULL, /* vehicle_leave_tile_proc */ GetSlopeTileh_Track, /* get_slope_tileh_proc */ };
--- a/road_cmd.c +++ b/road_cmd.c @@ -1049,13 +1049,6 @@ return 0; } -static void VehicleLeave_Road(Vehicle *v, TileIndex tile, int x, int y) -{ - if (IsLevelCrossing(tile) && v->type == VEH_Train && v->next == NULL) { - UnbarCrossing(tile); - MarkTileDirtyByTile(tile); - } -} static void ChangeTileOwner_Road(TileIndex tile, PlayerID old_player, PlayerID new_player) { @@ -1103,6 +1096,5 @@ ChangeTileOwner_Road, /* change_tile_owner_clear */ NULL, /* get_produced_cargo_proc */ VehicleEnter_Road, /* vehicle_enter_tile_proc */ - VehicleLeave_Road, /* vehicle_leave_tile_proc */ GetSlopeTileh_Road, /* get_slope_tileh_proc */ };
--- a/station_cmd.c +++ b/station_cmd.c @@ -2782,7 +2782,6 @@ ChangeTileOwner_Station, /* change_tile_owner_clear */ NULL, /* get_produced_cargo_proc */ VehicleEnter_Station, /* vehicle_enter_tile_proc */ - NULL, /* vehicle_leave_tile_proc */ GetSlopeTileh_Station, /* get_slope_tileh_proc */ };
--- a/town_cmd.c +++ b/town_cmd.c @@ -1866,7 +1866,6 @@ ChangeTileOwner_Town, /* change_tile_owner_clear */ NULL, /* get_produced_cargo_proc */ NULL, /* vehicle_enter_tile_proc */ - NULL, /* vehicle_leave_tile_proc */ GetSlopeTileh_Town, /* get_slope_tileh_proc */ };
--- a/train_cmd.c +++ b/train_cmd.c @@ -2931,6 +2931,11 @@ goto invalid_rail; } + if (IsLevelCrossingTile(v->tile) && v->next == NULL) { + UnbarCrossing(v->tile); + MarkTileDirtyByTile(v->tile); + } + if (IsFrontEngine(v)) v->load_unload_time_rem = 0; if (!(r&0x4)) {
--- a/tree_cmd.c +++ b/tree_cmd.c @@ -591,6 +591,5 @@ ChangeTileOwner_Trees, /* change_tile_owner_clear */ NULL, /* get_produced_cargo_proc */ NULL, /* vehicle_enter_tile_proc */ - NULL, /* vehicle_leave_tile_proc */ GetSlopeTileh_Trees, /* get_slope_tileh_proc */ };
--- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -1398,6 +1398,5 @@ ChangeTileOwner_TunnelBridge, /* change_tile_owner_clear */ NULL, /* get_produced_cargo_proc */ VehicleEnter_TunnelBridge, /* vehicle_enter_tile_proc */ - NULL, /* vehicle_leave_tile_proc */ GetSlopeTileh_TunnelBridge, /* get_slope_tileh_proc */ };
--- a/unmovable_cmd.c +++ b/unmovable_cmd.c @@ -393,6 +393,5 @@ ChangeTileOwner_Unmovable, /* change_tile_owner_clear */ NULL, /* get_produced_cargo_proc */ NULL, /* vehicle_enter_tile_proc */ - NULL, /* vehicle_leave_tile_proc */ GetSlopeTileh_Unmovable, /* get_slope_tileh_proc */ };
--- a/vehicle.c +++ b/vehicle.c @@ -2012,18 +2012,7 @@ * other bits that can be set? */ uint32 VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y) { - TileIndex old_tile = v->tile; - uint32 result = _tile_type_procs[GetTileType(tile)]->vehicle_enter_tile_proc(v, tile, x, y); - - /* When vehicle_enter_tile_proc returns 8, that apparently means that - * we cannot enter the tile at all. In that case, don't call - * leave_tile. */ - if (!(result & 8) && old_tile != tile) { - VehicleLeaveTileProc *proc = _tile_type_procs[GetTileType(old_tile)]->vehicle_leave_tile_proc; - if (proc != NULL) - proc(v, old_tile, x, y); - } - return result; + return _tile_type_procs[GetTileType(tile)]->vehicle_enter_tile_proc(v, tile, x, y); } UnitID GetFreeUnitNumber(byte type)