summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-04-25 07:32:33 +0000
committertron <tron@openttd.org>2006-04-25 07:32:33 +0000
commitb57640e28a4c9873506ea2c5bedd2509e994fdaf (patch)
treec52854038a7463251f059ce8699ab9ab6a257684
parentdf3d8d33ec3f1c891a479a9c286fe0f0bdbfd7f5 (diff)
downloadopenttd-b57640e28a4c9873506ea2c5bedd2509e994fdaf.tar.xz
(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
-rw-r--r--clear_cmd.c1
-rw-r--r--dummy_land.c1
-rw-r--r--industry_cmd.c1
-rw-r--r--openttd.h2
-rw-r--r--rail_cmd.c1
-rw-r--r--road_cmd.c8
-rw-r--r--station_cmd.c1
-rw-r--r--town_cmd.c1
-rw-r--r--train_cmd.c5
-rw-r--r--tree_cmd.c1
-rw-r--r--tunnelbridge_cmd.c1
-rw-r--r--unmovable_cmd.c1
-rw-r--r--vehicle.c13
-rw-r--r--water_cmd.c1
14 files changed, 6 insertions, 32 deletions
diff --git a/clear_cmd.c b/clear_cmd.c
index 3a8b69f91..49197960a 100644
--- a/clear_cmd.c
+++ b/clear_cmd.c
@@ -745,6 +745,5 @@ const TileTypeProcs _tile_type_clear_procs = {
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 */
};
diff --git a/dummy_land.c b/dummy_land.c
index 390678450..1052cde0a 100644
--- a/dummy_land.c
+++ b/dummy_land.c
@@ -79,6 +79,5 @@ const TileTypeProcs _tile_type_dummy_procs = {
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 */
};
diff --git a/industry_cmd.c b/industry_cmd.c
index 9da3044cd..10a69fc27 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -1891,7 +1891,6 @@ const TileTypeProcs _tile_type_industry_procs = {
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 */
};
diff --git a/openttd.h b/openttd.h
index 576d17895..d1e680c05 100644
--- a/openttd.h
+++ b/openttd.h
@@ -331,7 +331,6 @@ typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID n
* 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 @@ typedef struct {
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;
diff --git a/rail_cmd.c b/rail_cmd.c
index 5c4dfcf24..6f7113169 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -2028,6 +2028,5 @@ const TileTypeProcs _tile_type_rail_procs = {
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 */
};
diff --git a/road_cmd.c b/road_cmd.c
index b94d58d3e..aa1be9514 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -1049,13 +1049,6 @@ static uint32 VehicleEnter_Road(Vehicle *v, TileIndex tile, int x, int y)
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 @@ const TileTypeProcs _tile_type_road_procs = {
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 */
};
diff --git a/station_cmd.c b/station_cmd.c
index 801b292d8..9cd8505b7 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -2782,7 +2782,6 @@ const TileTypeProcs _tile_type_station_procs = {
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 */
};
diff --git a/town_cmd.c b/town_cmd.c
index ca92b1b28..ca207ad9b 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -1866,7 +1866,6 @@ const TileTypeProcs _tile_type_town_procs = {
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 */
};
diff --git a/train_cmd.c b/train_cmd.c
index 0567cee0d..8d9378848 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -2931,6 +2931,11 @@ static void TrainController(Vehicle *v)
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)) {
diff --git a/tree_cmd.c b/tree_cmd.c
index 26e957dac..808243b14 100644
--- a/tree_cmd.c
+++ b/tree_cmd.c
@@ -591,6 +591,5 @@ const TileTypeProcs _tile_type_trees_procs = {
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 */
};
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index fc644f20b..503616e67 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -1398,6 +1398,5 @@ const TileTypeProcs _tile_type_tunnelbridge_procs = {
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 */
};
diff --git a/unmovable_cmd.c b/unmovable_cmd.c
index cc97512a7..eaded26d7 100644
--- a/unmovable_cmd.c
+++ b/unmovable_cmd.c
@@ -393,6 +393,5 @@ const TileTypeProcs _tile_type_unmovable_procs = {
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 */
};
diff --git a/vehicle.c b/vehicle.c
index e2d19b081..7ba098751 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -2012,18 +2012,7 @@ Trackdir GetVehicleTrackdir(const Vehicle* v)
* 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)
diff --git a/water_cmd.c b/water_cmd.c
index 42c287ea5..b66558a8d 100644
--- a/water_cmd.c
+++ b/water_cmd.c
@@ -716,6 +716,5 @@ const TileTypeProcs _tile_type_water_procs = {
ChangeTileOwner_Water, /* change_tile_owner_clear */
NULL, /* get_produced_cargo_proc */
VehicleEnter_Water, /* vehicle_enter_tile_proc */
- NULL, /* vehicle_leave_tile_proc */
GetSlopeTileh_Water, /* get_slope_tileh_proc */
};