| 3219 | } |
| 3220 | |
| 3221 | void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override |
| 3222 | { |
| 3223 | const Vehicle *v = Vehicle::Get(this->window_number); |
| 3224 | |
| 3225 | switch (widget) { |
| 3226 | case WID_VV_RENAME: { // rename |
| 3227 | ShowQueryString(GetString(STR_VEHICLE_NAME, v->index), STR_QUERY_RENAME_TRAIN_CAPTION + v->type, |
| 3228 | MAX_LENGTH_VEHICLE_NAME_CHARS, this, CS_ALPHANUMERAL, {QueryStringFlag::EnableDefault, QueryStringFlag::LengthIsInChars}); |
| 3229 | break; |
| 3230 | } |
| 3231 | |
| 3232 | case WID_VV_START_STOP: // start stop |
| 3233 | StartStopVehicle(v, false); |
| 3234 | break; |
| 3235 | |
| 3236 | case WID_VV_ORDER_LOCATION: { |
| 3237 | /* Scroll to current order destination */ |
| 3238 | TileIndex tile = v->current_order.GetLocation(v); |
| 3239 | if (tile == INVALID_TILE) break; |
| 3240 | |
| 3241 | if (_ctrl_pressed) { |
| 3242 | ShowExtraViewportWindow(tile); |
| 3243 | } else { |
| 3244 | ScrollMainWindowToTile(tile); |
| 3245 | } |
| 3246 | break; |
| 3247 | } |
| 3248 | |
| 3249 | case WID_VV_LOCATION: // center main view |
| 3250 | if (_ctrl_pressed) { |
| 3251 | ShowExtraViewportWindow(TileVirtXY(v->x_pos, v->y_pos)); |
| 3252 | } else { |
| 3253 | const Window *mainwindow = GetMainWindow(); |
| 3254 | if (click_count > 1) { |
| 3255 | /* main window 'follows' vehicle */ |
| 3256 | mainwindow->viewport->follow_vehicle = v->index; |
| 3257 | } else { |
| 3258 | if (mainwindow->viewport->follow_vehicle == v->index) mainwindow->viewport->follow_vehicle = VehicleID::Invalid(); |
| 3259 | ScrollMainWindowTo(v->x_pos, v->y_pos, v->z_pos); |
| 3260 | } |
| 3261 | } |
| 3262 | break; |
| 3263 | |
| 3264 | case WID_VV_GOTO_DEPOT: // goto hangar |
| 3265 | Command<CMD_SEND_VEHICLE_TO_DEPOT>::Post(GetCmdSendToDepotMsg(v), v->index, _ctrl_pressed ? DepotCommandFlag::Service : DepotCommandFlags{}, {}); |
| 3266 | break; |
| 3267 | case WID_VV_REFIT: // refit |
| 3268 | ShowVehicleRefitWindow(v, INVALID_VEH_ORDER_ID, this); |
| 3269 | break; |
| 3270 | case WID_VV_SHOW_ORDERS: // show orders |
| 3271 | if (_ctrl_pressed) { |
| 3272 | ShowTimetableWindow(v); |
| 3273 | } else { |
| 3274 | ShowOrdersWindow(v); |
| 3275 | } |
| 3276 | break; |
| 3277 | case WID_VV_SHOW_DETAILS: // show details |
| 3278 | if (_ctrl_pressed) { |
nothing calls this directly
no test coverage detected