18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-21 21:24:58 +01:00
Commit Graph

11 Commits

Author SHA1 Message Date
maj00r
c5d14e93ac fix: whole-number bounds of Random() give a real number again (#416)
* fix: whole-number bounds of Random() give a real number again

ee3af0bf (#99, in 26.05.2) renamed RandomInt to an overload,
Random(int, int). The calls with whole-number bounds that expect a real
number in between took the overload and draw whole numbers since:

- wheel flats given with P0 happen to 1 vehicle in 101 (before: none),
  the random part of a flat is a whole number of millimetres;
- the chance of truck hunting is h/101 instead of h/100;
- the wind starts with a whole azimuth, speed and rates of change, and
  its direction changes in whole degrees per second;
- the tachometer below 5 km/h jumps to whole numbers.

The whole-number draw is RandomInt again, keeping the shared engine and
the swap of inverted bounds; the loading screen's trivia use it. Those
calls take the real Random() again, as up to 26.05.1.

* RandomInt: the comment says what it draws and why it has a name of its own

The comment put the bug on the overloading. It was in the calls that pass
whole-number bounds and expect a real number; the separate name keeps
them on Random(double, double).

* fix: RandomInt draws from the local engine, as up to 26.05.1 from one of its own

From the review of #416: ee3af0bf moved RandomInt from an engine of its own
(std::mt19937 seeded by std::random_device) to Global.random_engine, the
engine of the run's seed, and only the name was taken back here. Its one
caller draws the trivia of the loading screen, in init_modes, before a
network client gets the seed of the session in server_hello: the server's
engine was then one draw ahead of the client's, and with a fixed
randomseed the trivia was the same on every start. It is drawn from
Global.local_random_engine now, the engine of what one machine shows,
seeded from a true random source in init_modes before the loader is made.

The test of the same seed checks the shared engine with Random() and the
local one with RandomInt(); a new test checks that RandomInt() doesn't move
the engine of the run's seed.

---------

Co-authored-by: maj00r <maj00r@host>
2026-11-21 10:39:40 +01:00
f2e73812d9 feat(editor): View menu with the top view, the lanes of the roads, the structure gauge and a window of the weather and time (time of day, day of the year, visibility, clouds, air temperature, seen in the editor only); the orthophoto settings in a window of their own again; the tracks and roads menus left out, their tools being in the row of the field of work; End drops the models onto the same ground the insert puts them on, the terrain tile models and the terrain patches of the editor included; the loading screen kept in the main window; Polish translation 2026-10-09 11:46:42 +02:00
jerrrrycho
79bd0c8e91 fix(sonar): addressing reliability/security issues (#202) 2026-10-04 20:00:13 +02:00
Sebastian Krzyszkowiak
86e91b187a scenarioloaderuilayer: Make the bottom gradient smoother
Since gamma factor is used, we need more than 256 steps to make
the gradient smooth.
2026-07-02 06:49:52 +02:00
Sebastian Krzyszkowiak
8b47d2af51 scenarioloaderuilayer: Scale the loading screen to the window size 2026-07-02 06:49:52 +02:00
docentYT
4c7cf22d06 Use texture id casting recommended by ImGui wiki 2026-05-12 00:18:11 +02:00
docentYT
d1f16411a1 Replace clamp with std::clamp 2026-05-01 22:14:29 +02:00
docentYT
ee3af0bf18 Change RandomInt to Random overload and reuse global random engine. 2026-05-01 00:25:16 +02:00
bc8c604e25 Add scenery name for eligible trivia in scenery loading uilayer 2026-04-14 20:39:43 +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
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