| 3352 | } |
| 3353 | |
| 3354 | void UpdateButtonStatus() |
| 3355 | { |
| 3356 | const Vehicle *v = Vehicle::Get(this->window_number); |
| 3357 | bool veh_stopped = v->IsStoppedInDepot(); |
| 3358 | |
| 3359 | /* Widget WID_VV_GOTO_DEPOT must be hidden if the vehicle is already stopped in depot. |
| 3360 | * Widget WID_VV_CLONE_VEH should then be shown, since cloning is allowed only while in depot and stopped. |
| 3361 | */ |
| 3362 | PlaneSelections plane = veh_stopped ? SEL_DC_CLONE : SEL_DC_GOTO_DEPOT; |
| 3363 | NWidgetStacked *nwi = this->GetWidget<NWidgetStacked>(WID_VV_SELECT_DEPOT_CLONE); // Selection widget 'send to depot' / 'clone'. |
| 3364 | if (nwi->shown_plane + SEL_DC_BASEPLANE != plane) { |
| 3365 | this->SelectPlane(plane); |
| 3366 | this->SetWidgetDirty(WID_VV_SELECT_DEPOT_CLONE); |
| 3367 | } |
| 3368 | /* The same system applies to widget WID_VV_REFIT_VEH and VVW_WIDGET_TURN_AROUND.*/ |
| 3369 | if (v->IsGroundVehicle()) { |
| 3370 | plane = veh_stopped ? SEL_RT_REFIT : SEL_RT_TURN_AROUND; |
| 3371 | nwi = this->GetWidget<NWidgetStacked>(WID_VV_SELECT_REFIT_TURN); |
| 3372 | if (nwi->shown_plane + SEL_RT_BASEPLANE != plane) { |
| 3373 | this->SelectPlane(plane); |
| 3374 | this->SetWidgetDirty(WID_VV_SELECT_REFIT_TURN); |
| 3375 | } |
| 3376 | } |
| 3377 | } |
| 3378 | |
| 3379 | /** |
| 3380 | * Some data on this window has become invalid. |
no test coverage detected