summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-03-28 07:02:51 +0000
committertron <tron@openttd.org>2005-03-28 07:02:51 +0000
commitae359d0d021a5d6ac9c108c220acf7e3884c968d (patch)
treed52b7cecd7bb909131e880df5c18384d33c27293
parent9e53b86dca064727df16ed6d008796a89d89c096 (diff)
downloadopenttd-ae359d0d021a5d6ac9c108c220acf7e3884c968d.tar.xz
(svn r2094) In GetTileDesc_Track(): uint -> TileIndex, use enums, if () cascade -> switch
-rw-r--r--rail_cmd.c42
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)