Changeset - r3272:c4b59db11c94
[Not reviewed]
master
0 2 0
tron - 19 years ago 2006-03-19 17:15:33
tron@openttd.org
(svn r3984) Add a function to get the road axis of a level crossing
2 files changed with 10 insertions and 4 deletions:
0 comments (0 inline, 0 general)
road_cmd.c
Show inline comments
 
@@ -778,7 +778,7 @@ static void DrawTile_Road(TileInfo *ti)
 

	
 
			image = GetRailTypeInfo(GetRailTypeCrossing(ti->tile))->base_sprites.crossing;
 

	
 
			if (GB(ti->map5, 3, 1) == 0) image++; /* direction */
 
			if (GetCrossingRoadAxis(ti->tile) == AXIS_X) image++;
 

	
 
			if ((ti->map5 & 4) != 0) image += 2;
 

	
 
@@ -1048,7 +1048,8 @@ static uint32 GetTileTrackStatus_Road(Ti
 
						0 : _road_trackbits[GetRoadBits(tile)] * 0x101;
 

	
 
				case ROAD_CROSSING: {
 
					uint32 r = (_m[tile].m5 & 8 ? 0x202 : 0x101);
 
					uint32 r = (GetCrossingRoadAxis(tile) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y) * 0x101;
 

	
 
					if (_m[tile].m5 & 4) r *= 0x10001;
 
					return r;
 
				}
road_map.h
Show inline comments
 
@@ -39,14 +39,19 @@ static inline void SetRoadBits(TileIndex
 
}
 

	
 

	
 
static inline Axis GetCrossingRoadAxis(TileIndex tile)
 
{
 
	return (Axis)GB(_m[tile].m5, 3, 1);
 
}
 

	
 
static inline RoadBits GetCrossingRoadBits(TileIndex tile)
 
{
 
	return _m[tile].m5 & 8 ? ROAD_Y : ROAD_X;
 
	return GetCrossingRoadAxis(tile) == AXIS_X ? ROAD_X : ROAD_Y;
 
}
 

	
 
static inline TrackBits GetCrossingRailBits(TileIndex tile)
 
{
 
	return _m[tile].m5 & 8 ? TRACK_BIT_X : TRACK_BIT_Y;
 
	return GetCrossingRoadAxis(tile) == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X;
 
}
 

	
 

	
0 comments (0 inline, 0 general)