Show viewport route overlay for shared order vehicle list windows

This commit is contained in:
Jonathan G Rennison
2022-11-19 00:00:23 +00:00
parent 4990a25e48
commit b52bb3ca44
2 changed files with 31 additions and 0 deletions

View File

@@ -2133,6 +2133,15 @@ private:
BP_SHARED_ORDERS, ///< Show the normal caption. BP_SHARED_ORDERS, ///< Show the normal caption.
}; };
void RefreshRouteOverlay() const
{
if (this->vli.type == VL_SHARED_ORDERS) {
const Vehicle *v = Vehicle::GetIfValid(this->vli.index);
MarkAllRoutePathsDirty(v);
MarkAllRouteStepsDirty(v);
}
}
public: public:
VehicleListWindow(WindowDesc *desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number) VehicleListWindow(WindowDesc *desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number)
{ {
@@ -2168,6 +2177,17 @@ public:
~VehicleListWindow() ~VehicleListWindow()
{ {
*this->sorting = this->vehgroups.GetListing(); *this->sorting = this->vehgroups.GetListing();
this->RefreshRouteOverlay();
}
virtual void OnFocus(Window *previously_focused_window) override
{
this->RefreshRouteOverlay();
}
virtual void OnFocusLost(Window *newly_focused_window) override
{
this->RefreshRouteOverlay();
} }
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override

View File

@@ -114,6 +114,7 @@
#include "infrastructure_func.h" #include "infrastructure_func.h"
#include "tracerestrict.h" #include "tracerestrict.h"
#include "worker_thread.h" #include "worker_thread.h"
#include "vehiclelist.h"
#include <map> #include <map>
#include <vector> #include <vector>
@@ -2280,6 +2281,16 @@ static inline Vehicle *GetVehicleFromWindow(Window *w)
case WC_VEHICLE_CARGO_TYPE_UNLOAD_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;
case WC_TRAINS_LIST:
case WC_ROADVEH_LIST:
case WC_SHIPS_LIST:
case WC_AIRCRAFT_LIST: {
VehicleListIdentifier vli = VehicleListIdentifier::UnPack(wn);
if (vli.type == VL_SHARED_ORDERS) {
return Vehicle::GetIfValid(vli.index);
}
break;
}
default: default:
break; break;
} }