mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 09:27:10 +01:00
12c5bb35e712fa2a778a6826d951568f03600a01
4461 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
12c5bb35e7 |
refactor(vehicle): the helpers of the split files out of the global namespace
The split of Driver.cpp, DynObj.cpp and Train.cpp took five helpers out of their anonymous namespaces. outside() is used in offtrack.cpp alone and goes back into its anonymous namespace. The four shared by the parts of a class go into a namespace of its module: vehicle_ai (brake_response_horizon, uphill_stopping_distance), vehicle_dynamic (seconds_since) and vehicle_cab (is_hold_coil_lever). The rename of mover to physics also hit comments where the word meant something else: "prime mover" and "move the master controller" are back. |
||
|
|
dc7bd0efe6 |
fix(vehicle): the headlight dimmer by the active cab, the pantograph by its end
SetLightDimmings(), which the dimmer commands of the cab and the AI's hints call, picked the headlights to put out by iDirection, while RaLightsSet() picks them by the active cab (CabEnd(CabActive)) since the mover became physics::Vehicle. From cab -1 with iDirection > 0 the dimmer put out A and RaLightsSet() B, so both ends went dark. Both now use the end of the active cab: cab 1 the A headlights, cab -1 the B ones, and none without an active cab. This changes behaviour against staging, where RaLightsSet() compared CabActive with the end numbers (0 put out A, 1 put out B, -1 nothing) and SetLightDimmings() went by iDirection. updatePantographMotion() read pantographs[i] by the animation index, past the two ends for a model with more than two pantograph animations (an old fault, staging DynObj.cpp). It reads pantographs[PantographEnd(i)] now, as the voltage and the count of raised pantographs already do. |
||
|
|
5d3b3bc095 |
fix(debug): the couplings in the coupler line of the debug panel as a number, not the set
The coupler line of the debug panel passed the CouplingSet itself to snprintf under %d. A class object through varargs is undefined behaviour (SonarCloud S2275, a blocker on #531); it now passes CouplingFlag.Bits(), the same number the line showed before. |
||
|
|
6aca6bc4f6 |
fix(review): an empty Load= no longer throws, and the stale notes of the review of #531
From the review of #531: - Load= and UnLoad= without the name of a load threw std::out_of_range as soon as ParseVehicleCommand() read them: extract_value() reads past the end of the text when nothing but spaces follows the =. Before this branch the same exception came later, in the RunCommand() of a vehicle standing at the ramp. ParseVehicleCommand() gives an empty name now, which loads and unloads nothing (AssignLoad("") and LoadingDone() with no name, as for an empty vehicle). extract_value() itself is left as it was: it has hundreds of callers and test_utilities.cpp records its exception at the end of the text. New checks in test_vehicle_command.cpp. - compression_at() is an inline function of physics/components/internal.h, as square() is, rather than a global function of external linkage defined in collisions.cpp; its body is the same - the comment of train_type::sn61 says what the AI does for it (the master controller up to a position with torque after setting the direction) rather than that nothing handles it - tests/unit/COVERAGE.md names the files as they are now (physics/components/, vehicle/dynamic/lifecycle.cpp) instead of physics/physics.cpp, a name the renaming script left there The naming of AGENTS.md, which the review asked about, stays as it is. |
||
|
|
38b1110d1b |
Merge origin/staging into cleanup/mover
Staging's 7 commits since |
||
|
|
89258eb72c |
refactor(physics): the low voltage, the train heating and the electrodynamic brake as components
The rest of the electrics of physics::Vehicle beside the traction motors
becomes components, with English names:
lowVoltage (LowVoltageSupply, Battery batteryOn, BatteryVoltage,
physics/components/lowvoltage.h) NominalBatteryVoltage, BatteryStart,
Power110vIsAvailable / Power24vIsAvailable /
Power24vVoltage power110vAvailable /
power24vAvailable / power24vVoltage, the
battery button of the cab: batteryButtonFired,
batteryButtonImpulse, batteryButtonHeld,
batteryButtonHoldTime
trainHeating (TrainHeating) Heating on, HeatingAllow allow,
HeatingSwitchImpulse switchImpulse,
HeatingPower power, EngineHeatingRPM engineRpm
brakes.electrodynamic the DynamicBrake* fields: type, ammeters,
(ElectrodynamicBrake, controllerPositions, controllerPosition,
physics/components/braking.h) resistance(1, 2), on, emuWorking;
SplitEDPneumaticBrake splitFromPneumatic;
the fans of the braking resistor (BRVentilators,
BRVto, BRVtimer, Imaxrpc): resistorFansRunning,
resistorFansSustain, resistorFansTimer,
resistorPassiveMaxCurrent
The diesel-electric dynamic brake (DEDynamicBrake) and the currents of the
traction circuit (Im, Itot, EngineVoltage ...) stay for the traction stage.
No string literal changed (checked over all the changed files).
No change in behaviour: 1149/1149 tests, golden traces exact against staging
|
||
|
|
1bea280010 |
refactor(physics): the line breaker, the line contactors, the relays and the converter as components
The main circuit of physics::Vehicle becomes components, with English names
(physics/components/maincircuit.h):
lineBreaker (LineBreaker) Mains closed, MainsInitTime(Countdown)
initTime / initCountdown, MainsStart start,
JointEngineStart jointStart,
PantographsRequireMains pantographsRequireIt,
LineBreakerClosesOnlyAtNoPowerPos
closesOnlyAtNoPower,
EmergencyBrakeMainOffPressure emergencyOffPressure
lineContactors (LineContactors) StLinFlag closed, StLinSwitchOff forcedOpen,
StLinSwitchType switchType,
LineContactorsInterlock interlock,
LastRelayTime lastSwitchTime
protection (ProtectionRelays) NoVoltRelay noVoltage, OvervoltageRelay
overvoltage, GroundRelay(Start) ground(Start),
ControlPressureSwitch pressureSwitch,
HasControlPressureSwitch hasPressureSwitch,
PressureSwitchBrakeCylinder
pressureSwitchWatchesCylinders
converter (PowerConverter) the Converter* fields: start, startDelay(Timer),
allow(Local), running, overloadRelayStart,
overloadRelayOffWithLineBreaker; ConvOvldFlag
overloaded, ConvSwitchType switchType
The long comments of the fields went with them into the header. Where the
loading of the .fiz has using enum start_t, the member is this->converter:
the enumerator start_t::converter would hide it there.
No string literal changed (checked over all the changed files).
No change in behaviour: 1149/1149 tests, golden traces exact against staging
|
||
|
|
5e56a91515 |
refactor(physics): the devices out of physics::Vehicle, the pantographs as components
The types of the devices nested in physics::Vehicle (basic_device, the pumps,
the fans, basic_valve, basic_pantograph, basic_door, door_data, water_heater,
genset_device) move out of it into physics/components/devices.h, namespace
physics, so the components of the vehicle can hold them.
The pantographs and their air become components, with English names
(physics/components/pantographs.h):
Pantographs pantographs (ByEnd<basic_pantograph>)
pantographCircuit PantFrontVolt / PantRearVolt frontVoltage /
rearVoltage, PantographVoltage supplyVoltage,
PantAllDown allDown, PantSwitchType switchType,
PantsPreset presets
pantographAir PantVolume volume, PantPress pressure,
PantCompFlag compressorRunning,
PantographCompressorStart compressorStart,
SmallCompressorPower compressorPower, PantsValve
valve, bPantKurek3 connectedToMainReservoir,
PantAutoValve autoValve, PantPressSwitchActive /
PantPressLockActive pressureSwitchActive /
pressureLockActive
No string literal changed (checked over all the changed files).
No change in behaviour: 1149/1149 tests, golden traces exact against staging
|
||
|
|
16568d5695 |
refactor(physics): the brake valves, cylinders, pressures and positions in physics::Braking
The rest of the braking of physics::Vehicle moves into brakes, with English
names (physics/components/braking.h):
the valves Hamulec distributor, Handle driverValve,
LocHandle independentValve
the definition BrakeSystem kind, BrakeSubsystem subsystem, BrakeValve /
BrakeValveSize / BrakeValveParams distributorType / Size /
Parameters, BrakeHandle / BrakeLocHandle driverValveType /
independentValveType, the Handle_* driverValveSettings,
LocalBrake localKind, MaxBrakePress maxCylinderPressure,
LoadFlag loadSetting, P2FTrans pressureToForce, NBpA
blocksPerAxle, High/Low/DeltaPipePress pipeHigh/LowPressure
/ pipePressureRange, CntrlPipePress controlReservoirPressure,
Spg pipeSection, RapidMult / RapidVel rapidRatio / rapidSpeed,
BrakeDelay delays, BrakeCtrlPosNo handlePositions, ...
cylinders BrakeCylNo / Radius / Dist / Mult / Spring, BrakeSlckAdj,
BrakeRigEff: count, radius, stroke, leverRatio, springForce,
slackAdjusterForce, riggingEfficiency
emergencyValve EmergencyValveOn / Off / Open / Area / Flow
pipeLock LockPipeOn / Off, HandleUnlock, LockPipe, UnlockPipe
the state BrakePress cylinderPressure, LocBrakePress
independentCylinderPressure, EqvtPipePress
equivalentPipePressure, Volume reservoirAir, dpBrake / dpPipe /
dpMainValve / dpLocalValve brakeFlow / pipeFlow /
driverValveFlow / independentValveFlow, BrakeCtrlPos(R, 2)
handlePosition(Real), handleCapPosition, fBrakeCtrlPos
handlePositionSmooth, LocalBrakePosA(EIM) independentPosition
(Eim), BrakeStatus status, AlarmChainFlag alarmChain,
BrakeDelayFlag / BrakeDelays delaySetting / availableDelays,
BrakeOpModeFlag / BrakeOpModes operatingMode /
availableOperatingModes, UnitBrakeForce unitForce, ...
Renamed in the files of the vehicle itself, and elsewhere only where reached
through -> or .: the driver keeps its own BrakeSystem, the editor its Handle,
the radio its Volume, and the brake valve classes (brakes.*, oerlikonest.*)
their fields of the same names. The C arrays (MaxBrakePress, BrakeCylMult,
the universal buttons) are std::arrays of the same values; the bits of status,
delaySetting and operatingMode stay ints for now.
No change in behaviour: 1149/1149 tests, golden traces exact against staging
|
||
|
|
309926bb05 |
refactor(physics): the air supply and the pipes along the train as components
The air of physics::Vehicle becomes components of their own, with the fields
named in English (physics/components/airsupply.h):
air (AirSupply) the compressor and the main reservoir:
compressor (AirCompressor) MinCompressor, MaxCompressor and those of each
cab, CabDependentCompressor, CompressorSpeed,
CompressorPower, CompressorStartDelay,
CompressorTankValve, CompressorStart, the
CompressorList programmer and its switch, and
the state: CompressorFlag running,
CompressorAllow(Local) allow(Local),
CompressorGovernorLock, CompressorPowerTime
VeselVolume mainReservoirVolume
Compressor mainReservoirPressure
CompressedVolume compressedVolume
AirLeakRate leakRate
brakePipe, mainPipe the two pipes along the train, of one type,
(TrainPipe) TrainPipe: reservoir, pressure, couplersPending
(Pipe, PipePress, PipeCouplersPending and Pipe2,
ScndPipePress, ScndPipeCouplersPending before)
CompressorPower, a number 0 to 5, is the enum CompressorSupply (mainCircuit,
converterManual, converter, engine, frontUnitConverter, rearUnitConverter),
read from the same words of the .fiz. The CompressorList table is a
std::array of the same ints.
The exchange of air through the hoses (pneumatics.cpp) takes the pipe as one
TrainPipe of the vehicle instead of three member pointers.
No change in behaviour: 1149/1149 tests, golden traces exact against staging
|
||
|
|
2753994bf6 |
refactor(physics): the blending, the holding brake and the spring brake in physics::Braking
The first part of the braking of physics::Vehicle becomes a component of its
own, brakes (physics/components/braking.h), with the fields named in English:
blending (BrakeBlending) the MED_* of the Blending section and their
timers: maxSpeed, minSpeed, referenceSpeed,
maxDeceleration, epCorrection(Time, Timer),
loadCorrection, minEdDemand, edForceFactor,
edFirstDelay, edNextDelay, edDelayTimer
emuDynamic (EmuDynamicBrake) the DCEMUED_*: checkedCoupler, epMaxSpeed,
epMinCurrent, epDelay
holding (HoldingBrake) StopBrakeDecc, StopBrakeReleaseDelay, the timer:
deceleration, releaseDelay, releaseTimer
spring (SpringBrake) the nested spring_brake (SBP is pressure,
ShuttOff shutOff, MultiTractionCoupler
controlCouplings ...) and the
ReleaseParkingBySpringBrake*,
SpringBrakeCutsOffDrive,
SpringBrakeDriveEmergencyVel of the vehicle
Each field says in its comment the key of the .fiz it comes from; the keys,
the golden channel names and the texts are as they were. The struct is
Braking, not BrakeSystem, the name of the kind of the train brake the vehicle
already has.
Kept as it was, to look at: the spring brake reads valveOffArea from the key
ValveOnArea and valveOnArea from ValveOffArea.
No change in behaviour: 1149/1149 tests, golden traces exact against staging
|
||
|
|
d0387753f8 |
refactor(physics): TMoverParameters becomes physics::Vehicle, the mover is gone
The physics of a vehicle loses the name it had from the Pascal of 2001. Done by
tools/rename/mover_to_physics.py, committed with it:
physics/mover.h physics/vehicle.h
TMoverParameters physics::Vehicle (in namespace physics)
TDynamicObject::MoverParameters physics
mvOccupied, mvControlled occupied, controlled (TTrain, TController)
mvSecond, mvThird secondUnit, thirdUnit
mvPantographUnit pantographUnit
mover, Mover, movers physics, Physics, vehicles (locals, params)
m_mover, othermover, currentMover, from_movers, renderMoverEventSounds
m_physics, otherPhysics, currentPhysics,
from_vehicles, renderPhysicsEventSounds
The code and the comments are renamed, the string literals are not: no text
the game shows, logs or looks up has changed (none had the names). The movers
of the editor, the tracks a slide moves, keep their name.
By hand: two member functions of TDynamicObject (gather_off_track_terrain,
begin_off_track) had a local mover aliasing their own MoverParameters, which
the rename made physics { *physics }; the alias is gone, they use physics->.
No other function has a renamed local meeting a renamed member (checked over
all the functions of the code before the rename).
For the branches made before it: run the script on the branch (python
tools/rename/mover_to_physics.py, from the root of the repository) before
merging it with this one, and the names don't conflict. It can be run again;
the second time it changes nothing.
The class is the same as it was; breaking it into its parts (braking,
electrics, controls, load) and making its data private are the next stages.
No change in behaviour: 1149/1149 tests, golden traces exact against staging
|
||
|
|
9568dba9e4 |
fix(vehicle): the bugs the split of the giant functions brought to light
What changes for the player: - the OFF position of the headlights dimmer puts out the headlights at the end of the active cab: A from cab 1, B from cab -1. It took the numbers of the ends for the numbers of the cabs, so cab 1 put out B, the end behind the driver, and cab -1 nothing ( |
||
|
|
401995d4e2 |
refactor(vehicle): the giant functions of the vehicle and the cab split into named steps
The four largest functions of the vehicle code become short sequences of
calls to named private helpers; the code moves verbatim, in the same order:
- TDynamicObject::LoadMMediaFile (2036 lines, now ~50): a helper for each
section of the .mmd (models, sounds, locations, internaldata) and for the
finish; the long keyword chains split into groups tried in their old
order, each group telling whether it took the keyword, so a keyword still
goes to the first branch that matches it and no other
- TTrain::Update (1389 lines, now ~90): the line breaker, the timers, the
states of the units in multiple, the gauges, the lamps (with the low
voltage and without it), the controllers, the switches and the buttons
- TDynamicObject::Update (1168 lines, now ~125): the track, the couplers,
the traction voltage, the AI, the braking of a consist of induction
motors (its locals gathered in InductionBrakeState, of the very types
auto gave them), the movement, the clatter of the axles, the pantographs,
the wipers and the mirrors
- TDynamicObject::RenderSounds (813 lines, now ~50) and
powertrain_sounds::render (506 lines, now ~17): a helper for each
subsystem; the volume and the frequency, shared by the whole function
before, are locals of the helpers that use them, each written before it
is read as it was
The helpers of LoadMMediaFile keep the indentation of the old function, so
the diff shows only the seams.
No change in behaviour: 1144/1144 tests, golden traces exact against staging
|
||
|
|
fbb9dc1e89 |
refactor(physics): the ends and the sides of a vehicle as scoped enums
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
|
||
|
|
4679201cb9 |
refactor(physics): the line breaker, the voltage relays and the engine step in the drives
Four more switches on EngineType go into the classes of the drives:
- TractionDrive::MainsPowerAvailable(): whether the line breaker has the
power to close; the low voltage circuits for the diesel engines and Dumb,
the line (or the low voltage, closed ahead of the pantographs) for the
series and the induction motors, always for the others (from
MainSwitchCheck())
- TractionDrive::CheckVoltageRelays(): the undervoltage and the overvoltage
relay of the series motors, the line voltage out of range of the induction
motors, the line contactors of the diesel-electric (the body of
VoltageRelaysCheck())
- TractionDrive::UpdateEngine(): the automatic start of the series motors,
the step of the diesel engine; returns whether a relay clicked (from
compute_movement_())
- TractionDrive::UpdateEngineVoltage(): the voltage of the motors, by the
reverser for the series motors, which also count the time since their
last relay, from the traction supply for the others (from
ComputeTotalForce())
The reading of the Engine and MotorParamTable sections of the .fiz still
switches on the engine type: it fills private members of the loader, and
stays with it.
No change in behaviour: 1144/1144 tests, golden traces exact against staging
|
||
|
|
f4ef43feec |
refactor(physics): the definition and the state of the induction motor drive as named fields
The arrays eimc[26] and eimv[21] of InductionMotor, indexed by the eimc_* and
eimv_* constants, become structs with named and described fields. The
definition splits into blocks by what it describes:
motor dfic currentPerSlip, dfmax maxSlipFrequency, p polePairs,
cfu voltsPerHertz, cim torquePerCurrent, icif fieldCurrentRatio
converter Uzmax maxLinkVoltage, Uzh brakingLinkVoltage, DU voltageDrop,
I0 noLoadCurrent, fcfu voltsPerHertz, fcfuH brakingVoltsPerHertz
traction F0 startingForce, a1 forceDropPerSpeed, Pmax maxPower,
Imax maxCurrent
braking Fh maxForce, Ph maxPower, Vh0 offSpeed, Vh1 fullSpeed,
abed cylinderPressureGain, edep maxEpDeceleration
and the state (InductionMotorState) groups the forces, the frequencies, the
values of the motors and the powers: FMAXMAX absoluteMaxForce, Fmax maxForce,
Fful fullForce, Fr force, Fzad forceDemand, ks slipShare, df slipFrequency,
fp supplyFrequency, fkr criticalFrequency, Uzsmax linkVoltage, U voltage,
pole flux, Ic torqueCurrent, If fieldCurrent, M torque, Ipoj lineCurrent,
Imax currentLimit, Pmax powerLimit, Pm mechanicalPower, Pe electricalPower,
eta efficiency.
The old comments of the constants took the "h" entries (Uzh, fcfuH, Fh, Ph,
Vh0, Vh1) for field weakening; the code uses them for the electrodynamic
brake, and the new names say so. The .fiz keys don't change. The constants
eimc_* / eimv_* are gone from physics/vehicletypes.h, and the labels of the
debug panel (TMoverParameters::eimc_labels, eimv_labels) move into
InductionMotor::ConfigListing() and StateListing().
One change on the screen: the eimc column of the debug panel (the engine
section of an induction motor vehicle) showed the labels from "Uzmax:" on
next to the wrong values (shifted by one entry, from "F0:" on by two), and
never showed abed and eped. It now shows each label with its own value. The
eimv column is as it was.
No change in the simulation: 1144/1144 tests, golden traces exact against
staging
|
||
|
|
95e7b55495 |
refactor(physics): the revolutions of the engine and the steps of the master controller in the drives
Two more switches on EngineType go into the classes of the drives:
- TractionDrive::UpdateEngineRevolutions(): the diesel-electric engine
follows the revolutions it aims for, the diesel engine with a mechanical
transmission gives its ratio and its moment, the others turn with the
wheels (UpdateEngineRevolutions() before)
- TractionDrive::IncreaseMainController(), DecreaseMainController(): a notch
of the master controller as the kind of the engine takes it: the series
motors through their own steps, the diesel engine running to the end at
a fast step, the draisine by a push, the others one position at a time
(IncMainCtrlByEngine(), DecMainCtrlByEngine() before)
NoDrive splits in two: NoEngineDrive for a vehicle without an engine (its
controller steps, for the vehicles it controls) and UnmodelledDrive for the
steam engine and Main, which did nothing in these steps and still don't.
No change in behaviour: 1144/1144 tests, golden traces exact against staging
|
||
|
|
ff739d2328 |
refactor(physics): the induction motor drive is a component of its own
The fields of the drive of asynchronous motors fed by inverters move from
TMoverParameters into InductionMotor inductionMotor
(physics/components/inductionmotor.h):
eimc[26] config (std::array, indexed by eimc_* as before)
eimv[21] state (std::array, indexed by eimv_*)
eimv_pr forceShare
InverterFrequency inverterFrequency
InvertersNo, InvertersRatio inverterCount, inverterRatio
Inverters inverters (of Inverter, inverter before)
InverterControlCouplerFlag inverterControlCouplings
EIM_Pmax_Table maxPowerTable
EIMCLogForce logForce
The integrated controller (eimic, EIMCtrlType), which the diesel-electric
vehicles use too, and the ED/EP blending (MED_*) stay where they are.
No change in behaviour: 1144/1144 tests, golden traces exact against staging
|
||
|
|
04f76951f5 |
refactor(physics): the diesel engine, the torque converter and the retarder are components of their own
TMoverParameters held some 80 fields of the diesel engine and its hydraulic
transmission among its other 600, named dizel_*, hydro_TC_* and hydro_R_*.
They are now three structures of physics/components/dieselengine.h, with
English names:
- DieselEngine diesel: the definition (maxMoment, maxRevolutions,
minRevolutions, the governor, the clutch, the fuel consumption, the tables)
and the state (fill, clutchState, clutchPressure, torque, power, the start
up, the fuel consumed) and its heat (EngineHeat, heat_data before)
- TorqueConverter torqueConverter: present, the ratios, the lockup, the
fill rates, the table, and its state (fill, lockedUp, torqueRatio, the
revolutions in and out)
- Retarder retarder: present, its placement, torque, power, fill rates,
clutch, and its state
The .fiz keywords, the keys of the dictionaries of the Python screens and the
names of the golden channels (dizel_fill...) are unchanged; only the C++
names changed. The functions of the engine (dizel_Update, dizel_Momentum...)
stay members of TMoverParameters for now.
No change in behaviour: 1144/1144 tests, golden traces exact against staging
|
||
|
|
b108e91793 |
refactor(cab): vehicle/Train.cpp split into the files of its parts in vehicle/cab/
The 13 300 lines of the cab go into vehicle/cab/:
cab.cpp the gauges, the buttons, the control mapping
commandtable.cpp the table of the handlers of the commands
train.cpp construction, the state, taking a vehicle, the
trains of the scenery
controllercommands.cpp the master, secondary and dynamic brake controllers
brakecommands.cpp the brake handles, the sand, the EP brake
cabcommands.cpp the reverser, the battery, the cab activation
pantographcommands.cpp the pantographs and their compressor
powercommands.cpp the line breaker, the traction motors, the relays
auxiliarycommands.cpp the pumps, the genset, the converter, the compressor
lightcommands.cpp the lights
equipmentcommands.cpp the heating, the generic switches, the speed
control, the inverters
doorcommands.cpp the doors and the mirrors
couplingcommands.cpp the couplings and the departure
signalcommands.cpp the horns and the radios
update.cpp the update of a step
sounds.cpp the sounds
screens.cpp the screens
setup.cpp setting the cab up from its definition
Every definition moved as it was, in its original order. The helpers used
by several files (EU07_CONTROLLER_BASERETURNDELAY, is_hold_coil_lever) are
in vehicle/cab/internal.h.
1144/1144 tests, golden traces exact against staging
|
||
|
|
abf99e7d0d |
refactor(vehicle): vehicle/DynObj.cpp split into the files of its parts in vehicle/dynamic/
The 10 400 lines of the vehicle of the scenery go into vehicle/dynamic/:
lifecycle.cpp made, set up from its definition, removed
animations.cpp pantographs, doors, platforms, mirrors, wipers, axles
destinations.cpp the destination boards, the announcements
consist.cpp the neighbours, the ends, the vehicles along the couplings
neighbours.cpp the vehicles near it on its track
couplers.cpp coupling, uncoupling, the adapters
movement.cpp moving along the track, the axles, the bogies
offtrack.cpp derailed, off the track on the ground
load.cpp the load and its exchange at the stops
update.cpp the update of a step
visual.cpp the model, the sway, the shake
sounds.cpp the sounds
lights.cpp the lights and their signals
mmd.cpp reading the .mmd
vehicletable.cpp all the vehicles of the scenery and their update
Every definition moved as it was, in its original order. The macros of the
file and the helpers used by several files (GetSubmodelFromName, outside,
off_track_slow, off_track_clock, seconds_since) are in
vehicle/dynamic/internal.h.
Some functions stay very long (LoadMMediaFile 2000 lines, Update 1170,
RenderSounds 815, Init 610): they are next.
1144/1144 tests, golden traces exact against staging
|
||
|
|
601d4a3bb9 |
refactor(ai): vehicle/Driver.cpp split into the files of its parts in vehicle/ai/
The 9 700 lines of the AI driver go into vehicle/ai/, a file for each part
of what it does, from 76 to 1340 lines:
driver.cpp construction, the update, taking over, what it tells
speedpos.cpp a position of the speed table
routescan.cpp scanning the route ahead, the signals passed
speedtable.cpp what the positions ask of the driver: stops, limits, signals
orders.cpp the orders and the commands of the scenery
consist.cpp the consist: its vehicles, direction, brakes, the cab
engine.cpp preparing and shutting down the vehicle
controls.cpp the controllers and the brake handles
doors.cpp the doors, the stops and the departure
obstacles.cpp the obstacles and the signals behind and ahead
situation.cpp what the driver keeps an eye on
speed.cpp the speed it aims for
force.cpp the traction and the brakes it applies
physicslog.cpp the log of the physics
Every definition moved as it was, in its original order. The constants and
the helpers used by several files (EasyReactionTime, PrepareTime,
brake_response_horizon, uphill_stopping_distance) and the LOG* switches
are in vehicle/ai/internal.h. The default argument of
IsOccupiedByAnotherConsist() moved from its definition to its declaration,
where the other files see it.
`git blame -C -C` follows the lines into the new files.
1144/1144 tests, golden traces exact against staging
|
||
|
|
10d9a4e3ac |
refactor(ai): the flags of the speed table are SpeedPointFlags, the route of a crossing a field of its own
TSpeedPos::iFlags held what a position of the speed table of the AI is (a
track, a switch, a signal, a stop...) as the low bits of an int, and the
segment of a crossing the route takes in its top 4 bits, read back as
iFlags >> 28, by the sign of iFlags and by an unsigned comparison with
0x10000000.
- enum class SpeedPointFlag (enabled, track, reverse, switchTrack,
switchState, elapsed, trackEnd, curve, event, shuntSignal, passengerStop,
stopOnAutomaticBlock, commandSent, outsideStation, signal, roadSpeed,
sectionSpeed, proximitySpeed, pointSpeed, roadSpeedHeld, signalAreaEnd)
and SpeedPointFlags, an EnumSet of them, in TSpeedPos::flags
- TSpeedPos::crossRoute, -8..7, the route through a crossing; ResetFlags()
clears both, as iFlags = 0 did
- LegacyFlagsValue() puts the two together as the number they were, for the
two places which read it whole: the sign the scan of the route turns by,
and the hex of the speed table in the log, which stays the same
- the turn of a road vehicle at a crossing is judged as before, by the top
bits without their sign: -1 (straight on) counts as turning, as it did.
That looks wrong, but this change keeps it
No change in behaviour: 1144/1144 tests, golden traces exact against staging
|
||
|
|
b35a6129bc |
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
|
||
|
|
54d3a1040a |
refactor(physics): EnumSet<E> for the sets of flags; the damage of a vehicle is VehicleDamage and DamageSet
- utilities/enumset.h: EnumSet<E>, a set of the values of an enum class whose
values are bits, with the operations CouplingSet had (HasAll, HasAny,
Empty, Set, Clear, Without, |, &, ^, ==, FromBits, Bits). CouplingSet is
EnumSet<Coupling> now; an enum is a kind of the sets by IsEnumSetKind<E>,
which gives it its operator |.
- the damage of a vehicle (DamageFlag) is a DamageSet of VehicleDamage
instead of the int and the dtrain_* constants. A bit means one thing for a
locomotive and another for a wagon; both names are there (thinWheel and
loadShift, ventilator and loadDamage, engine and loadDestroyed).
- the SetDamage command of the scenery adds or takes away the damage by its
number as SetFlag() did (setOrClear()); "WRECKED" is still the set of the
number 255; the bearing divisor of the resistance stays the number 4.
- the damage of the tracks and of the catenary (dtrack_*, the traction's
DamageFlag) are other flags and stay as they were.
No change in behaviour: 1144/1144 tests, golden traces exact against staging
|
||
|
|
d4bd3fc5ca |
refactor(physics): physics/mover/ becomes physics/components/
The files of the parts of a vehicle (pneumatics, electrics, traction, doors,
drives...) are in physics/components/, not under the old name of the mover;
the file of the vehicle as a body, its forces and its movement, is body.cpp
(was mover.cpp). The includes, CMakeLists.txt and AGENTS.md name the new
paths.
Renames only. 1144/1144 tests, golden traces exact against staging
|
||
|
|
6003615e3e |
build(tests): a precompiled header for the unit tests
The game and the core library build with stdafx.h precompiled, the unit tests didn't: each of their ~150 files parsed windows.h, GLFW, glm and doctest anew, about 50 s each on a busy machine, half of the CPU time of the whole build. eu07_unit_tests precompiles stdafx.h and doctest.h too. main.cpp defines the implementation of doctest before including doctest.h and goes without. The vehicle physics stays out of the header: its unscoped enums (end::front...) clash with names in the tests. The test files take 28 min of CPU instead of 95 (10.7 s each on average), a full build some 4-5 minutes less on 16 cores. 1144/1144 tests, golden traces exact. |
||
|
|
b7f2186a19 |
fix(audio): the sound comes back after the output device is lost or changed (#433)
* fix(audio): the sound comes back after the output device is lost or changed
Pulling out the headphones, or changing the output in the system, could leave the game silent until it was
restarted, also after the very same output came back. The renderer learned about the output only from the
events of the system (ALC_SOFT_system_events), and the check of the connection ran only without them. But:
- the system doesn't report every loss. A stream invalidated without the device being removed and without
another default output (a jack pulled out of a shared output, a change of the format, exclusive mode taken
by another program) only marks the device as disconnected. Nothing looked at that, so nothing reopened it;
- alcReopenDeviceSOFT returns ALC_TRUE also when the new output was opened but failed to start, which happens
when the default output is reported before it is ready. The log said "reopened", the device stayed dead;
- a reopen that failed was never tried again, in spite of "(will retry)" in the log;
- with a device set in eu07.ini (sound.openal.renderer) nothing was followed at all: once that device lost its
output it stayed silent, and a device absent at the start meant no sound for the whole session.
Now the connection of the device is checked once a second next to the events, a removed device has it checked
at once, a reopen counts only if the device is connected afterwards, and a failed one is tried again after
0.5, 1, 2, 4 and then every 4 s, and at once when the system reports any change. A device set in eu07.ini is
left alone while it works; when it is lost it is opened again, the default output stands in for it while it is
absent (also at the start), and the playback moves back when it returns. The failure is logged once per loss.
The decisions are in audio::output_follower (audio/outputfollow.h), free of OpenAL, with unit tests. The time
is the real one (steady_clock) rather than the simulation's, which stands still in pause and runs faster with
time acceleration.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRgQ1GsKSGmguyc4rhvXWy
* Revert "fix(physicslog): no road-vehicle logs, formatting on the writer, a slow disk and the closing kept short (#408)"
This reverts commit
|
||
|
|
1a12c7ef4f |
fix(events): say in the log when a condition passes because it can't test, and when a call is dropped (#448)
* fix(events): say in the log when a condition passes because it can't test, and when a call is dropped A condition which can't do its test passes, and nothing told the scenery author. Now the log says so when the scenery loads: - trackfree / trackoccupied with no target, or with a target that isn't a track (an isolated section, a memory cell): the track test passes every time; - a word in a condition the reader doesn't know, such as a name written after trackfree: it's skipped; - a multiple comparing a memory cell that doesn't exist: besides the cell (already logged), that its whole memcompare condition is off and it always runs the events before its else. And log.txt says when an event called while it's still in the queue isn't added again, with the vehicle of the lost call and of the queued one. Nothing changes in how events run. * fix(events): log a lost call once per stay in the queue, set the activator of a joint event A standing vehicle queues its event0 / eventall0 every frame, so an event with a delay logged "EVENT ALREADY IN QUEUE" once a frame until it ran (65 thousand lines in 70 s of a train standing on such a track). Now a lost call is logged only when it comes from another vehicle than the one which queued the event, and once per stay in the queue. An instant event handing over to its joint (same-name) event queued that event with the vehicle of its previous run. It gets the vehicle of the call now, which it runs with and which the log names. The message about a missing memory cell says that only the memcompare test is off, and that the event always runs the events before its else only when no track or probability test is left. * fix(events): don't log a lost call from another vehicle of the same train A standing train calls its eventall0 from every vehicle, so the second vehicle's call was logged once per stay in the queue, and as the line is written once per stay, it could hide a lost call of another train standing on another track with the same event. A call from a vehicle coupled to the one which queued the event isn't logged now. * test(events): the unknown word in a condition is logged with the event and skipped A name written after trackfree is read as a word the condition reader doesn't know: one line in the log names the event and the word, and only the track test is set. The known words of a condition log nothing. * test(events): turn the log capture off when a case stops at a failed REQUIRE |
||
|
|
d90fcea158 |
refactor(ai): the decisions of an uphill start in uphill_start::, with unit tests of the release phase (#445)
* refactor(ai): the decisions of an uphill start in uphill_start::, with unit tests of the release phase * refactor(ai): the grade force of an uphill start situation no longer named as the holding factor, std::array in its test * refactor(ai): the situation of an uphill start filled by field name, so the compiler checks the order |
||
|
|
702b552780 |
fix(render): particle vertex attribute offsets from offsetof in the GL 4.6 and Vulkan renderers (#511)
* fix(render): particle vertex attribute offsets from offsetof * fix(render): particle vertex attribute offsets from offsetof in the GL 4.6 and Vulkan renderers The GL 4.6 particles passed 0, 12 and 28 to setup_attrib, the Vulkan layout of vertex_kind::particle had the stride 36 and the same offsets as numbers. They now come from sizeof and offsetof of particle_vertex. The Vulkan particle_vertex moves from vulkan14frame.cpp to vulkan14context.h so the layout in vulkan14scene.cpp can use it. A build with static_asserts that each offsetof equals the old number (and the size 36) compiled; the asserts were taken out after. |
||
|
|
7533ecb93f |
ci(sonar): analyse a push to staging as the branch staging, next to master (#522)
A push build reaches sonar.yml through workflow_run like a pull request does; until now every push was analysed as the main branch, as only master had push builds. The branch is now taken from the trusted event (workflow_run.event, head_repository, head_branch), not from the artifact: master is analysed as the main branch as before, staging with sonar.branch.name=staging, and any other push is refused instead of being analysed. Nothing runs for staging yet: build.yml builds on a push to master only. That change follows separately, once this file is on master, because workflow_run workflows run from the default branch: with build.yml first, the old sonar.yml would analyse staging as the main branch and replace master's analysis. |
||
|
|
3bd0193d8d |
feat(vehicle): lowpoly driver figure follows the direction in single desk vehicles (GE#535) (#530)
In a vehicle with one desk for both directions (401Da, SM31, TEM2) the AI changes the cab to drive the other way, so from outside its lowpoly figure turns round (mechanik2). The player usually stays in the cab and only moves the reverser, so the figure kept facing forward. When the player drives such a vehicle, the figure now follows the selected direction of travel (DirAbsolute): reverser backwards shows mechanik2, forwards mechanik1. With no direction selected it is the figure of the occupied cab, as before. The AI is unchanged. A vehicle counts as single desk when its .mmd has jointcabs:, cab1model: and cab2model: name the same model and driver1sitpos: and driver2sitpos: (or driverNpos: without a sitpos) are the same spot within 1 cm. Two desks in one cab (SM42, SP42: mirrored seats) and vehicles with two cabs don't match, so they are unchanged. No data change is needed. eu07.ini driverfigure.followsdirection (yes by default); "no" keeps the figure of the occupied cab, as before. The decision is in vehicle/driverfigure.h, tested in tests/unit/test_driver_figure.cpp. |
||
|
|
2098614f8c |
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
|
||
|
|
65b45839fd |
Editor: track names outside of ASCII listed, not renamed; every name the editor gives is plain ASCII (#376)
* feat(editor): track names with characters outside of ASCII changed to ASCII when a scenery is opened for editing, with a 20 s warning in the middle of the screen
Tracks, and events named after a track (<track>:event0), are still found by their old names, so events, trainsets and memory cells keep working.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
* chore(editor): the brush and the ASCII track names cleaned up for Sonar (init-statements, std::numbers::pi, ranges, the dab of the stroke and the settings of many models in functions of their own)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
* chore(editor): the rest of the Sonar notes of the PRs (bytes as numbers, std::format, no copy of the old track name, no shadowed names, try_emplace, deduced template arguments)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
* feat(editor): the track names outside of ASCII listed, not renamed; the names the editor gives are ASCII only
Reworked after the reviews of maj00r and jerrrrycho and the proposal on the PR: renaming the tracks of
existing sceneries as they're opened, and then chasing every reference to the old names, broke references
it couldn't reach (memory cells in files the editor doesn't write, folded names colliding, the parameters
of includes naming events and cells, names outside of Latin folding to underscores), and its fallback ran
in the game too. So:
- Nothing is renamed when a scenery is opened for editing. The tracks whose names have characters outside of
ASCII are listed in the log, and the status line says how many there are and that they work as they are.
- Tools -> "Track names outside of ASCII..." opens the list: each name as it reads, its ASCII form, whether
that form is taken (by another path, or another name giving the same), whether the name comes from a
parameter of an include, and whether its file is one the editor writes. It changes nothing; a track is
renamed, if at all, by hand in its properties, where the cells, includes and events it touches are shown.
- editor_track::name_valid() refuses a name with characters outside of ASCII, so every name the editor gives
(the track properties, the switches, the stations) is plain ASCII.
- The game is as on master: no folded lookups of paths or events (path_table::find, FindEventAscii and the
map behind it are gone), so a reference to a missing name is reported as before and never binds to
another track. The big warning in the middle of the screen is gone with the renaming it announced.
ascii_name (plain, fold, readable) and its tests stay, for the list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRgQ1K1Qu7TCsa74zsNURd
* fix(editor): the switch tool takes no name outside of ASCII
The Name field of the switch tool went straight to switch_name_for_new(), so a typed name such as łąka1 became the name of
the new switch and of its drive events, outside the check of editor_track::name_valid(). A letter outside of ASCII is now
refused as it's typed, with the reason name_valid() gives.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(editor): the switch, turntable and SRK station code fields drop letters outside of ASCII as they're typed; the include-named tracks said where they're renamed
A character filter (ImGuiInputTextFlags_CallbackCharFilter) keeps the refused letter out of the field, so it no longer shows while the switch name is typed. The turntable name and the SRK station code go into track names too and get the same filter. The window of the track names outside of ASCII says that a track named by an include parameter is renamed through that parameter, not in the track properties.
* Revert "fix(physicslog): no road-vehicle logs, formatting on the writer, a slow disk and the closing kept short (#408)"
This reverts commit
|
||
|
|
007fb6b340 |
docs(agents): the naming of new and restructured code, and where the vehicle code goes
AGENTS.md says how new code and code that gets restructured is named: PascalCase for types, public member functions and free functions of the headers; camelCase for the internal functions, all variables, members, parameters and the values of enums; English, without prefixes of the type. What files, scripts and the log read stays the same whatever the C++ names. It also says where the vehicle code is (physics/, vehicle/) and the rules of its structure: vehicletypes.h for the vocabulary, forward declarations instead of mover.h in headers, enum class and named fields instead of bits, VehicleCommand for the commands, drive classes instead of switches on EngineType. |
||
|
|
c07eb76e51 |
refactor(physics): the drives of the vehicles are classes, one for each kind of engine
What a vehicle does in the step of its traction depended on a switch on
EngineType in each place: the traction force, the ventilators, the power of
the engine, the ammeters, the revolutions of the engine. Each kind of drive
is now a class of its own in physics/mover/drive.h/.cpp, behind the
interface TractionDrive:
NoDrive no engine, or one with no model (steam, Main)
DumbDrive an engine with no model (Dumb)
WheelsDrivenDrive the wheels driven by hand
SeriesMotorDrive series wound DC motors
InductionMotorDrive asynchronous motors and inverters
DieselMechanicalDrive a diesel engine and a mechanical or hydraulic gear
DieselElectricDrive a diesel engine, a generator and traction motors
TMoverParameters::Drive() gives the one of the vehicle's EngineType.
TractionForce(), UpdateVentilators(), UpdateEnginePower(), ShowCurrent(),
EngineRPMRatio(), EngineIdleRPM() and EngineMaxRPM() call it in the same
order the switches went. The drives hold no state yet: the state of each
drive moves into its class next.
No change in behaviour: 1144/1144 tests, golden traces exact against staging
|
||
|
|
cf73ee05a6 |
refactor(ai): the driving flags of the AI are the named fields of DrivingFlags, not bits of iDrivigFlags
TController kept 23 conditions of the movement of the train as the bits of one
int (iDrivigFlags, the TMovementStatus constants), set and tested with masks,
~(a | b), SetFlag(x, -flag) and TestFlag. Each is a condition of its own, set
and cleared on its own, so each is now a bool of its own in DrivingFlags:
stopCloser, stopPoint, active, press, connect, primary, late, stopHere,
startHorn, startHornNow, startHornDone, oerlikons, incSpeed, trackEnd,
switchFound, guardSignal, visibility, doorOpened, pushPull, signalFound,
stopPointFound, guardOpenDoor, departureWarned.
The three horn flags stay three: the code sets them in combinations that
aren't a single state (startHornDone without startHorn, for one).
The debug panel lists the flags set, as before (DrivingFlags::ActiveNames()).
One fix: SetSignal (from the map) put the signal in bit 30 or 31 by its
number, and any other number set the driving flag of that bit (5 made the
driver primary). Only 30 (Pc6) and 31 (A1) mean a signal now, kept in
signalPc6 and signalA1; nothing reads them yet, as before.
No change in behaviour: 1144/1144 tests, golden traces exact against staging
|
||
|
|
e5639e9d48 |
refactor(physics): the commands between the vehicles are VehicleCommand, not text
The vehicles of a train passed their commands to each other as strings
(SendCtrlToNext("MainCtrl", ...)), and RunCommand() found out what to do by
comparing the text with 54 names. A misspelt name compiled and did nothing.
- physics/vehiclecommand.h/.cpp: enum class VehicleCommand, one value for
each command a vehicle knows, plus none and unknown; ParseVehicleCommand()
reads a text, VehicleCommandName() gives the name back
- SendCtrlToNext(), SetInternalCommand(), RunCommand() and its groups take
VehicleCommand; Load= and UnLoad= carry the name of the load as the
argument of RunCommand()
- the text is read once, where a command comes as text: PutCommand() (the
events, Lua, the AI). TCommand keeps that text, as the AI reads the
commands it knows itself (SetVelocity...) from it
- two commands sent but known to no vehicle stay as they were, passed on and
not done: EpFuseSwitch and SandboxAutoAllow
- removed the unused GetExternalCommand(), CommandOut, ValueOut and
CommandLast (written, never read)
- the names are the ones the sceneries and scripts have always used, compared
exactly; new tests check that every command reads back from its name
No change in behaviour: 1144/1144 tests (2 new), golden traces exact against
staging
|
||
|
|
b82784be92 |
refactor(vehicle): AnimModel.h, Sweep.h and Camera.h no longer include DynObj.h
The scenery models (AnimModel.h), the sweeps (Sweep.h) and the camera
(Camera.h, which Globals.h includes) pulled in the whole vehicle header, for
one structure (material_data) and a pointer type.
- model/materialdata.h/.cpp: material_data and TextureTest(), moved from
DynObj.h/.cpp as they were
- Camera.h names TDynamicObject through utilities/Classes.h
- Classes.h includes interfaces/ITexture.h for null_handle, the value of the
handles it defines; AnimModel.h includes utilities/Names.h for basic_table
itself. Both came through DynObj.h before.
- the files that use the vehicles include vehicle/DynObj.h themselves
164 of the 730 objects of the build depend on DynObj.h now, 304 before.
No change in behaviour: 1142/1142 tests, golden traces exact against staging
|
||
|
|
19f884cdbb |
refactor(physics): the vehicle vocabulary in physics/vehicletypes.h; DynObj.h and Driver.h no longer include mover.h
DynObj.h included physics/mover.h, so nearly every file of the simulator
compiled the whole vehicle physics (TMoverParameters and the brakes) though
most of them only name a vehicle end, a coupling or a light.
- physics/vehicletypes.h: the enums, flags and small structures the rest of
the simulator passes around (end, side, coupling, light, sound, activation,
train_type, TEngineType, TBrakeSystem..., TLocation, TTrackShape,
neighbour_data), moved from mover.h as they were. mover.h includes it.
- DynObj.h and Driver.h include vehicletypes.h; TMoverParameters is forward
declared (utilities/Classes.h). Their inline accessors that read the mover
(NextConnected(), GetVelocity(), is_emu(), DirectionalVel()...) are defined
in DynObj.cpp and Driver.cpp.
- the files that use the mover include physics/mover.h themselves.
Now 140 of the 730 objects of the build depend on mover.h and brakes.h,
about 80 of them unit tests.
No change in behaviour: 1142/1142 tests, golden traces exact against staging
|
||
|
|
653aec7fbe |
refactor(physics): physics/mover.cpp split into the files of its subsystems
The 15 900 lines of mover.cpp go into physics/mover/, a file for each part of
the vehicle, from 220 to 1850 lines:
mover.cpp the vehicle as a body: construction, forces, movement
couplers.cpp attaching, detaching, coupler forces, automatic coupling
collisions.cpp collisions of the ends, crush, derailment, repair
pneumatics.cpp brake controls, pipes, valves, compressor, spring brake
electrics.cpp batteries, main switch, pantographs, converter, heating,
lights, genset
traction.cpp traction motors and forces of each drive, relays, fuses,
dynamic brake
controllers.cpp master and secondary controllers, automatic relay,
camshaft, integrated controller, speed control
diesel.cpp diesel engine, gearbox, clutch, hydraulic transmission
cab.cpp cab activation, direction, horns
doors.cpp doors and the load exchange
securitysystem.cpp vigilance, cab signalling, radio-stop
commands.cpp commands passed between the vehicles
fizparser.cpp reading the .fiz: the parser and its tables
fizsections.cpp reading the .fiz: the sections and their keywords
setup.cpp checks, brake valves, handles and pipes after loading
Every definition moved as it was, byte for byte, in its original order. The
helpers of the anonymous namespaces went with the file using them; the seven
used by several files (CouplerTune, square, DirPatch, DirF,
TableInterpolation, compression_at, issection) are declared or defined in
physics/mover/internal.h, which only these files include.
`git blame -C -C` follows the lines into the new files.
1142/1142 tests, golden traces exact against staging
|
||
|
|
5a537e69f2 |
refactor(physics): McZapkie/ becomes physics/, its files get English names
The folder of the vehicle physics was named after the author of its first
version (2001). Its name now says what it holds, and so do its files:
McZapkie/MOVER.h, Mover.cpp -> physics/mover.h, mover.cpp
McZapkie/hamulce.h, hamulce.cpp -> physics/brakes.h, brakes.cpp
McZapkie/Oerlikon_ESt.h, .cpp -> physics/oerlikonest.h, .cpp
friction, collision, couplerphysics, derailment: same names in physics/
Every include names the folder ("physics/mover.h"); the McZapkie include
directory is gone from CMakeLists.txt. The comments and documents that
named the old paths name the new ones. The credits to McZapkie stay.
Renames only: git sees every file as renamed (98-100%). 1142/1142 tests,
golden traces exact against staging
|
||
|
|
d17e94c84e | refactor(mover): the vehicle type is an enum class train_type, not dt_* bit constants | ||
|
|
62f7a29bdf |
Merge pull request #525 from MaSzyna-EU07/feat/gl46-migration
Feat/gl46 migration |
||
|
|
e7f8f274a9 | fix(physics): sleepheld judges the brake cylinder by its rate over a second, and its tests turn it on themselves build-feat-gl46-migration | ||
|
|
5fab613d77 | Merge branch 'feat/gl46-migration' of https://github.com/MaSzyna-EU07/maszyna into feat/renderers-cleanup | ||
|
|
0ce190eab2 | fix: the review of the renderers PR: physics switches off by default, crashes on exit and at start, renderer, shader and editor fixes | ||
|
|
bd597146c3 | Merge remote-tracking branch 'origin/staging' into feat/renderers-cleanup |