| 2993 | |
| 2994 | public: |
| 2995 | VehicleViewWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc) |
| 2996 | { |
| 2997 | this->flags.Set(WindowFlag::DisableVpScroll); |
| 2998 | this->CreateNestedTree(); |
| 2999 | |
| 3000 | /* Sprites for the 'send to depot' button indexed by vehicle type. */ |
| 3001 | static const SpriteID vehicle_view_goto_depot_sprites[] = { |
| 3002 | SPR_SEND_TRAIN_TODEPOT, |
| 3003 | SPR_SEND_ROADVEH_TODEPOT, |
| 3004 | SPR_SEND_SHIP_TODEPOT, |
| 3005 | SPR_SEND_AIRCRAFT_TODEPOT, |
| 3006 | }; |
| 3007 | const Vehicle *v = Vehicle::Get(window_number); |
| 3008 | this->GetWidget<NWidgetCore>(WID_VV_GOTO_DEPOT)->SetSprite(vehicle_view_goto_depot_sprites[v->type]); |
| 3009 | |
| 3010 | /* Sprites for the 'clone vehicle' button indexed by vehicle type. */ |
| 3011 | static const SpriteID vehicle_view_clone_sprites[] = { |
| 3012 | SPR_CLONE_TRAIN, |
| 3013 | SPR_CLONE_ROADVEH, |
| 3014 | SPR_CLONE_SHIP, |
| 3015 | SPR_CLONE_AIRCRAFT, |
| 3016 | }; |
| 3017 | this->GetWidget<NWidgetCore>(WID_VV_CLONE)->SetSprite(vehicle_view_clone_sprites[v->type]); |
| 3018 | |
| 3019 | switch (v->type) { |
| 3020 | case VEH_TRAIN: |
| 3021 | this->GetWidget<NWidgetCore>(WID_VV_TURN_AROUND)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_REVERSE_TOOLTIP); |
| 3022 | this->GetWidget<NWidgetStacked>(WID_VV_FORCE_PROCEED_SEL)->SetDisplayedPlane(0); |
| 3023 | break; |
| 3024 | |
| 3025 | case VEH_ROAD: |
| 3026 | this->GetWidget<NWidgetStacked>(WID_VV_FORCE_PROCEED_SEL)->SetDisplayedPlane(SZSP_NONE); |
| 3027 | break; |
| 3028 | |
| 3029 | case VEH_SHIP: |
| 3030 | case VEH_AIRCRAFT: |
| 3031 | this->GetWidget<NWidgetStacked>(WID_VV_FORCE_PROCEED_SEL)->SetDisplayedPlane(SZSP_NONE); |
| 3032 | this->SelectPlane(SEL_RT_REFIT); |
| 3033 | break; |
| 3034 | |
| 3035 | default: NOT_REACHED(); |
| 3036 | } |
| 3037 | this->FinishInitNested(window_number); |
| 3038 | this->owner = v->owner; |
| 3039 | this->GetWidget<NWidgetViewport>(WID_VV_VIEWPORT)->InitializeViewport(this, static_cast<VehicleID>(this->window_number), ScaleZoomGUI(_vehicle_view_zoom_levels[v->type])); |
| 3040 | |
| 3041 | this->GetWidget<NWidgetCore>(WID_VV_START_STOP)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_STATUS_START_STOP_TOOLTIP + v->type); |
| 3042 | this->GetWidget<NWidgetCore>(WID_VV_RENAME)->SetToolTip(STR_VEHICLE_DETAILS_TRAIN_RENAME + v->type); |
| 3043 | this->GetWidget<NWidgetCore>(WID_VV_LOCATION)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_CENTER_TOOLTIP + v->type); |
| 3044 | this->GetWidget<NWidgetCore>(WID_VV_REFIT)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_REFIT_TOOLTIP + v->type); |
| 3045 | this->GetWidget<NWidgetCore>(WID_VV_GOTO_DEPOT)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_SEND_TO_DEPOT_TOOLTIP + v->type); |
| 3046 | this->GetWidget<NWidgetCore>(WID_VV_SHOW_ORDERS)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_ORDERS_TOOLTIP + v->type); |
| 3047 | this->GetWidget<NWidgetCore>(WID_VV_SHOW_DETAILS)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_SHOW_DETAILS_TOOLTIP + v->type); |
| 3048 | this->GetWidget<NWidgetCore>(WID_VV_CLONE)->SetToolTip(STR_VEHICLE_VIEW_CLONE_TRAIN_INFO + v->type); |
| 3049 | |
| 3050 | this->UpdateButtonStatus(); |
| 3051 | } |
| 3052 |
nothing calls this directly
no test coverage detected