summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-04-10 20:46:37 +0000
committertron <tron@openttd.org>2006-04-10 20:46:37 +0000
commit93789afac745ef29e16bff9563da082bf98ee369 (patch)
tree1292885633de8a336444297f1e36c88f20aa80a1
parenta9b607f2593101314670c5bf49beea7d57b8cee1 (diff)
downloadopenttd-93789afac745ef29e16bff9563da082bf98ee369.tar.xz
(svn r4349) Remove GetCrossingTransportType(), it's slightly overkill
-rw-r--r--npf.c4
-rw-r--r--rail.h20
2 files changed, 3 insertions, 21 deletions
diff --git a/npf.c b/npf.c
index 5959ba947..af2bb2745 100644
--- a/npf.c
+++ b/npf.c
@@ -467,8 +467,10 @@ static bool VehicleMayEnterTile(Owner owner, TileIndex tile, DiagDirection enter
switch (GetTileType(tile)) {
case MP_STREET:
/* rail-road crossing : are we looking at the railway part? */
- if (IsLevelCrossing(tile) && GetCrossingTransportType(tile, TrackdirToTrack(DiagdirToDiagTrackdir(enterdir))) == TRANSPORT_RAIL)
+ if (IsLevelCrossing(tile) &&
+ DiagDirToAxis(enterdir) != GetCrossingRoadAxis(tile)) {
return IsTileOwner(tile, owner); /* Railway needs owner check, while the street is public */
+ }
break;
case MP_TUNNELBRIDGE:
diff --git a/rail.h b/rail.h
index f8357ed35..8bb0be416 100644
--- a/rail.h
+++ b/rail.h
@@ -430,26 +430,6 @@ RailType GetTileRailType(TileIndex tile, Trackdir trackdir);
/**
- * Gets the transport type of the given track on the given crossing tile.
- * @return The transport type of the given track, either TRANSPORT_ROAD,
- * TRANSPORT_RAIL.
- */
-static inline TransportType GetCrossingTransportType(TileIndex tile, Track track)
-{
- /* XXX: Nicer way to write this? */
- switch (track) {
- /* When map5 bit 3 is set, the road runs in the y direction */
- case TRACK_X:
- return (HASBIT(_m[tile].m5, 3) ? TRANSPORT_RAIL : TRANSPORT_ROAD);
- case TRACK_Y:
- return (HASBIT(_m[tile].m5, 3) ? TRANSPORT_ROAD : TRANSPORT_RAIL);
- default:
- assert(0);
- }
- return INVALID_TRANSPORT;
-}
-
-/**
* Returns a pointer to the Railtype information for a given railtype
* @param railtype the rail type which the information is requested for
* @return The pointer to the RailtypeInfo