Show viewport route overlay for shared order vehicle list windows

pull/453/head
Jonathan G Rennison 2 years ago
parent 4990a25e48
commit b52bb3ca44

@ -2133,6 +2133,15 @@ private:
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:
VehicleListWindow(WindowDesc *desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number)
{
@ -2168,6 +2177,17 @@ public:
~VehicleListWindow()
{
*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

@ -114,6 +114,7 @@
#include "infrastructure_func.h"
#include "tracerestrict.h"
#include "worker_thread.h"
#include "vehiclelist.h"
#include <map>
#include <vector>
@ -2280,6 +2281,16 @@ static inline Vehicle *GetVehicleFromWindow(Window *w)
case WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS:
if (wn != INVALID_VEHICLE) return Vehicle::Get(wn);
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:
break;
}

Loading…
Cancel
Save