1
0
Fork 0

(svn r1533) Turn an if cascade into a switch and move a const array to the only location where it is used

release/0.4.5
tron 2005-01-16 09:51:56 +00:00
parent d41a003bcc
commit 1955371a71
1 changed files with 19 additions and 11 deletions

View File

@ -2072,22 +2072,30 @@ static void GetTileDesc_Station(uint tile, TileDesc *td)
} }
static const byte _tile_track_status_rail[8] = { 1,2,1,2,1,2,1,2 };
static uint32 GetTileTrackStatus_Station(uint tile, TransportType mode) { static uint32 GetTileTrackStatus_Station(uint tile, TransportType mode) {
uint i = _map5[tile]; uint i = _map5[tile];
uint j = 0; uint j = 0;
if (mode == TRANSPORT_RAIL) { switch (mode) {
if (i < 8) case TRANSPORT_RAIL:
j = _tile_track_status_rail[i]; if (i < 8) {
j += (j << 8); const byte tile_track_status_rail[8] = { 1, 2, 1, 2, 1, 2, 1, 2 };
} else if (mode == TRANSPORT_WATER) { j = tile_track_status_rail[i];
// buoy is coded as a station, it is always on open water }
// (0x3F, all tracks available) j += (j << 8);
if (i == 0x52) j = 0x3F; break;
j += (j << 8);
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; return j;
} }