(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().

- Codechange: [NPF] Check the railtype along a route against the engine type instead of against the previouse tile. This clears the way for electriefied rails.
- Add: [NPF] [ 1209644 ] A penalty for crossings (peter1138)
This commit is contained in:
matthijs
2005-07-03 13:02:54 +00:00
parent 6df35235d5
commit fb8e5f61b1
11 changed files with 58 additions and 37 deletions

4
rail.c
View File

@@ -97,7 +97,7 @@ const Trackdir _reverse_trackdir[] = {
TRACKDIR_DIAG1_NE, TRACKDIR_DIAG2_SE, TRACKDIR_UPPER_E, TRACKDIR_LOWER_E, TRACKDIR_LEFT_S, TRACKDIR_RIGHT_S
};
RailType GetTileRailType(TileIndex tile, byte trackdir)
RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
{
RailType type = INVALID_RAILTYPE;
switch (GetTileType(tile)) {
@@ -123,7 +123,7 @@ RailType GetTileRailType(TileIndex tile, byte trackdir)
if ((_map5[tile] & 0xC6) == 0xC0 && ((DiagDirection)(_map5[tile] & 0x1)) == (TrackdirToExitdir(trackdir) & 0x1))
type = (_map3_lo[tile] >> 4) & RAILTYPE_MASK;
/* under bridge (any type) */
if ((_map5[tile] & 0xC0) == 0xC0 && (_map5[tile] & 0x1) != (trackdir & 0x1))
if ((_map5[tile] & 0xC0) == 0xC0 && ((uint)_map5[tile] & 0x1) != (trackdir & 0x1))
type = _map3_lo[tile] & RAILTYPE_MASK;
break;
default: