summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes E. Krause <j.k@eclipso.de>2019-03-12 15:05:00 +0100
committerPeterN <peter@fuzzle.org>2019-03-13 07:47:32 +0000
commit21ec3e55314505153c363ed52857306d595f55d3 (patch)
tree818beb9bd2fe484a711cea2d0a8c67a0916daeb6
parent234f1007f7a6e81f38ddd1de06c6e1727cb9da76 (diff)
downloadopenttd-21ec3e55314505153c363ed52857306d595f55d3.tar.xz
Cleanup: Remove questionable syntax in GetOrderCmdFromTile
-rw-r--r--src/order_gui.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 81350deb7..e50247e27 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -395,11 +395,13 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
if (st->owner == _local_company || st->owner == OWNER_NONE) {
byte facil;
- (facil = FACIL_DOCK, v->type == VEH_SHIP) ||
- (facil = FACIL_TRAIN, v->type == VEH_TRAIN) ||
- (facil = FACIL_AIRPORT, v->type == VEH_AIRCRAFT) ||
- (facil = FACIL_BUS_STOP, v->type == VEH_ROAD && RoadVehicle::From(v)->IsBus()) ||
- (facil = FACIL_TRUCK_STOP, 1);
+ switch (v->type) {
+ case VEH_SHIP: facil = FACIL_DOCK; break;
+ case VEH_TRAIN: facil = FACIL_TRAIN; break;
+ case VEH_AIRCRAFT: facil = FACIL_AIRPORT; break;
+ case VEH_ROAD: facil = RoadVehicle::From(v)->IsBus() ? FACIL_BUS_STOP : FACIL_TRUCK_STOP; break;
+ default: NOT_REACHED();
+ }
if (st->facilities & facil) {
order.MakeGoToStation(st_index);
if (_ctrl_pressed) order.SetLoadType(OLF_FULL_LOAD_ANY);