diff options
author | tron <tron@openttd.org> | 2005-03-28 07:02:51 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-03-28 07:02:51 +0000 |
commit | b0006b2009024cd49cbb08abc88ae6038d616cc2 (patch) | |
tree | d52b7cecd7bb909131e880df5c18384d33c27293 | |
parent | 1086f772bb9909b32f43c44c1253336275ded216 (diff) | |
download | openttd-b0006b2009024cd49cbb08abc88ae6038d616cc2.tar.xz |
(svn r2094) In GetTileDesc_Track(): uint -> TileIndex, use enums, if () cascade -> switch
-rw-r--r-- | rail_cmd.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/rail_cmd.c b/rail_cmd.c index 5449e3f55..805dc16a4 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -1938,30 +1938,32 @@ static void ClickTile_Track(uint tile) } -static void GetTileDesc_Track(uint tile, TileDesc *td) +static void GetTileDesc_Track(TileIndex tile, TileDesc *td) { - byte m5 = _map5[tile]; - if (!(m5 & 0x80)) { - if(!(m5 & 0x40)) // no signals + td->owner = _map_owner[tile]; + switch (_map5[tile] & RAIL_TYPE_MASK) { + case RAIL_TYPE_NORMAL: td->str = STR_1021_RAILROAD_TRACK; - else - { - switch(_map3_hi[tile] & 0x03) - { - case 0: td->str = STR_RAILROAD_TRACK_WITH_NORMAL_SIGNALS; - break; - case 1: td->str = STR_RAILROAD_TRACK_WITH_PRESIGNALS; - break; - case 2: td->str = STR_RAILROAD_TRACK_WITH_EXITSIGNALS; - break; - case 3: td->str = STR_RAILROAD_TRACK_WITH_COMBOSIGNALS; - break; - } + break; + + case RAIL_TYPE_SIGNALS: { + const StringID signal_type[] = { + STR_RAILROAD_TRACK_WITH_NORMAL_SIGNALS, + STR_RAILROAD_TRACK_WITH_PRESIGNALS, + STR_RAILROAD_TRACK_WITH_EXITSIGNALS, + STR_RAILROAD_TRACK_WITH_COMBOSIGNALS + }; + + td->str = signal_type[_map3_hi[tile] & 0x03]; + break; } - } else { - td->str = m5 < 0xC4 ? STR_1023_RAILROAD_TRAIN_DEPOT : STR_LANDINFO_WAYPOINT; + + case RAIL_TYPE_DEPOT: + default: + td->str = ((_map5[tile] & RAIL_SUBTYPE_MASK) == RAIL_SUBTYPE_DEPOT) ? + STR_1023_RAILROAD_TRAIN_DEPOT : STR_LANDINFO_WAYPOINT; + break; } - td->owner = _map_owner[tile]; } static void ChangeTileOwner_Track(uint tile, byte old_player, byte new_player) |