Show vehicle route markers when cargo load by type window focused.
This commit is contained in:
@@ -153,6 +153,13 @@ public:
|
|||||||
this->owner = v->owner;
|
this->owner = v->owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~CargoTypeOrdersWindow()
|
||||||
|
{
|
||||||
|
if (!FocusWindowById(WC_VEHICLE_ORDERS, this->window_number)) {
|
||||||
|
MarkAllRouteStepsDirty(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||||
{
|
{
|
||||||
if (widget == WID_CTO_HEADER) {
|
if (widget == WID_CTO_HEADER) {
|
||||||
@@ -241,6 +248,22 @@ public:
|
|||||||
SetDParam(2, this->vehicle->GetOrder(this->order_id)->GetDestination());
|
SetDParam(2, this->vehicle->GetOrder(this->order_id)->GetDestination());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void OnFocus(Window *previously_focused_window) OVERRIDE
|
||||||
|
{
|
||||||
|
if (HasFocusedVehicleChanged(this->window_number, previously_focused_window)) {
|
||||||
|
MarkAllRoutePathsDirty(this->vehicle);
|
||||||
|
MarkAllRouteStepsDirty(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void OnFocusLost(Window *newly_focused_window) OVERRIDE
|
||||||
|
{
|
||||||
|
if (HasFocusedVehicleChanged(this->window_number, newly_focused_window)) {
|
||||||
|
MarkAllRoutePathsDirty(this->vehicle);
|
||||||
|
MarkAllRouteStepsDirty(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1289,6 +1312,8 @@ public:
|
|||||||
|
|
||||||
~OrdersWindow()
|
~OrdersWindow()
|
||||||
{
|
{
|
||||||
|
DeleteWindowById(WC_VEHICLE_CARGO_TYPE_LOAD_ORDERS, this->window_number, false);
|
||||||
|
DeleteWindowById(WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS, this->window_number, false);
|
||||||
if (!FocusWindowById(WC_VEHICLE_VIEW, this->window_number)) {
|
if (!FocusWindowById(WC_VEHICLE_VIEW, this->window_number)) {
|
||||||
MarkAllRouteStepsDirty(this);
|
MarkAllRouteStepsDirty(this);
|
||||||
}
|
}
|
||||||
|
@@ -877,6 +877,8 @@ void Vehicle::PreDestructor()
|
|||||||
DeleteWindowById(WC_VEHICLE_REFIT, this->index);
|
DeleteWindowById(WC_VEHICLE_REFIT, this->index);
|
||||||
DeleteWindowById(WC_VEHICLE_DETAILS, this->index);
|
DeleteWindowById(WC_VEHICLE_DETAILS, this->index);
|
||||||
DeleteWindowById(WC_VEHICLE_TIMETABLE, this->index);
|
DeleteWindowById(WC_VEHICLE_TIMETABLE, this->index);
|
||||||
|
DeleteWindowById(WC_VEHICLE_CARGO_TYPE_LOAD_ORDERS, this->index);
|
||||||
|
DeleteWindowById(WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS, this->index);
|
||||||
SetWindowDirty(WC_COMPANY, this->owner);
|
SetWindowDirty(WC_COMPANY, this->owner);
|
||||||
OrderBackup::ClearVehicle(this);
|
OrderBackup::ClearVehicle(this);
|
||||||
}
|
}
|
||||||
|
@@ -126,6 +126,8 @@ static inline bool HasFocusedVehicleChanged(const VehicleID vid, Window *ref_win
|
|||||||
case WC_VEHICLE_ORDERS:
|
case WC_VEHICLE_ORDERS:
|
||||||
case WC_VEHICLE_TIMETABLE:
|
case WC_VEHICLE_TIMETABLE:
|
||||||
case WC_VEHICLE_VIEW:
|
case WC_VEHICLE_VIEW:
|
||||||
|
case WC_VEHICLE_CARGO_TYPE_LOAD_ORDERS:
|
||||||
|
case WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS:
|
||||||
return ((uint32) wn != vid);
|
return ((uint32) wn != vid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1714,6 +1714,8 @@ static inline Vehicle *GetVehicleFromWindow(Window *w)
|
|||||||
case WC_VEHICLE_TIMETABLE:
|
case WC_VEHICLE_TIMETABLE:
|
||||||
case WC_VEHICLE_DETAILS:
|
case WC_VEHICLE_DETAILS:
|
||||||
case WC_VEHICLE_REFIT:
|
case WC_VEHICLE_REFIT:
|
||||||
|
case WC_VEHICLE_CARGO_TYPE_LOAD_ORDERS:
|
||||||
|
case WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS:
|
||||||
if (wn != INVALID_VEHICLE) return Vehicle::Get(wn);
|
if (wn != INVALID_VEHICLE) return Vehicle::Get(wn);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user