mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 05:02:45 +01:00
refactor(physics): the couplings are Coupling and CouplingSet, not the bits of an int
What a coupling between two vehicles joins (the coupler, the brake hose, the
control cable, the high voltage...) was an int of bits, tested as
(flag & 36) == 36, (x & coupling::control) != 0, TestFlag(), SetFlag(x, -y),
compared with 0 and 3, with the same values twice (coupling:: and ctrain_).
- enum class Coupling (coupler, brakeHose, control, highVoltage, gangway,
mainHose, heating, permanent, power24v, power110v, power3x400v), the values
the scenery files and the definitions have always used; ctrain_* is gone
- CouplingSet, a set of them: HasAll(), HasAny(), Empty(), Set(), Clear()
(as SetFlag() and ClearFlag() worked), Without(), |, &, ^, ==, and a test
of any kind in a condition
- TCoupling's CouplingFlag, AllowedFlag, AutomaticCouplingFlag, PowerFlag and
PowerCoupling, TCommand's couplings (was Coupling), the coupling parameters
of the commands, Attach(), CompatibleCoupling(), Next(), Prev(),
FirstFind(), is_connected(), the AI's iCoupler are CouplingSet
- the numbers are read into a set where they come in: the .fiz (BuffCoupl,
negative AllowedFlag still meaning permanent), the scenery trainsets, the
AI's Connect command, InvCtrCplFlag; and written as numbers where they go
out: the scenery loader, the black box, the debug panels, DettachStatus()
- (CouplingFlag & 36) == 36 reads HasAll(Coupling::control | Coupling::mainHose)
No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b.
This commit is contained in:
@@ -188,7 +188,7 @@ bool test_manager::tested_trains_at_rest() const
|
||||
// the consists as they are now: a train the tested one couples to joins it, one it leaves behind doesn't
|
||||
return std::ranges::none_of(Global.test.vehicles, [](std::string const &Name) {
|
||||
auto *vehicle { simulation::Vehicles.find(Name) };
|
||||
return vehicle != nullptr && vehicle->find_vehicle(coupling::coupler, is_moving) != nullptr;
|
||||
return vehicle != nullptr && vehicle->find_vehicle(Coupling::coupler, is_moving) != nullptr;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user