diff options
author | darkvater <darkvater@openttd.org> | 2004-09-21 21:28:42 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2004-09-21 21:28:42 +0000 |
commit | 475ef74ab75c732039b7475378ba30c5b013700a (patch) | |
tree | a3239162807bcf8fd8d21393b1e9e61d8b6cfda3 | |
parent | 93d9afca4b68369e1c63ec13d3c7c4b1ba0dee5c (diff) | |
download | openttd-475ef74ab75c732039b7475378ba30c5b013700a.tar.xz |
(svn r306) -Fix: [985439] un-owned rail. Trains could cross competitor's tracks if there was a road-crossing over it.
-rw-r--r-- | train_cmd.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/train_cmd.c b/train_cmd.c index 998c782e3..838484569 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -1819,9 +1819,8 @@ static int GetDirectionToVehicle(Vehicle *v, int x, int y) /* Check if the vehicle is compatible with the specified tile */ static bool CheckCompatibleRail(Vehicle *v, uint tile) { - if (IS_TILETYPE(tile, MP_RAILWAY) || - IS_TILETYPE(tile, MP_STATION)) { - + if (IS_TILETYPE(tile, MP_RAILWAY) || IS_TILETYPE(tile, MP_STATION)) { + // normal tracks, jump to owner check } else if (IS_TILETYPE(tile, MP_TUNNELBRIDGE)) { if ((_map5[tile] & 0xC0) == 0xC0) {// is bridge middle part? TileInfo ti; @@ -1834,6 +1833,12 @@ static bool CheckCompatibleRail(Vehicle *v, uint tile) if(v->z_pos != ti.z) // train is going over bridge return true; } + } else if (IS_TILETYPE(tile, MP_STREET)) { // train is going over a road-crossing + // tracks over roads, do owner check of tracks (_map_owner[tile]) + if (_map_owner[tile] != v->owner || (v->subtype == 0 && (_map3_hi[tile] & 0xF) != v->u.rail.railtype)) + return false; + + return true; } else return true; |