18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 03:37:09 +01:00

refactor(ai): the orders of the AI are DriverOrder and DriverOrders, not the bits of TOrders

The orders of the AI driver (TOrders) were unscoped bits, summed (an order
carries Change_direction on top of Shunt), masked, and compared as numbers
(order < Obey_train, order >= Shunt).

- vehicle/driverorders.h: enum class DriverOrder (waitForOrders,
  prepareEngine, releaseEngine, changeDirection, connect, disconnect, shunt,
  looseShunt, obeyTrain, bank, jumpToFirstOrder) and DriverOrders, an
  EnumSet of them. A small header, so brakesetting.h names the orders without
  Driver.h.
- the comparisons of the numbers are the sets they meant: the orders from
  shunt up are movingOrders, those from obeyTrain up trainOrders;
  SingleOrder() gives the order to a switch, where a sum of several matches
  no case, as it did
- the texts of the scenery commands (Shunt, Obey_train...) and of the
  translations are unchanged; only the C++ names changed

No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b.
This commit is contained in:
2026-11-28 13:43:45 +01:00
parent 54d3a1040a
commit b35a6129bc
10 changed files with 311 additions and 276 deletions
+2 -2
View File
@@ -605,7 +605,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return std::abs(mvControlling->Ft) > 30.0 || (OrderCurrentGet() & Disconnect) == 0; } );
return std::abs(mvControlling->Ft) > 30.0 || false == OrderCurrentGet().HasAny(DriverOrder::disconnect); } );
break;
}
@@ -836,7 +836,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return IsConsistBraked /*|| ( ( OrderCurrentGet() & Disconnect ) == 0 ) */; } );
return IsConsistBraked /*|| ( false == OrderCurrentGet().HasAny(DriverOrder::disconnect) ) */; } );
break;
}
case driver_hint::brakingforcedecrease: {