From 4a14a586e2f457d38e9fede1a494478105a8acfd Mon Sep 17 00:00:00 2001 From: tron Date: Sun, 13 Nov 2005 14:54:09 +0000 Subject: (svn r3173) Use the trinary operator and switch to improve readability Also align short cases nicely --- station_cmd.c | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) (limited to 'station_cmd.c') diff --git a/station_cmd.c b/station_cmd.c index a2c4acff6..c0a0203df 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -99,10 +99,9 @@ static void InitializeRoadStop(RoadStop *road_stop, RoadStop *previous, TileInde RoadStop * GetPrimaryRoadStop(const Station *st, RoadStopType type) { switch (type) { - case RS_BUS: return st->bus_stops; + case RS_BUS: return st->bus_stops; case RS_TRUCK: return st->truck_stops; - default: - NOT_REACHED(); + default: NOT_REACHED(); } return NULL; @@ -677,11 +676,7 @@ static void UpdateStationAcceptance(Station *st, bool show_msg) MergePoint(&rect, cur_rs->xy); } - if (_patches.modified_catchment) { - rad = FindCatchmentRadius(st); - } else { - rad = 4; - } + rad = (_patches.modified_catchment) ? FindCatchmentRadius(st) : 4; // And retrieve the acceptance. if (rect.max_x >= rect.min_x) { @@ -1242,27 +1237,13 @@ static const RealSpriteGroup *ResolveStationSpriteGroup(const SpriteGroup *spg, // TTDPatch runs on little-endian arch; // Variable is 0x70 + offset in the TTD's station structure switch (dsg->variable - 0x70) { - case 0x80: - value = st->facilities; - break; - case 0x81: - value = st->airport_type; - break; - case 0x82: - value = st->truck_stops->status; - break; - case 0x83: - value = st->bus_stops->status; - break; - case 0x86: - value = st->airport_flags & 0xFFFF; - break; - case 0x87: - value = st->airport_flags & 0xFF; - break; - case 0x8A: - value = st->build_date; - break; + case 0x80: value = st->facilities; break; + case 0x81: value = st->airport_type; break; + case 0x82: value = st->truck_stops->status; break; + case 0x83: value = st->bus_stops->status; break; + case 0x86: value = st->airport_flags & 0xFFFF; break; + case 0x87: value = st->airport_flags & 0xFF; break; + case 0x8A: value = st->build_date; break; } } } -- cgit v1.2.3-54-g00ecf