summaryrefslogtreecommitdiff
path: root/src/build_vehicle_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/build_vehicle_gui.cpp')
-rw-r--r--src/build_vehicle_gui.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 82e8c5403..a0660d4ed 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -1034,14 +1034,7 @@ struct BuildVehicleWindow : Window {
case BUILD_VEHICLE_WIDGET_BUILD: {
EngineID sel_eng = this->sel_engine;
if (sel_eng != INVALID_ENGINE) {
- CommandCallback *callback;
- switch (this->vehicle_type) {
- default: NOT_REACHED();
- case VEH_TRAIN: callback = (RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) ? CcBuildWagon : CcBuildLoco; break;
- case VEH_ROAD: callback = CcBuildRoadVeh; break;
- case VEH_SHIP: callback = CcBuildShip; break;
- case VEH_AIRCRAFT: callback = CcBuildAircraft; break;
- }
+ CommandCallback *callback = (this->vehicle_type == VEH_TRAIN && RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) ? CcBuildWagon : CcBuildPrimaryVehicle;
DoCommandP(this->window_number, sel_eng, 0, GetCmdBuildVeh(this->vehicle_type), callback);
}
break;