end and side were unscoped enums: front, rear, left and right sat in the
global namespace (the test PCH had to leave mover.h out for it), and an end
went into any int, a side into an end, without a word from the compiler. They
become enum class VehicleEnd and VehicleSide (physics/vehicletypes.h); the
names follow the rule for types, and leave "end" and "side" to the many
locals of that name. The numbers stay: front 0, rear 1, right 0, left 1.
- ByEnd<T> / BySide<T>: two values indexed by the enum, and by a number
where a loop or a format counts them. The arrays of the ends and the sides
are these now: Couplers, Neighbours, Pantographs, MotorBlowers, Lights,
iLights, Doors.instances, pVehicles, IsAnyDoor*, m_lighthints, vCoulpler,
m_couplersounds, m_mirrormotion, iInventory, and the voltages of the
couplers
- VehicleEnds / VehicleSides to go through them, Opposite() in place of
1 - end, NumberOf() where a number is needed
- the couplers and the collisions take the ends they work on as VehicleEnd:
CouplerForce, CouplerVelocityDifference, CollisionDetect, crush_hit,
CompatibleCoupling and the rest of their family, DirF, DirPatch, and of
the vehicle couple, uncouple, the adapters, off_track_gap, has_signal_on;
Attach, Dettach and DettachStatus have overloads by the ends
- neighbour_data::FacingEnd() and TCoupling::ConnectedEnd() give the end of
the other vehicle as VehicleEnd; the fields stay numbers, as they hold -1
and 2 for "none" in places
The walks along the consist (FirstFind, Neighbour, the AI's coupling and
uncoupling) still carry the ends as numbers; where one of them meets a typed
end, NumberOf() and EndOf() say so, and keep the number as it was.
Kept as it was, and worth a look: TDynamicObject::SetLights() switches the
headlights A/B off by CabActive with the cases end::front and end::rear, that
is CabActive 0 and 1, while CabActive is 1 or -1 for the cabs; the cases are
NumberOf(VehicleEnd::front / rear) now, the same numbers.
No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b. betterRenderer/, not built, has had only end:: and side:: renamed.
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.
A vehicle of a trainset spawns in the pullee mode (MaSzyna-EU07/maszyna#64) with the parameter H
among the ones written after its coupling, on its own or with the others:
node -1 0 EU160-001 dynamic pkp/vectron_v1 1293-107 wariant_7w 0 nobody 3.H 0 enddynamic
... 3.BG.H ...
The parameters are told by their first letter (B brakes, W wheels, T temperatures, L load); H was
free, and one a build doesn't know is skipped, so a scenery with it loads in the releases too, where
the vehicle is as before. The letters after the H are left for later.
The mode is entered once the vehicle has its starting state, so a standing one lets go of its hand
brake and its spring brake switch. A vehicle with the H has nobody driving it, whatever its crew
entry says (its cab can't be activated); a driver left out is written to the log.
Refs MaSzyna-EU07/maszyna#64
A dead locomotive or unit in somebody else's train (hook and brake hose, coupling 3) brakes the
train today (MaSzyna-EU07/maszyna#64):
- one with the emergency brake of an inactive cab (InactiveCabFlag bit 1: of the test vehicles the
Vectron, Dragon, Elf, Impuls and EN57AKL) vents the brake pipe for as long as it is in the train,
since its cab is never activated. Behind an EU07 the pipe is empty in two seconds and stays so,
- the spring brake applies once the feed pipe of the vehicle, which is its own main reservoir, falls
below MinFP: at once without air, and within 20 minutes of a cold start as the reservoir leaks down
(EU47: 0.077 bar a minute, from 4.4 bar).
TMoverParameters::PulleeMode, set with PulleeModeSwitch(), is the vehicle prepared for hauling.
In the mode it:
- vents the brake pipe for nothing of its own (inactive cab, vigilance and cab signalling,
radio-stop, the spring brake of SpringBrakeDriveEmergencyVel); the alarm chain, which a train
parting sets, still does,
- gets no force from its spring brake, whatever air its cylinder has,
- has its driver's valve cut out and its local brake released, whatever the handles show. The
distributor stays on the brake pipe: it brakes and releases with the train,
- keeps its battery off and takes no cab: BatterySwitch(true) and CabActivisation() are refused,
and the BatterySwitch and CabActivisation commands of a train's driver pass through it.
Entering the mode lets go of the hand brake and of the spring brake switch and switches the battery
off; a vehicle with an active cab can't enter it. Leaving it gives the controls back and the spring
brake as its cylinder has it.
Nothing sets the mode yet, and a vehicle not in it does what it did.
Refs MaSzyna-EU07/maszyna#64