Changeset - r1032:4d7e3b98819e
[Not reviewed]
master
0 1 0
tron - 20 years ago 2005-01-16 09:51:56
tron@openttd.org
(svn r1533) Turn an if cascade into a switch and move a const array to the only location where it is used
1 file changed with 19 insertions and 11 deletions:
0 comments (0 inline, 0 general)
station_cmd.c
Show inline comments
 
@@ -2072,22 +2072,30 @@ static void GetTileDesc_Station(uint til
 
}
 

	
 

	
 
static const byte _tile_track_status_rail[8] = { 1,2,1,2,1,2,1,2 };
 

	
 
static uint32 GetTileTrackStatus_Station(uint tile, TransportType mode) {
 
	uint i = _map5[tile];
 
	uint j = 0;
 

	
 
	if (mode == TRANSPORT_RAIL) {
 
		if (i < 8)
 
			j = _tile_track_status_rail[i];
 
		j += (j << 8);
 
	} else if (mode == TRANSPORT_WATER) {
 
		// buoy is coded as a station, it is always on open water
 
		// (0x3F, all tracks available)
 
		if (i == 0x52) j = 0x3F;
 
		j += (j << 8);
 
	switch (mode) {
 
		case TRANSPORT_RAIL:
 
			if (i < 8) {
 
				const byte tile_track_status_rail[8] = { 1, 2, 1, 2, 1, 2, 1, 2 };
 
				j = tile_track_status_rail[i];
 
			}
 
			j += (j << 8);
 
			break;
 

	
 
		case TRANSPORT_WATER:
 
			// buoy is coded as a station, it is always on open water
 
			// (0x3F, all tracks available)
 
			if (i == 0x52) j = 0x3F;
 
			j += (j << 8);
 
			break;
 

	
 
		default:
 
			break;
 
	}
 

	
 
	return j;
 
}
 

	
0 comments (0 inline, 0 general)