diff options
author | Charles Pigott <charlespigott@googlemail.com> | 2019-03-25 22:47:12 +0000 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-03-26 20:54:40 +0000 |
commit | 7c81f8e0764db47d09581a232a501a95825a138f (patch) | |
tree | 7da1bdf1fc6a34d48e27f7125d43a751d0193683 | |
parent | e453572b6ab9feeacd4fcbd660d954aec44c4777 (diff) | |
download | openttd-7c81f8e0764db47d09581a232a501a95825a138f.tar.xz |
Codechange: Simplify refit cargo filter condition and stop mixing enum types
-rw-r--r-- | src/build_vehicle_gui.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index c3d8743a2..33cabe98a 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1163,8 +1163,8 @@ struct BuildVehicleWindow : Window { void SelectEngine(EngineID engine) { - bool refit = this->cargo_filter[this->cargo_filter_criteria] != CF_ANY && this->cargo_filter[this->cargo_filter_criteria] != CF_NONE; - CargoID cargo = refit ? this->cargo_filter[this->cargo_filter_criteria] : CT_INVALID; + CargoID cargo = this->cargo_filter[this->cargo_filter_criteria]; + if (cargo == CF_ANY) cargo = CF_NONE; this->sel_engine = engine; this->SetBuyVehicleText(); @@ -1419,8 +1419,8 @@ struct BuildVehicleWindow : Window { EngineID sel_eng = this->sel_engine; if (sel_eng != INVALID_ENGINE) { CommandCallback *callback = (this->vehicle_type == VEH_TRAIN && RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) ? CcBuildWagon : CcBuildPrimaryVehicle; - bool refit = this->cargo_filter[this->cargo_filter_criteria] != CF_ANY && this->cargo_filter[this->cargo_filter_criteria] != CF_NONE; - CargoID cargo = refit ? this->cargo_filter[this->cargo_filter_criteria] : CT_INVALID; + CargoID cargo = this->cargo_filter[this->cargo_filter_criteria]; + if (cargo == CF_ANY) cargo = CF_NONE; DoCommandP(this->window_number, sel_eng | (cargo << 24), 0, GetCmdBuildVeh(this->vehicle_type), callback); } break; |