mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 18:47:06 +01:00
1d8fdffac5bdcd55f052bbc72a6fae5bece71e3c
631 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a2315990ca |
Merge pull request #550 from miloszunio/feat/debug-perflog
feat(debug): debug.perflog writes the times of the renderer to perf.txt while the game runs |
||
|
|
969864f204 |
Merge staging into cleanup/mover
The windscreen weather (#367) and the compiler cache of the CI (#434). The
wipers' code of both renderers takes staging's side, reading the active cab and
the speed through TDynamicObject (ActiveCab(), Speed()) as the renderer does on
this branch; the windscreen water reads the speed the same way, and the deer
(world/deer.cpp) read the vehicle through its queries (V(), WarningSignal(),
CabOccupied()).
The golden traces recorded on
|
||
|
|
23b695752a |
refactor(physics): the demand of the integrated controller is private to the vehicle
eimic_real, the demand of the integrated controller the vehicle goes by with
the speed control counted, which TDynamicObject and the consist braking set
for the vehicle that leads, is private: EimicReal() and SetEimicReal(). The
field of the same name of drivingaid::input stays as it is.
No change in behaviour: the golden traces recorded on
|
||
|
|
ef8a1fdbfd |
refactor(physics): six more of what the rest only reads are private, under names of their own
The mass of the empty vehicle, the braking force, the outcome of a derailment,
the departure signal, the traction mode of a dual-mode vehicle and the moment
of the motors are private to physics::Vehicle like the 53 before them, read
through Mass(), Fb(), Derailed(), DepartureSignal(), TractionMode() and Mm().
Inside the class they are emptyMass, brakingForce, derailOutcome,
departureSignalOn, tractionModeSetting and motorMoment, as the plain camelCase
names were taken by locals there.
No change in behaviour: the golden traces recorded on
|
||
|
|
5879c228dc |
refactor(physics): what the rest of the simulator only reads of a vehicle is private to it
53 fields of physics::Vehicle that only the vehicle itself writes, and the rest
of the simulator reads, are private, with a query each, named as the field was
(Vmax(), TotalMass(), Ft(), nrot(), NAxles(), PhysicActivation(), ...): the
compiler now keeps the cab, the AI, the scenery, the renderer and the tests from
changing what the definition gives or the physics works out. The fields were
picked by what is never written outside the class, of plain types, with no
other member of the same name to confuse; inside the class they keep their
meaning under camelCase names. The one place outside that cleared a flag of
the AI through a reference does it through ClearAIFlag().
No change in behaviour: the golden traces recorded on
|
||
|
|
74f0aa240d |
refactor(ai): the cab and the whois event are no longer friends of the AI, its public fields are private
TTrain and whois_event reached into the private members of TController as its
friends; they read what the AI knows of its consist and its route through
queries now (ConsistDoorsOpen(), ConsistConverterOverloaded(), ConsistLength(),
DesiredVelocity(), NextSignalVelocity(), BrakesReleaseLevel(), ...), and the cab
changes the radio channel through SetRadioChannel() rather than a reference to
the AI's field. The reversers of the consist, the stations of the timetable and
the obstacle ahead are public queries and operations.
The public fields of TController are private: whether the AI drives
(AIControllFlag()), the masks of the running without current the vehicles of
the consist set (MarkOverhead(), the same bits TDynamicObject::OverheadTrack()
set itself), the most deceleration of the blended brakes (MedAmax(),
SetMedAmax()), and the positions the driving aid panels show. Only the four
debug and timetable panels stay friends.
No change in behaviour: the golden traces recorded on
|
||
|
|
f65411a668 |
refactor(physics): the motion of the vehicle is private to it
The speed along the couplers, the location, the offsets from the track axis,
the accelerations, the distance counter and the distance moved since the last
check, the flat of the wheels and the truck hunting, the distance of the
derailment check, whether the vehicle is inside a consist and in the coupler
model, the analog demand of the integrated controller and the flow of the pipe
stabiliser are private to physics::Vehicle. TDynamicObject places and moves the
vehicle, the scenery puts road vehicles on their way and the contacts push them
through the operations (SetV(), SetLoc(), SetOffsetTrackH(), ...), and the
jolts of the track are ShakeVertically() and ShakeHorizontally(), the same
additions as before.
No change in behaviour: the golden traces recorded on
|
||
|
|
0b5459ef7b |
refactor(physics): the positions of the brake handles are private to the brakes
The positions of the driver's brake valve (stepped, continuous, and of the
FV4a with its cap), of the independent brake and of its EP counterpart in
units with induction motors, and of the hand brake are private to
physics::Braking: read through HandlePosition(), IndependentPosition(), ...
and moved through SetHandlePosition(), SetIndependentPosition(), ..., by the
vehicle's own stepping as by the cab, the AI and the consist braking. The
gauges of the cab bind to them read-only.
No change in behaviour: the golden traces recorded on
|
||
|
|
242474dd11 |
refactor(physics): the lights, the load and the event flags are private to the vehicle
- The lights switched on at each end (iLights) are LitLights(), changed
through SetLitLights(): the cab's switches, the AI's light patterns and the
scenery's toggles of the end signals all go through it.
- The exchange of the load, which TDynamicObject ran by setting the status, the
amount and the mass itself, goes through UnloadStep(), LoadStep(),
FinishLoadExchange() and AcknowledgeLoadExchange(), with the same arithmetic;
the change of the kind of the load is taken once (TakeLoadTypeChange()).
- The events the physics reports for the sounds to follow up are raised and
cleared by name (RaiseEventFlag(), ClearEventFlag(), ClearSoundFlags()).
No change in behaviour: the golden traces recorded on
|
||
|
|
84f1aa2515 |
refactor(physics): the controllers and the switches of the cab are private to the vehicle
The positions of the master and the secondary controller, of the analog
controller and of the lights selector, the occupied cab, the horns, the radio
and its fuse, the radio-stop, the wipers' switch, the dimmer, the mirrors'
button, the end-of-train signalling and the forced resistor fans: fourteen
fields the cab, the AI, the scenery and the tests wrote straight into
physics::Vehicle are private now. The rest of the simulator reads them through
queries named as the fields were (MainCtrlPos(), Radio(), ...) and changes them
through operations (SetMainCtrlPos(), SetRadio(), ...), so every place that
moves a controller past its own stepping (IncMainCtrl()) is named and can be
found; the compiler keeps anything else out. Inside the vehicle they keep
their meaning under camelCase names. The queries return const references, as
the gauges of the cab bind to them.
The .fiz keys are untouched.
No change in behaviour: the golden traces recorded on
|
||
|
|
91eefea01f |
fix(debug): one heading for each entry of perf.txt
The tables of an entry were headed a second time with the time alone, under the heading which already gives the time, the frames and the longest of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
29dcfd3769 |
Drop what the rebase fix-up c0ebdd5 brought back that the base no longer has
The second "null" renderer branch of select_gfx_backend(), the opaque text displays (Render_text) and the catch of std::exception in scenarioloader_mode::update(): the base's own code again (std::runtime_error, its own null branch). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD |
||
|
|
da8f06dde1 |
Rebase onto feat/gl46-migration: the code of the base the replayed hunks covered, back
The rebase replayed the hunks of this branch over the ones of feat/gl46-migration where both touched the same lines; this brings back what of the base they covered: the null renderer, the black box of the camera, the opaque text displays, the motion blur of the free camera (OpenGL 4.6 and Vulkan), the scenario loader catching std::exception. The log keeps off the console in test mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD |
||
|
|
8050ea8eb6 |
Deer at the tracks: graze ahead of the train, take fright at the horn and bound away
A deer is put on the path the player's train goes along (world/deer.cpp), grazing. The horn
within deer.hornrange, or the train closer than deer.fleedistance, frightens it: it raises its
head, looks at the train and bounds away from the tracks, then grazes where it stopped. The deer
go once the train is past them; they aren't parts of the scenery (not saved, not edited).
Off unless eu07.ini turns it on: deer (no), deer.interval (2000 m), deer.distance (2000 m),
deer.chance (1), deer.hornrange (600 m), deer.fleedistance (150 m).
- mat_vat.vert (ogl46, vk14): vat_random -1, the game picks the clip and the moment of an instance
by the fraction of ten times its turn about the vertical, so one animation hands over to the
next in the very same pose. 0 and 1 work as before.
- TAnimModel::draw_alone(): an instance the game moves leaves the groups of its model.
- scene_walk::Queue_Model: the record of an instance drawn on its own is made anew when the
instance moved.
Assets (game data, installed locally in the game folder, not yet in the SVN; without them no deer
is made):
- models/animals/jelen_je.t3d, jelen_zryw.t3d, jelen_skok.t3d (the deer of jelen_lewo.t3d with the
head turned straight, three animations baked by jelen_anim2.py)
- textures/animals/jelen_{je,zryw,skok}.mat and their _vatpos_hi, _vatpos_lo, _vatnormal .tga;
diffuse animals/sarna_d_1, in winter animals/sarna_f_1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
|
||
|
|
460ee1780d |
feat(debug): debug.perflog writes the times of the renderer to perf.txt while the game runs
debug.perflog <seconds> in eu07.ini, 0 (off) by default. Once the scenery is loaded, every so many seconds the tables of the debug panel of the renderer (info_times(): its times on the CPU and the GPU by the pass; info_stats(): its counts) are appended to perf.txt in the working folder of the game, beside the log, each headed with the number of frames since the last write, the longest of them and how many took over 25 and over 50 ms, which the averages of the tables don't show. The file is emptied at the first write of a run. Parsed in ConfigParseDebug() and written to the log with the other settings. Off, nothing changes. It showed the stutter of the TreeGenX trees (the sky occlusion gathering them on the main thread) and a stall while the memory of a 16 GB card filled up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2d67e9b1a3 |
refactor(physics): the definition of the brakes apart from their state
What the .fiz gives about the brakes of a vehicle (the kinds of the brake
system, the valves and the handles, the cylinders and the rigging, the pipe
pressures, the delays and the modes it can be set to: 35 fields) moves into
physics::Braking::Config, held as brakes.config, set as the vehicle loads and
not changed after. Six fields that sat with the definition but change in the
run (the weighted pressures of the handle position, the universal buttons
pressed, the load setting, the control reservoir, the emergency valve, the
lock of the pipe) go with the state.
No change in behaviour: the golden traces recorded on
|
||
|
|
447fe54f3d |
refactor(ai): the start uphill, the running brake test, the braking shortfall and the sanded start as named state
What the AI keeps in mind about these was spread over loose members of
TController, and their stages over flags and numbers:
- the start uphill (bUphillStart, bUphillRelease, bUphillBrakeTopUp and five
more) is uphill_start::Progress, its phases an enum (none, holding,
releasing) the two flags could only approximate, with Begin(), Release() and
End() where the flags were set together;
- the running brake test of a train run (DynamicBrakeTest 0..5 and the DBT_*
figures) is RunningBrakeTest, its stages named (waiting, applying,
switchingToAir, measuring, releasing, done); the debug panel still shows
the stage as the number it was;
- the braking shortfall and the sanded start are small structs of their own.
StaticBrakeTest, which nothing read or wrote, is gone.
No change in behaviour: the golden traces recorded on
|
||
|
|
d0b8d689af |
refactor(physics): the blending of the brakes of a consist is a module of the physics
The blending of the electrodynamic and the electropneumatic brakes over a consist driven by induction motors (the MED of the .fiz) moves out of TDynamicObject into physics::ConsistBrakeBlending (physics/consistbraking.*). It works on the physics of the vehicles alone, given in the order of the consist; TDynamicObject::distributeInductionBraking() only lists them from the occupied cab, as its loops walked them, and hands the result (the most deceleration of the service braking) to the driver. The state of the blending (the ED demand of the step before, the log of MEDLOGS/, the figures of the debug screen) goes with it. The code moves as it was: its arithmetic, its float and double conversions and the order of its steps are kept. Nothing in the unit tests reached it before, as they don't run TDynamicObject; now that it stands on its own, tests of it are added (test_consist_braking.cpp): the full braking demand over the mass of an Elf, the electropneumatic brake of every car standing, no demand at neutral. The figures of the debug screen start at zero rather than uninitialised for a vehicle that never led a consist. |
||
|
|
bc2af26dd5 |
refactor(physics): the compressed air supply and the pipes keep their state to themselves
The compressor, the main reservoir and the pipes along the train
(physics/components/airsupply.h) become classes, as the parts of the main
circuit: the definition in `config`, the state behind queries and operations.
The step of the compressor (the programmer of a unit, its supply and its start
delay, the governor and its lock, the venting over the top pressure) moves into
AirCompressor::Update(), with what it needs from the vehicle as plain values
(CompressorInputs); the vehicle follows the step up as before (the switching
delay, the counter of the debug panel, the sound of the relay). The leaks and
the pressure of the main reservoir move into AirSupply, and the reservoir is
filled and drawn through it.
The fault of the compressor the scenery can set no longer adds 100000001 to its
pressures from TDynamicObject::Damage(): AirCompressor::SetFault() does the same
arithmetic, so a fault behaves exactly as it did.
No change in behaviour: the golden traces recorded on
|
||
|
|
160ffe2147 |
refactor(physics): the low voltage, the train heating and the pantographs keep their state to themselves
As the parts of the main circuit: the battery and the low voltage circuits,
the train heating, the circuit of the pantographs and their air become classes
with the definition in `config` and the state behind queries and operations.
The step of the air of the pantographs (the small compressor, the three-way
cock, the leaks, the pressure switch) moves into PantographAir::Update(), which
gets what it needs as plain values (PantographAirSupply) and reports a trip of
the pressure switch, so the vehicle opens its line breaker or switches the
converter of a unit off as before. The drain of the battery and its limits move
into LowVoltageSupply. The latch of the held battery button of the cab moves
from the physics to TTrain, where the button is.
The gauges of the cab bind to the values they show through const pointers
(TGauge::Assign*() take them), so the queries they bind to return const
references and the cab reads the state live without being able to change it.
No change in behaviour: the golden traces recorded on
|
||
|
|
22ebc41d70 |
refactor(physics): the parts of the main circuit keep their state to themselves
The line breaker, the line contactors, the protective relays and the converter
(physics/components/maincircuit.h) become classes: what the .fiz defines is in
their public `config`, their state is private, read through queries
(IsClosed(), UndervoltageHolds(), IsRunning()) and changed through operations
(Close(), ResetGround(), Switch()). The logic that concerns only them moves in:
the initialisation of the main circuit, the ground relay, the pressure switch,
the resets of the relays, and the whole step of the converter, which gets what
it needs from the vehicle as plain values (ConverterSupply).
The vehicle still decides when they act (the interlocks, the controller
positions, the voltages); the parts don't take a physics::Vehicle.
No change in behaviour: the golden traces recorded on
|
||
|
|
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. |
||
|
|
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
|
||
|
|
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
|
||
|
|
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
|
||
|
|
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
|
||
|
|
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
|
||
|
|
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
|
||
|
|
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
|
||
|
|
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
|
||
|
|
d17e94c84e | refactor(mover): the vehicle type is an enum class train_type, not dt_* bit constants | ||
|
|
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 | ||
|
|
3eb2fdf462 |
Merge staging into feat/gl46-migration
origin/staging |
||
|
|
7ac2472c37 |
Merge master into staging (#514)
* Enhance Windows build matrix with AVX2 variants * fix(lang): the two Polish lines of the download area written with \n, so they match the tooltip and the hint * fix(files): data named in another case is found on Linux, folders included The parser and the loaders lowercase every name they read, while the data made on Windows has files and folders named in any case (scenery/Braniewo, textures/siec_trakcyjna_ph/.../STS_*.tga, sounds/sip/Gorki.wav). FileCased matched the file name only, so a folder in another case wasn't found. - FileCased walks every part of the path on Linux, the folder listings kept by their lowercase and read again once the folder changed; Windows as it was - FileExists finds the file in any case on Linux, and the variant with names and extensions gives back the name as it's on the disk, so textures, materials, sounds, station announcements and scripts open that name - models, sound captions, timetables and nodebank previews open the file as it's named on the disk; the texture format is told by the extension in any case * fix(files): the banks keep the names asked for, only the opening takes the case of the disk The textures, materials and sounds are kept by the names they're asked for. Given back as named on the disk, a file in another case missed the bank and was loaded again on every request. - FileExists with names and extensions finds the file in any case but gives back the name asked for; FileOnDisk gives the file to open, used where textures, sounds and scripts are opened - FileExists of a single name is a plain check again, the places checking it and opening the same name stay as they were - the texture format is told by the extension asked for again - a folder changed shortly before it was read is read again for a name missing from it, the time of a change being as coarse as the clock of the file system; a listing cut short isn't kept * fix(files): a folder changed in the future isn't read again on every name missing from it * perf(files): a file missing costs a single check, as before Measured in a case sensitive folder (3000 textures, every 20th in mixed case, looked up the way Texture.cpp does), the walk over every part of the path made a texture lookup 4-5 times slower than master: each name tried and missing checked every folder of its path. - the folders found are kept by the name they're given with, the missing ones for a second, so a missing file checks its folder alone - a folder named as it is on the disk is taken without its listing - the time a folder was changed is looked at once a second at most The lookup is now as fast as master's (about 180 us per texture on NTFS in both) while finding the files named in another case too. * fix(files): terrain files named in another case are found on Linux The terrain directive names .txtf/.btf files in lowercase, as the parser gives every token. The name is now taken as it is on disk, from the text file first, so the binary file is made next to the text and the editor's references and layers keep one name. * fix(files): models named in another case are found on Linux The manager of the models looked for the file with FileExists of a single name, a plain check again since the banks keep the names asked for, so a model named in another case (models/przejazdy/plyty3_L, dynamic/pkp/st44_v2/main/2M62-0685-A) was reported missing before TModel3d::LoadFromFile() could open it as it's named on the disk. find_on_disk() finds the file in any case and gives back the name asked for, the key of the bank. * refactor(files): named functions instead of the lambdas of the folder cache (Sonar S2259, S3608, S6004) Sonar took the folder captured by the lambda reading it for a reference to null, failing the quality gate on reliability. The folder is read and the path kept by functions in the anonymous namespace, the age of the listing declared in its if. * fix: the simulator opens more than 512 files at once, and a shader it can't open says why With "physicslog yes" every driver keeps its .dat open, and a large scenery (Tomaszewo: some 500 vehicles, cars of the roads included) took all 512 streams the MSVC runtime gives: the next fopen failed and the simulator stopped at "cannot read shader: shaders/map.vert" on opening the map. The limit is raised to 8192 at the start (the soft limit of open files up to the hard one on Linux), and a shader file that doesn't open is told as such, with the system's reason, rather than as one that can't be read. * feat(blackbox): the black box on its own, writing the tapes of the user's vehicles at the end "blackbox yes" in eu07.ini records the black box with the physics logs on or off, "blackbox no" never; with no entry it goes with "physicslog yes" as before. With the physics logs off, the recorder keeps the line of the physics log of the driver the user is with, every 0.05 s, and writes it to physicslog/<vehicle>.dat when the recording closes: the speed recorder's tape of the vehicles the user was in, without every vehicle keeping a log open and written twenty times a second. The line and the header of the log are made by one function of the driver, which its own log writes too, and the file is opened the same way, so the two are the same to the byte: the readers of these logs (the old Hasler tape viewer, the starter) read them as before. * feat(physicslog): the logs written every two seconds by a thread of their own, no file kept open; the black box's tapes as it goes "physicslog yes" kept the .dat of every vehicle with a driver open for the whole run and flushed it twenty times a second from the simulation's thread: some 580 open files on Tomaszewo. The lines are kept now and a thread of their own writes them every two seconds, each file opened only for the moment it is written to. The files, their lines and their text mode stay as they were. - The black box, with the physics logs off, writes the tapes of the user's vehicles through the same writer as it goes, not at the end. A log begins when the user is first in the vehicle and goes on while the user looks around outside, until another vehicle is taken; back in it, the log goes on after the gap. The vehicle's own driver keeps the log only if it is the primary one, as a passive one's clock stands still; otherwise the driver of its train does. - What is kept is written when the simulator closes, after the black box, at the end of a test run, and when the test watchdog ends a run. A crash loses the last two seconds. - On Tomaszewo with the black box alone, the one tape grows every two seconds. With "physicslog yes", the 581 logs grow and the simulator holds as many handles as without them; writing them takes the thread about 1.9 s, which the closing waits for once. * feat(blackbox): the cab record holds the speed of the wheels, apart from the vehicle's when they slip The speed of the cab record is the vehicle's. The speedometer, and a speed recorder's tape with it, shows the speed of the wheels as they turn, which runs away from it while they slip and drops to 0 while they are locked in a skid. It is added at the end of the record (194 bytes), where the readers skip what they don't know; the .dat tapes have it already, in their second column. * fix(ci): build OpenAL Soft with the PipeWire, PulseAudio and ALSA backends, so the Linux game has sound The Linux job builds OpenAL Soft 1.24.2 from source, but the runner had none of the headers of its audio backends, and OpenAL Soft's CMake leaves out every backend it can't find. The bundled libopenal.so.1 had only OSS, Null, Wave and Loopback. Modern distributions and the Steam Linux Runtime have no /dev/dsp, so the game logged "Failed to obtain audio device" and played nothing, with any Steam Linux Runtime and without one. - install libasound2-dev, libpulse-dev and libpipewire-0.3-dev before building OpenAL Soft - configure it with ALSOFT_REQUIRE_PIPEWIRE/PULSEAUDIO/ALSA, so a missing header fails the build instead of shipping a library without sound The backends are loaded with dlopen at run time (ALSOFT_DLOPEN is on by default), so the bundled library gains no new dependency. Tested by putting an OpenAL Soft 1.24.2 with these backends next to the game from the Steam depot: under Steam Linux Runtime 4.0 the sound works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(editor): the certificates of https looked for where the distribution keeps them The Linux game bundles the libcurl of Ubuntu, which knows only Ubuntu's /etc/ssl/certs/ca-certificates.crt. Fedora, RHEL and openSUSE keep the certificates elsewhere, so every download of the editor (orthophoto, terrain model, topo map) failed there with a certificate error. The file is taken from SSL_CERT_FILE or CURL_CA_BUNDLE when set, else the first of the files the distributions keep, and passed as CURLOPT_CAINFO. With none found libcurl keeps its own. * fix(editor): an https proxy checked with the same certificates CURLOPT_PROXY_CAINFO gets the file found for CURLOPT_CAINFO, so a download through an https:// proxy on Fedora or RHEL doesn't fail on the proxy's certificate. * fix(ci): the no-AVX2 Windows build has its own concurrency group and its own public download After master was merged the two Windows variants shared one concurrency group with cancel-in-progress, so one cancelled the other, and the publish job looked for an artifact name the matrix no longer produces. Each variant now has its own group, the publish job downloads both, and the release carries maszyna-windows-x64.zip (AVX2, the old name, so the links already handed out still work) and maszyna-windows-x64-noavx2.zip. The AVX2 variant passes -DENABLE_AVX2=ON explicitly instead of an empty flag. * build: a build without AVX2 has _noavx2 at the end of its executable name With ENABLE_AVX2=OFF the executable is eu07-x64_<date>_<hash>_noavx2.exe (eu07-x64_noavx2.exe without ADD_VERSION_SUFFIX), so a starter can tell the two builds apart by the name alone and pick this one on a CPU without AVX2. The AVX2 build keeps its name. * ci: Linux is built without AVX2 too, published as maszyna-linux-x64-noavx2.tar.gz The Linux job becomes the same two-variant matrix as Windows (ENABLE_AVX2=ON/OFF), each variant with a concurrency group of its own. The publish job downloads both Linux artifacts, restores the executable bits in both and releases maszyna-linux-x64.tar.gz (AVX2, the old name) next to maszyna-linux-x64-noavx2.tar.gz. The no-AVX2 executable is eu07_<date>_<hash>_noavx2. * fix(renderer): the legacy renderer clears the arrays the scene left before it draws the ui The legacy renderer drew the ui with the client arrays of the last scene draw still enabled: the texture coordinates of the normal map unit and the normals, pointing into the vertex buffer of whatever was drawn last, 48 bytes a vertex. The ImGui backend sets up the vertex, colour and texture coordinates of the active unit only, so the driver read the stale arrays with the indices of the ui. Once the ui had more vertices than that buffer, the NVIDIA driver read past its end and the game crashed; a crash dump of the editor (an area selected, a track being laid) shows the read of vertex 15113 at a 48-byte stride in ImGui_ImplOpenGL2_RenderDrawData. The arrays are now disabled on every texture unit the geometry uses, with the normal and colour arrays, inside the glPushClientAttrib already there, so the scene gets its state back after the ui. The default and the experimental renderers don't go through this code. * fix(app): a renderer this build doesn't have starts the full one, not the legacy one The starter writes "gfxrenderer vulkan" for the Vulkan renderer of the builds that have it. This exe doesn't know the word, and every word other than default/experimental fell to the legacy renderer: a player who picked Vulkan got the slowest renderer, the one whose ui crashes on NVIDIA (the arrays left by the scene). "experimental" in a build without the NVRHI renderer ended with "no renderer found!" and no game at all. After the settings are read, a gfxrenderer word this build has no renderer for becomes "default", with a line in the log saying so. The words it knows stay as they were: full/default, legacy, simple, null, the older starters' simpleshader and off (legacy as before), and experimental where it is built. * fix(settings): the gfxrenderer word read in any case, as the starter reads it A hand-written "gfxrenderer Legacy" started the legacy renderer only because every unknown word did; with unknown words going to the full renderer it would have changed. The word is lowercased when read, as StarterNG's RenderEngineOf does, so Legacy, Simple or Full mean what they say. * fix(physicslog): a log whose file can't be written keeps its lines and header, and the writer is stopped once on every way out A failed write put its lines back, ahead of those since, so a file held by another program for a while gets its header and every line once it can be written; up to 4 MB kept per log. Stopping is joined once, and not from the writer's own thread. main stops the logs after an error it caught too, and the test watchdog flushes with a time limit, so a disk that doesn't answer doesn't keep the run from ending. * fix(blackbox): the wheels of the powered vehicle, as the speedometer has them, and the logs described as the drivers' they are In a unit driven from an unpowered car, the speed of the wheels was of the car the user is in, whose wheels never slip; now of the motor car, signed as the occupied vehicle's speed. The doc tells of a log per driver, and of the two seconds of real time a crash loses. * fix(physicslog): failed logs kept within 64 MB in all, cut outside the lock, never written twice; the writer knows itself when stopped The lines kept while files can't be written are cut to their share of 64 MB before the lock the simulation waits on. A log written in part is cut back to its length, so the next try doesn't write its start twice. A stop from the writer itself is told by its id even after another thread took it to join, and the watchdog's flush waits at most its time, the writing on a thread of its own. * feat(physicslog): the logs of the trains only, physicslog.trains "physicslog.trains yes" in eu07.ini writes the .dat log of each driver who drives rail vehicles, not of the passengers nor of the road vehicles that make "physicslog yes" hundreds of files on a big scenery: the tape of every train. A driver made primary later begins its log then, and isn't counted while it doesn't log. The black box goes with it when the ini says nothing of its own, and doesn't write a second log of a driver writing its own. The doc tells the doors' sides are the vehicle's, the driver's swapped in the rear cab. * fix(physicslog): a train's log begun at its first line, so passive crews get no file Every crew is primary in the constructor and the drivers but one of a train with crews in more vehicles are made passive only before it starts, so a log begun there left files with only the header. With physicslog on all logs begin at once as before; one of a train waits for update_logs. * fix(editor): the texture pickers let go of the images scrolled past, the memory no longer runs out The picker of the textures of a track offers every texture of the textures folder, and each tile that came into sight read its texture full size, into the graphics card and the memory, and kept it there for good. Scrolling through the list for a trackbed texture took about 2.5 MB a tile: some 900 tiles made 3.5 GB, the whole folder 28 GB, and the game went down once the memory ran out. An image out of sight for 3 seconds is now taken out of both again (texture_manager::unload, Unload_Texture of the renderers) and read anew when it's shown once more, a few a frame as before. Only a texture the scene has never drawn is let go; those of the scene stay to the resource sweep. The texture browser lets go of its images on Refresh too. The picker no longer lists textures/previews: the 4100 previews of the node bank are images of models, not textures of anything. Checked on td.scn by a scripted run: 8000 images of the picker read one batch a few frames after another held the game at 2-3 GB, where it went to 28 GB and fell before; images shown again after they were let go come back; a trackbed texture picked from the folder is drawn on the track after its image was let go. * fix(physicslog): the writer's destructor throws nothing, its wait a plain condition variable woken to stop; a driver of no vehicle controls nothing * fix(editor): the images of the materials let go of with all their textures, the browser's Refresh a frame later An image of a material read the material with all its textures, the normal and specular maps and the variants, and only the first one was let go of: those stayed in the memory for every material scrolled past. They are let go of together now (Unload_Material). texture_manager::unload also takes the textures read and not made yet, waiting for a worker still reading one, and deletes the gl texture itself: release() would read it back from the card with gfx.resource.move only for it to be dropped. The Refresh of the texture browser let go of the images in the middle of the frame, while panels drawn before it could still refer to them; it now marks them, and they go at the start of the next frame. Checked on td.scn by a scripted run: 8040 images of the picker read a batch every few frames end at 2.0 GB, against 2.3-2.6 GB before this and 1.1 GB at the start; a trackbed material picked from the folder is drawn on the track after its image was let go. * fix(physicslog): every stop asked wakes the writer, the one from itself too; no psyche for a driver of no vehicle * fix(editor): the image of a material with no texture in its first slot is let go of too Its normal and specular maps were read with it and stayed in the memory: the trim passed over every image with no texture of its own, the material along with it. * fix(physicslog): nothing that goes wrong in the writing ends the simulator; a name in 1250 makes a path on a Windows set to UTF-8 The writer's thread called flush() with nothing around it, so an exception leaving write() ended the process with std::terminate, with no message. One that happens: the file of a log was made a std::filesystem::path of the vehicle's name, which MSVC converts in the code page of the system and throws for bytes not of it; on a Windows with "Use Unicode UTF-8 for worldwide language support" a vehicle named in 1250, as the sceneries have them (0xB3 for ł), isn't UTF-8. - the file of a log is made of the name with MultiByteToWideChar without MB_ERR_INVALID_CHARS: the same file as before for every name of the code page, U+FFFD for the bytes not of it instead of a throw. Elsewhere the bytes are the name of the file as they were - a log whose writing throws for any other reason (memory) is kept for the next try as one whose file can't be written, and the other logs are written still - the thread, flush_for() and stop() write through flush_safely(), which lets nothing out: what was taken for a writing failing as a whole is lost and told in the log, the next writing goes on - the messages name the file by the bytes of the name, not by path::string(), which converts back Tests: a log which can't be written doesn't keep the others from theirs; a vehicle named in 1250 has its log, read back by physicslog_writer::file(). Reported in the review of #385. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(blackbox): the tapes go on after the editor, with the physics logs off The tapes of the user's vehicles were written by update() after the check for the writer of the recording, which close() drops on entering the editor (F11). With "physicslog no", the speed recorder's tape ended at F11 while the drivers' own logs of "physicslog yes" went on. The tapes are files of their own: they are kept from the moment the recording was to be made, the file made or not, closed or not, until the simulator closes, after the gap of the time in the editor. Only the recording itself stops at F11, as before. Reported in the review of #385. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(physicslog): what no file name may have on Windows is replaced in the name of a log, on every system A spawned vehicle is named <spawn>:<number>, and its log went to physicslog/<spawn>:<number>.dat. On NTFS that isn't even an error: it is the stream <number>.dat of the file <spawn>, which nothing lists, so the log was written and no one could find it. On Linux the file was there, under a name Windows can't open. The name of the file of a log has < > : " / \ | ? * and the control characters replaced by _, on every system, so the logs are named alike everywhere (spawn_ezt:12 is spawn_ezt_12.dat), and a _ before a name Windows keeps for a device (con, nul, com1..., with an extension too). The bytes of 1250 stay. The black box tells the log it begins by the same name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(renderer): a material's textures let go of in one place, for every backend Unload_Material walked the textures of a material and of its variants the same way in both opengl renderers, and Sonar counted its declarations, set into the long run of overrides the two headers share, as duplicated: 5.2% of the new code, 3% allowed. The walk is gfx_renderer's now, over IMaterial::GetAllTextures and the backend's Unload_Texture. Materials that don't tell their textures, the Vulkan renderer's, give none, and are left alone as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * AI: shunting brakes for a stop point again; test mode: no false SPAD for a train set across a signal (#409) * fix(ai): shunting AI brakes for a stop point again, the braking curve doesn't plan from a brake table left at zero The braking curve outside the final approach plans from the consist brake table since |
||
|
|
bc6df7ea61 |
fix: a seed is the whole text and 0 is a seed; Linux honours XDG_CONFIG_HOME and XDG_CACHE_HOME (#469)
* fix(settings): a seed is the whole text as a number, and 0 is a seed seed_of() took the digits in front of a word for the number, so 4242abc was seed 4242, and 12abc and 12xyz were the same seed. Now the whole text has to be the number; anything else is hashed as a word, and a word that starts with digits is said in the log. A seed of 0 also stood for no seed, so -seed 0 and randomseed 0 drew a random one. Whether a seed was given is now kept apart, in random_seed_given, set by -seed, randomseed, the test mode and the server of a network session. random_seed keeps its type. randomseed with nothing after it still gives no seed. Follows up #176. * fix(paths): Linux keeps the settings and the cache where XDG says user_config_path() ignored XDG_CONFIG_HOME, and user_cache_path() took XDG_CACHE_HOME even when it held a relative path. Both now follow the XDG base directory spec: the variable when it is set to an absolute path, else .config or .cache in the home folder. The choice is made by xdg_base_directory(), which takes the values of the variables, so it is tested on every system. Windows and macOS are unchanged. Follows up #29 and #124. * fix(paths): Linux keeps the settings in ~/.config/MaSzyna until XDG_CONFIG_HOME has its own With XDG_CONFIG_HOME set (or under Flatpak), the settings of earlier releases in ~/.config/MaSzyna were silently left behind: the profile eu07.ini, the bindings, the odometers, the editor's settings. The old folder is now used while it exists and $XDG_CONFIG_HOME/MaSzyna doesn't, said once in the log; the one-time move of the orthophoto cache finds the old cache there too. * test: keep the XDG settings test folder out of the shared temp folder |
||
|
|
169527f333 |
feat(editor): dirt road type with looser layout limits in the road tool (#491)
* feat(editor): dirt road type with looser layout limits in the road tool Every road shared the limits of a built road, so the road tool refused field tracks that bend tight, kink, have very short straights and fork at sharp angles (#347). Roads now have a type, paved (the default, with the limits as they were) or dirt, chosen in the road settings and saved with each piece as "surfacetype dirt". A dirt road bends down to a 3 m radius instead of 6 m, can be 1 m long instead of 2 m, leaves other roads at 15 degrees instead of 30, may lead off square to the far end when both ends are tied, and may turn up to 240 degrees in a hairpin. The limits come from one table, editor/editorRoadLimits.hpp, whose paved row holds the old constants. A paved road writes nothing new, so existing sceneries load and save byte for byte as before. Switching a road to dirt turns the default asphalt into the field road texture droga_polna from the game data and drops the white markings; a material picked by hand stays. * fix(editor): no bend of a road tighter than the road is wide, pi from <numbers>, the type's name as a string_view |
||
|
|
a25abe6d5d |
fix(editor): stray switch drives told once a frame, by the same switch lookup the deletion uses (#509)
* fix(editor): tell the stray switch drives once a frame, by the test the deletion uses stray_drives() was built anew by each caller in a frame (the notice at the start, the red marks in the view, the list in the switch tool). It now keeps its list for the frame and builds it again after a step of the undo history. A drive whose switch shares its name with another switch was listed as having no switch once the later of the two was deleted: the name went with the deleted track, and only the deletion looked for the other track of the name. Both now use switch_drives::standing_switches, which falls back to the tracks of the scenery when the name finds none. The switches each drive template throws were read once per file until a restart. switch_drives::template_switches reads them again when the templates change (a rescan or a save in the editor), and a file that could not be read is tried again in a later frame. Refs #330 * test(editor): the switch lookup of the drives and the cache of the drive templates Refs #330 * test(editor): include <algorithm> for std::ranges::find Refs #330 |