Departures: Use silver for via departures, yellow for no load/unload

This commit is contained in:
Jonathan G Rennison 2024-09-09 18:29:29 +01:00
parent e7bd85926c
commit 3813dc3698
3 changed files with 21 additions and 6 deletions

View File

@ -105,25 +105,35 @@ bool IsArrivalDepartureTest(DepartureCallingSettings settings, const Order *orde
}
}
static bool DepartureLoadFilter(const Order *order)
{
return order->GetLoadType() != OLFB_NO_LOAD;
}
static bool ArrivalLoadFilter(const Order *order)
{
return order->GetUnloadType() != OUFB_NO_UNLOAD;
}
bool DepartureCallingSettings::IsDeparture(const Order *order, const DepartureOrderDestinationDetector &source) const
{
if (!source.OrderMatches(order)) return false;
return IsArrivalDepartureTest(*this, order, [](const Order *order) {
return order->GetLoadType() != OLFB_NO_LOAD;
});
return IsArrivalDepartureTest(*this, order, DepartureLoadFilter);
}
bool DepartureCallingSettings::IsArrival(const Order *order, const DepartureOrderDestinationDetector &source) const
{
if (!source.OrderMatches(order)) return false;
return IsArrivalDepartureTest(*this, order, [](const Order *order) {
return order->GetUnloadType() != OUFB_NO_UNLOAD;
});
return IsArrivalDepartureTest(*this, order, ArrivalLoadFilter);
}
DepartureShowAs DepartureCallingSettings::GetShowAsType(const Order *order, DepartureType type) const
{
if (this->CheckShowAsViaType() && (order->GetType() == OT_GOTO_STATION) && !IsStationOrderWithWait(order)) return DSA_VIA;
if (order->IsType(OT_GOTO_STATION)) {
if (type == D_DEPARTURE && !DepartureLoadFilter(order)) return DSA_NO_LOAD;
if (type == D_ARRIVAL && !ArrivalLoadFilter(order)) return DSA_NO_LOAD;
}
return DSA_NORMAL;
}

View File

@ -914,6 +914,10 @@ void DeparturesWindow::DrawDeparturesListItems(const Rect &r) const
break;
case DSA_VIA:
time_colour = TC_SILVER;
break;
case DSA_NO_LOAD:
time_colour = TC_YELLOW;
break;
}

View File

@ -63,6 +63,7 @@ struct RemoveVia {
enum DepartureShowAs : uint8_t {
DSA_NORMAL,
DSA_VIA,
DSA_NO_LOAD,
};
/** A scheduled departure. */