18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 07:07:05 +01:00
Commit Graph

30 Commits

Author SHA1 Message Date
Hirek 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
62f7a29b. betterRenderer/, not built, has had only end:: and side:: renamed.
2026-11-28 18:32:58 +01:00
Hirek 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
62f7a29b.
2026-11-28 15:23:36 +01:00
Hirek 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
62f7a29b.
2026-11-27 18:53:06 +01:00
Hirek d17e94c84e refactor(mover): the vehicle type is an enum class train_type, not dt_* bit constants 2026-11-27 16:21:42 +01:00
Hirek 344034ec70 feat(ui): imgui 1.91.9b-docking in place of 1.73: local changes of the backends carried over (glad as the gl loader, srgb and gamma of the ui, gles glsl string), BufferingBar/Spinner kept, imgui_tables in cmake; cursor position, cursor enter and focus of the main window passed to the glfw backend, which works with events now; code adapted to the api: ImGuiListClipper::Begin, BeginListBox, ImTextureID as an integer, ImageButton with an id, ImGuiKey without GetKeyIndex, logarithmic sliders in place of the removed power argument; ImGuizmo with the math operators defined before imgui.h and SetNextFrameWantCaptureMouse 2026-10-08 20:38:13 +02:00
copilot-swe-agent[bot] 7e49aa8740 Rewrite #includes to use explicit subdirectory paths
Co-authored-by: Hirek193 <23196899+Hirek193@users.noreply.github.com>
2026-03-14 19:16:48 +00:00
Hirek 11e79f52ae Conversion to cpp 20 2026-01-18 21:21:15 +01:00
WLs50 a5f6397eca merge manul 2025-03-09 15:36:11 +01:00
milek7 5bafa31f9d Merge commit 'd8170c932b448ba6888e702746b5ae22632062d8' into sim 2022-01-05 22:21:05 +01:00
milek7 d096c52b5b energy meter tweaks 2021-01-16 22:55:57 +01:00
milek7 5d130c7fcf ..obviously only for vehicles that have pantographs at all 2021-01-16 19:52:30 +01:00
milek7 fdafcbc9be energy counter for electric traction vehicles 2021-01-16 19:31:48 +01:00
milek7 29f8f91ad8 Merge remote-tracking branch 'tmj/master' into sim 2020-10-18 23:35:14 +02:00
milek7 e697b01296 python leak fix, python touchscreens 2019-11-26 22:20:46 +01:00
milek7 a92037d2b2 visual look changes 2019-09-25 17:57:26 +02:00
milek7 3c9111bb25 vehicle params graphical representation 2019-09-25 00:29:38 +02:00
milek7 203ea7f288 vehicleparams icons 2019-09-23 21:08:05 +02:00
milek7 e043a39b52 vehicleparams screen in separate window 2019-09-22 14:41:59 +02:00
milek7 f10e15f408 Merge branch 'gfx-work' into sim 2019-07-13 01:47:36 +02:00
milek7 8f7e06c25c snapshot 2019-07-09 22:09:37 +02:00
milek7 a0c44fbaa3 snapshot 2019-07-02 15:33:49 +02:00
milek7 33de53c90c lock vehicle jumping when in motion 2019-04-02 23:09:52 +02:00
milek7 20755795ea separate shp buzzer, other changes 2019-04-02 21:53:19 +02:00
milek7 155217243c gui changes, consist teleport command, etc 2019-04-02 20:42:18 +02:00
milek7 851deb9142 training changes 2019-04-01 23:51:57 +02:00
milek7 99e7ef5513 python screen windows without context sharing 2019-03-18 17:02:54 +01:00
milek7 e6e5d6645b shader fix, vehicle move feature 2019-03-17 23:55:40 +01:00
milek7 4383b0c7e0 geometry shaders, map poi icons 2019-03-17 20:30:25 +01:00
milek7 16570f8d23 move vehicle param window to vehicle list, add radiostop button 2019-03-16 20:51:51 +01:00
milek7 3556a2d0e6 vehicle params window, aware system rewrite, sifa 2019-03-16 02:17:41 +01:00