# HG changeset patch # User tron # Date 1169661816 0 # Node ID 2d0ec2a2199696ac7b45d4291242913071e460cd # Parent b3f88b8cf0a22758cca720abeee496b08d83e1af (svn r8393) -Fix -Codechange: CheckCompatibleRail() is only called for tiles which are known to contain a piece of rail. Simplify the function accordingly by eliminating unnecessary checks. -Fix (?): Also fix an inconsistency in deciding what a compatible rail type is between level crossings and other rail tiles. It is unknown if this caused any problems. diff -r b3f88b8cf0a2 -r 2d0ec2a21996 src/train_cmd.cpp --- a/src/train_cmd.cpp Wed Jan 24 17:58:07 2007 +0000 +++ b/src/train_cmd.cpp Wed Jan 24 18:03:36 2007 +0000 @@ -2804,29 +2804,13 @@ /* Check if the vehicle is compatible with the specified tile */ static bool CheckCompatibleRail(const Vehicle *v, TileIndex tile) { - switch (GetTileType(tile)) { - case MP_TUNNELBRIDGE: - case MP_RAILWAY: - case MP_STATION: - // normal tracks, jump to owner check - break; - - case MP_STREET: - // tracks over roads, do owner check of tracks - return - IsTileOwner(tile, v->owner) && ( - !IsFrontEngine(v) || - IsCompatibleRail(v->u.rail.railtype, GetRailTypeCrossing(tile)) - ); - - default: - return true; - } - return IsTileOwner(tile, v->owner) && ( !IsFrontEngine(v) || - HASBIT(v->u.rail.compatible_railtypes, GetRailType(tile)) + HASBIT( + v->u.rail.compatible_railtypes, + IsTileType(tile, MP_STREET) ? GetRailTypeCrossing(tile) : GetRailType(tile) + ) ); }