Changeset - r3070:ae80a3b9525a
[Not reviewed]
master
0 2 0
tron - 19 years ago 2006-02-23 11:53:48
tron@openttd.org
(svn r3659) Add function to get the road bits of a level crossing
2 files changed with 8 insertions and 3 deletions:
0 comments (0 inline, 0 general)
road.h
Show inline comments
 
@@ -20,6 +20,11 @@ static inline RoadBits GetRoadBits(TileI
 
	return GB(_m[tile].m5, 0, 4);
 
}
 

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

	
 
typedef enum RoadType {
 
	ROAD_NORMAL,
 
	ROAD_CROSSING,
road_cmd.c
Show inline comments
 
@@ -34,7 +34,7 @@ static bool HasTileRoadAt(TileIndex tile
 
		case MP_STREET:
 
			switch (GetRoadType(tile)) {
 
				case ROAD_NORMAL:   b = GetRoadBits(tile); break;
 
				case ROAD_CROSSING: b = (_m[tile].m5 & 8 ? ROAD_Y : ROAD_X); break;
 
				case ROAD_CROSSING: b = GetCrossingRoadBits(tile); break;
 
				case ROAD_DEPOT:    return (~_m[tile].m5 & 3) == i;
 
				default:            return false;
 
			}
 
@@ -709,7 +709,7 @@ static int32 ClearTile_Road(TileIndex ti
 

	
 
			if (flags & DC_AUTO) return_cmd_error(STR_1801_MUST_REMOVE_ROAD_FIRST);
 

	
 
			ret = DoCommandByTile(tile, (_m[tile].m5 & 8 ? ROAD_Y : ROAD_X), 0, flags, CMD_REMOVE_ROAD);
 
			ret = DoCommandByTile(tile, GetCrossingRoadBits(tile), 0, flags, CMD_REMOVE_ROAD);
 
			if (CmdFailed(ret)) return CMD_ERROR;
 

	
 
			if (flags & DC_EXEC) {
 
@@ -1212,10 +1212,10 @@ static void ChangeTileOwner_Road(TileInd
 
				break;
 

	
 
			case ROAD_CROSSING:
 
				_m[tile].m5 = (_m[tile].m5&8) ? 0x5 : 0xA;
 
				SetTileOwner(tile, _m[tile].m3);
 
				_m[tile].m3 = 0;
 
				_m[tile].m4 &= 0x80;
 
				_m[tile].m5 = GetCrossingRoadBits(tile);
 
				break;
 

	
 
			default:
0 comments (0 inline, 0 general)