1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-26 21:54:22 +01:00

Codechange: Use enum class and EnumBitSet for various order flags. (#14783)

This commit is contained in:
Peter Nelson
2025-12-06 12:29:11 +00:00
committed by GitHub
parent c1d37d8699
commit 046b0c6267
20 changed files with 358 additions and 340 deletions

View File

@@ -110,7 +110,7 @@ static bool CanDetermineTimeTaken(const Order &order, bool travelling)
if (travelling && !order.IsTravelTimetabled()) return false;
/* No wait time but we are loading at this timetabled station */
if (!travelling && !order.IsWaitTimetabled() && order.IsType(OT_GOTO_STATION) &&
!(order.GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) {
!order.GetNonStopType().Test(OrderNonStopFlag::NoDestination)) {
return false;
}
@@ -208,7 +208,7 @@ struct TimetableWindow : Window {
{
assert(v->vehicle_flags.Test(VehicleFlag::TimetableStarted));
bool travelling = (!v->current_order.IsType(OT_LOADING) || v->current_order.GetNonStopType() == ONSF_STOP_EVERYWHERE);
bool travelling = (!v->current_order.IsType(OT_LOADING) || v->current_order.GetNonStopType().None());
TimerGameTick::Ticks start_time = -v->current_order_time;
/* If arrival and departure times are in days, compensate for the current date_fract. */
@@ -348,7 +348,7 @@ struct TimetableWindow : Window {
if (selected % 2 != 0) {
disable = order != nullptr && (order->IsType(OT_CONDITIONAL) || order->IsType(OT_IMPLICIT));
} else {
disable = order == nullptr || ((!order->IsType(OT_GOTO_STATION) || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) && !order->IsType(OT_CONDITIONAL));
disable = order == nullptr || ((!order->IsType(OT_GOTO_STATION) || order->GetNonStopType().Test(OrderNonStopFlag::NoDestination)) && !order->IsType(OT_CONDITIONAL));
}
}
bool disable_speed = disable || selected % 2 == 0 || v->type == VEH_AIRCRAFT;