Merge branch 'enhanced_viewport_overlay-sx' into jgrpp
town_gui.cpp updated due to struct CommandContainer change. Conflicts: src/command.cpp src/command_type.h src/gfxinit.cpp src/openttd.cpp src/pbs.cpp src/saveload/extended_ver_sl.cpp src/saveload/extended_ver_sl.h src/saveload/saveload.cpp src/stdafx.h src/train_cmd.cpp src/viewport_type.h src/window_type.h
This commit is contained in:
@@ -631,6 +631,32 @@ struct RefitWindow : public Window {
|
||||
this->SetWidgetDisabledState(WID_VR_REFIT, this->sel[0] < 0);
|
||||
}
|
||||
|
||||
~RefitWindow()
|
||||
{
|
||||
if (this->window_number != INVALID_VEHICLE) {
|
||||
if (!FocusWindowById(WC_VEHICLE_VIEW, this->window_number)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnFocus(Window *previously_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, previously_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnFocusLost(Window *newly_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, newly_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnInit()
|
||||
{
|
||||
if (this->cargo != NULL) {
|
||||
@@ -1640,7 +1666,7 @@ public:
|
||||
|
||||
case WID_VL_SORT_BY_PULLDOWN:// Select sorting criteria dropdown menu
|
||||
ShowDropDownMenu(this, this->vehicle_sorter_names, this->vehicles.SortType(), WID_VL_SORT_BY_PULLDOWN, 0,
|
||||
(this->vli.vtype == VEH_TRAIN || this->vli.vtype == VEH_ROAD) ? 0 : (1 << 10));
|
||||
(this->vli.vtype == VEH_TRAIN || this->vli.vtype == VEH_ROAD) ? 0 : (1 << 10), 0, DDSF_LOST_FOCUS);
|
||||
return;
|
||||
|
||||
case WID_VL_LIST: { // Matrix to show vehicles
|
||||
@@ -1901,6 +1927,16 @@ struct VehicleDetailsWindow : Window {
|
||||
this->tab = TDW_TAB_CARGO;
|
||||
}
|
||||
|
||||
~VehicleDetailsWindow()
|
||||
{
|
||||
if (this->window_number != INVALID_VEHICLE) {
|
||||
if (!FocusWindowById(WC_VEHICLE_VIEW, this->window_number)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Some data on this window has become invalid.
|
||||
* @param data Information about the changed data.
|
||||
@@ -2218,7 +2254,7 @@ struct VehicleDetailsWindow : Window {
|
||||
|
||||
case WID_VD_SERVICE_INTERVAL_DROPDOWN: {
|
||||
const Vehicle *v = Vehicle::Get(this->window_number);
|
||||
ShowDropDownMenu(this, _service_interval_dropdown, v->ServiceIntervalIsCustom() ? (v->ServiceIntervalIsPercent() ? 2 : 1) : 0, widget, 0, 0);
|
||||
ShowDropDownMenu(this, _service_interval_dropdown, v->ServiceIntervalIsCustom() ? (v->ServiceIntervalIsPercent() ? 2 : 1) : 0, widget, 0, 0, 0, DDSF_LOST_FOCUS);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2268,6 +2304,22 @@ struct VehicleDetailsWindow : Window {
|
||||
this->vscroll->SetCapacityFromWidget(this, WID_VD_MATRIX);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnFocus(Window *previously_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, previously_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnFocusLost(Window *newly_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, newly_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** Vehicle details window descriptor. */
|
||||
@@ -2547,12 +2599,30 @@ public:
|
||||
|
||||
~VehicleViewWindow()
|
||||
{
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
DeleteWindowById(WC_VEHICLE_ORDERS, this->window_number, false);
|
||||
DeleteWindowById(WC_VEHICLE_REFIT, this->window_number, false);
|
||||
DeleteWindowById(WC_VEHICLE_DETAILS, this->window_number, false);
|
||||
DeleteWindowById(WC_VEHICLE_TIMETABLE, this->window_number, false);
|
||||
}
|
||||
|
||||
virtual void OnFocus(Window *previously_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, previously_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnFocusLost(Window *newly_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, newly_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
{
|
||||
const Vehicle *v = Vehicle::Get(this->window_number);
|
||||
|
Reference in New Issue
Block a user