16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00
Commit Graph

42 Commits

Author SHA1 Message Date
maj00r
5fce417a51 fix: guard Random/LocalRandom against inverted min>max bounds
std::uniform_real/int_distribution has UB when min>max. The old "fancy Random"
used interpolate(a,b,t) which tolerated a>b; the migration to
std::uniform_real_distribution did not, and only one inverted call site was
fixed by hand. Swap the bounds inside Random()/Random(int)/LocalRandom() so
every call site is safe, and reorder the two inverted literal calls in
Driver.cpp (fActionTime buzzer / departure delay) for readability.
2026-07-02 00:37:52 +02:00
maj00r
03bfbb1345 fix: restore min>max tolerance lost in clamp->std::clamp migration
The dumb3d->glm / utilities-simplification refactor replaced the old custom
clamp() (which tolerated Lo>Hi, returning the upper bound) with std::clamp,
where inverted bounds are undefined behaviour. Only a few sites were patched
afterwards, by hand, with std::minmax plumbing (incl. a stray `static` inside
a per-axle loop). Others silently produced wrong results in the AI braking /
acceleration path.

Add a safe_clamp() helper (normalizes inverted bounds) and use it ONLY where
Lo<=Hi cannot be proven at compile time (config min/max pairs, sign-dependent
expressions, container underflow). Sites with constant bounds or [0, x>=0]
keep std::clamp. Remove the manual std::minmax workarounds and rewrite the
damaged-track jolt code value-first.
2026-07-02 00:37:52 +02:00
jerrrrycho
d85096f64d reformat: remove redundant parentheses 2026-06-30 21:19:46 +02:00
Sebastian Krzyszkowiak
15c666a7ef Allow to speed up external camera movement with Ctrl key
Shift isn't used as that would affect joystick controls and we
probably should discourage the user from roaming around in external
cam mode too much, so they won't forget that they're not in regular
free fly out of the cab.
2026-06-29 23:12:52 +02:00
jerrrrycho
bf147dd155 refactor: replace null with nullptr 2026-06-29 02:48:25 +02:00
docentYT
a787bdd77c fix min max in Random 2026-05-12 16:56:48 +02:00
docentYT
fa2ed08955 Fix clamp min max values 2026-05-12 16:49:02 +02:00
cde62d42e3 Merge pull request #99 from docentYT/utilities-simplification
Utilities simplification
2026-05-06 18:35:29 +02:00
docentYT
4a67b4b2a9 Fix conflict 2026-05-05 23:32:59 +02:00
docentYT
5367cb9940 Merge remote-tracking branch 'upstream/master' into utilities-simplification 2026-05-05 23:08:43 +02:00
39885afca0 Merge pull request #105 from docentYT/migrate-from-dumb3d-to-glm
Fix camera shake bug
2026-05-05 23:05:18 +02:00
docentYT
c833b8177b Use glm::dvec3 for Camera LookAt/init
Update Init(...) parameters to glm::dvec3, change LookAt to glm::dvec3 and adjust Camera.cpp to remove redundant glm::dvec3 casts (lookAt call and vector subtraction). These changes improve precision for camera lookAt vector in world coordinates above 4 digits
2026-05-05 23:02:16 +02:00
9081282a47 Fix for lowercase python state parameters 2026-05-03 22:37:53 +02:00
docentYT
d464628a8e Fix problem with min value bigger than max value in std::clamps 2026-05-03 22:18:40 +02:00
cb4b6b9a4f Separate electrodynamic and localbrake levers 2026-05-03 21:51:16 +02:00
docentYT
13c7317f6e Do not allow implicit cast for inline std::string to_string(bool Value) and change to_string to std::string for non boolean values 2026-05-03 15:49:29 +02:00
docentYT
7081dab3c2 Replace RadToDeg and DegToRad with glm::degrees and glm::radians 2026-05-02 14:51:13 +02:00
docentYT
ca699d117f Remove not needed includes 2026-05-02 14:40:31 +02:00
docentYT
3628eb0fc3 Replace interpolate with std::lerp and glm::mix 2026-05-02 01:31:38 +02:00
docentYT
d1f16411a1 Replace clamp with std::clamp 2026-05-01 22:14:29 +02:00
docentYT
ec1dfae953 Replace starts_with and ends_with with string class methods 2026-05-01 17:31:11 +02:00
docentYT
337e750ed1 Replace Max0R and Min0R with std::max and std::min 2026-04-30 23:47:32 +02:00
7acc34df3e Merge pull request #97 from docentYT/migrate-from-dumb3d-to-glm
Migrate from dumb3d to glm
2026-04-28 19:46:46 +02:00
docentYT
ca839652bf Use the sq function to force constexpr expressions for numeric literals and enhance readability 2026-04-28 13:23:14 +02:00
docentYT
6be1b0886d Remove sad workaround 2026-04-28 01:23:53 +02:00
docentYT
623c4f827e Remove not needed casts, variables and switch from double precission to float precission for some angle vectors 2026-04-28 00:51:17 +02:00
docentYT
cba106e22e Use glm::length2 instead of glm::length where possible 2026-04-27 23:27:08 +02:00
docentYT
7d561f8443 use glm::length2 instead of glm::dot for squared length 2026-04-27 23:13:12 +02:00
docentYT
d5d1825e38 Remove dumb3d 2026-04-27 23:03:47 +02:00
docentYT
0fcdf98392 more glm instead of Math3D in vehicle 2026-04-27 21:57:13 +02:00
docentYT
ef852b4307 Fix model rotation by changing glm::dmat4 BasisChange definition 2026-04-27 21:28:06 +02:00
docentYT
fae68642bc use glm instead of Math3D in vehicle
WARNING: Model rotation is broken
2026-04-27 13:07:38 +02:00
docentYT
ed28eff066 use glm instead of Math3D in world 2026-04-27 00:36:03 +02:00
docentYT
aa24c55d2d Change Math3D::vector3 to glm::dvec3 in TCamera class 2026-04-26 18:12:47 +02:00
6177cfb01d Add radiocall1 2026-04-19 04:15:25 +02:00
593e4bcf36 Merge branch 'master' into master 2026-04-14 21:01:04 +02:00
jakubg1
0d010e8c6a Simplify derailing logic, derail reason enum
- The `TMoverParameters::derail()` function has been renamed to `::Derail()`, with a capital D.
- All derail events now use that function.
  - Simplified and unified the logic behind different derail types.
  - The `dtrack_freerail` track type is now slightly increasing the chance of derailing on a tight curve, as it was the intention.
- A new `DerailReason` enum has been created which holds all derail types.
- The `DerailReason` field in the `TMoverParameters` class has been removed.
  - This was a transient field which is not necessary anymore.
  - The logging functionality as such has been moved from `DynObj.cpp` to `Mover.cpp`.
2026-04-04 02:05:49 +02:00
jakubg1
407b187688 Tweak the door closing and warning signal delays
- The warning signal is no longer going to be played for an obnoxiously long amount of time by AI drivers when driving vehicles with a manual warning signal switch, most notably EN57.
  - A new `moveDepartureWarned` driving flag has been created to accomodate this behavior.
- Added the action time counter and the missing driving flags to the Vehicle AI section.
2026-04-04 00:13:26 +02:00
Agent
68fa78a582 feat(overheat): Add overheat indicator lamps for oil, water, water_aux, and engine
- Add engine_max_temp and engine_is_hot fields to heat_data structure
- Add EngineMaxTemperature field extraction from .fiz files
- Add engine overheat check comparing Ts with engine_max_temp
- Add four new overheat lamp indicators:
  - i-oil_overheat
  - i-water_overheat
  - i-wateraux_overheat
  - i-engine_overheat
- Add lamp update logic to turn on/off based on is_hot flags
- Add lamp initialization in clear_cab_controls()

This implements issue #77 - overheat lamps for diesel engines.

The lamps will turn on when:
- Oil temperature exceeds OilMaxTemperature
- Water temperature exceeds WaterMaxTemperature
- Auxiliary water temperature exceeds WaterAuxMaxTemperature
- Engine temperature exceeds EngineMaxTemperature

Each check includes 8-degree hysteresis to prevent rapid on/off cycling.
2026-04-01 23:26:39 +00:00
jerrrrycho
9f43dca48b refactor: create paths namespace instead of global variables 2026-03-15 11:55:30 +01: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
copilot-swe-agent[bot]
0531086bb9 Reorganize source files into logical subdirectories
Co-authored-by: Hirek193 <23196899+Hirek193@users.noreply.github.com>
2026-03-14 19:01:57 +00:00