--- a/station.h Tue Apr 12 09:21:04 2005 +0000
+++ b/station.h Tue Apr 12 10:31:26 2005 +0000
@@ -276,6 +276,15 @@
return IsTileType(tile, MP_STATION) && IS_BYTE_INSIDE(_map5[tile], 0, 8);
}
+static inline bool IsCompatibleTrainStationTile(TileIndex tile, TileIndex ref)
+{
+ assert(IsTrainStationTile(ref));
+ return
+ IsTrainStationTile(tile) &&
+ (_map3_lo[tile] & 0x0F) == (_map3_lo[ref] & 0x0F) && // same rail type?
+ (_map5[tile] & 0x01) == (_map5[ref] & 0x01); // same direction?
+}
+
static inline bool IsRoadStationTile(uint tile) {
return IsTileType(tile, MP_STATION) && IS_BYTE_INSIDE(_map5[tile], 0x43, 0x4B);
}
--- a/station_cmd.c Tue Apr 12 09:21:04 2005 +0000
+++ b/station_cmd.c Tue Apr 12 10:31:26 2005 +0000
@@ -2322,7 +2322,7 @@
if (v->type == VEH_Train) {
if (IS_BYTE_INSIDE(_map5[tile], 0, 8) && v->subtype == TS_Front_Engine &&
- !IsTrainStationTile(tile + TileOffsByDir(v->direction >> 1))) {
+ !IsCompatibleTrainStationTile(tile + TileOffsByDir(v->direction >> 1), tile)) {
station_id = _map2[tile];
if ((!(v->current_order.flags & OF_NON_STOP) && !_patches.new_nonstop) ||
--- a/train_cmd.c Tue Apr 12 09:21:04 2005 +0000
+++ b/train_cmd.c Tue Apr 12 10:31:26 2005 +0000
@@ -154,7 +154,7 @@
do {
station_length++;
tile = TILE_ADD(tile, TileOffsByDir(v->direction / 2));
- } while (IsTrainStationTile(tile) && (_map5[tile] & 1) == (_map5[v->tile] & 1));
+ } while (IsCompatibleTrainStationTile(tile, v->tile));
delta_v = v->cur_speed / (station_length + 1);
if (v->max_speed > (v->cur_speed - delta_v))