17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 00:29:19 +02:00

60 Commits

Author SHA1 Message Date
jerrrrycho
6263fe539b Fix/sonar maintainability rebased (#209)
* refactor(sonar): use override instead of redundant virtual (cpp:S3471)

* refactor(sonar): remove empty statements, one declaration per statement (cpp:S1116, cpp:S1659)

* refactor(sonar): drop redundant lambda return types (cpp:S3574)

* refactor(sonar): prefer using over typedef (cpp:S5416)

* refactor(sonar): use =default for trivial special members (cpp:S3490)

* refactor(sonar): use nullptr literal (cpp:S4962)

* refactor(sonar): remove redundant access specifiers (cpp:S3539)

* refactor(sonar): remove redundant casts (cpp:S1905)

* refactor(sonar): use std::scoped_lock instead of std::lock_guard (cpp:S5997)

* refactor(sonar): construct elements in place with emplace_back (cpp:S6003)

* refactor(sonar): make narrowing conversions explicit (cpp:S5276)

* refactor(sonar): mark unused parameters (cpp:S1172)

Unused names are commented out; parameters used only on some platforms
are marked [[maybe_unused]].

* refactor(sonar): declare non-mutating member functions const (cpp:S5817)

Virtual functions are left untouched so overrides keep matching.

* refactor(sonar): merge collapsible nested if statements (cpp:S1066)

Comments that preceded the inner if are kept above the merged statement.

* refactor(sonar): scope single-use variables in if init-statements (cpp:S6004)

* fix(sonar): give polymorphic base classes virtual destructors (cpp:S1235)

* refactor(sonar): use try_emplace for map insertion (cpp:S6030)

* refactor(sonar): use auto where the type is spelled out on the right (cpp:S5827)

* refactor(sonar): remove redundant parentheses (cpp:S1110)

* refactor(sonar): document intentionally empty functions (cpp:S1186)

* refactor(sonar): remove dead stores (cpp:S1854)

Side effects (e.g. LISTLINE++) are kept.

* refactor(sonar): remove unused variables, captures and private fields (cpp:S1481, cpp:S1068)

* refactor(sonar): use structured bindings for pair access (cpp:S6005)

* refactor(sonar): use range-based loops and ranges algorithms (cpp:S5566)

* refactor(sonar): split chained assignments (cpp:S1121)

* refactor(sonar): add default cases to switch statements (cpp:S3562)

* refactor(sonar): use std::size for array lengths (cpp:S7127)

* refactor(sonar): use std::ranges algorithms and std::erase(_if) (cpp:S6197)

* refactor(sonar): access static members through the class (cpp:S2209)

* refactor(sonar): add braces around nested if-else (cpp:S5261)

* refactor(sonar): avoid side effects inside typeid operands (cpp:S5279)

* refactor(sonar): drop top-level const from by-value return types (cpp:S5951)

* refactor(sonar): declare variables separately from their type definitions (cpp:S3646)

* refactor(sonar): declare loop counters in the for statement (cpp:S5955)

* refactor(sonar): rely on class template argument deduction (cpp:S6012)

* refactor(sonar): inherit base constructors instead of forwarding them (cpp:S5952)

* refactor(sonar): rename locals that shadow outer declarations (cpp:S1117)

Only local variables and definition parameters are renamed; shadowing
struct fields and enumerators in headers are left for a separate change.

* refactor(sonar): reduce enum qualification with using enum (cpp:S6177)

Applied only where no unqualified name in the block could be captured by
the introduced enumerators.

* refactor(sonar): mark converting constructors explicit (cpp:S1709)

sound_source and the gl::object conversion operators stay implicit; they
are relied upon by copy-list-initialisation and GL calls.

* refactor(sonar): initialise members in initialiser lists or declarations (cpp:S3230)

* refactor(sonar): make read-only local references and pointers const (cpp:S5350)

* refactor(sonar): take read-only pointer and reference parameters as const (cpp:S995)

TTrain command handlers keep their signature, it is fixed by the handler table.

* refactor(sonar): pass expensive-to-copy parameters by const reference (cpp:S1238)

Signatures declared in files touched by PR 206 (Driver.h, EU07.cpp) and
virtual overrides are left unchanged.

* refactor(sonar): use transparent comparators for string-keyed maps (cpp:S6045)

std::unordered_map instances and map types exposed in headers used by
other modules are left as they are.

* fix(sonar): do not use UI text as a printf format string (cpp:S5281)

Text lines containing '%' would otherwise be interpreted as format
specifiers by ImGui::TextColored.

* refactor(sonar): use std::bind_front for callbacks (cpp:S5995)

* refactor(sonar): drop const_cast on string literals passed to the Python C API (cpp:S859)

* refactor(sonar): take read-only string parameters as std::string_view (cpp:S6009)

The Windows messaging helpers keep std::string, they need c_str().

* refactor(sonar): make read-only global tables const (cpp:S5421)

Mutable global state (flags, timers, singletons) is left as is.

* refactor(sonar): replace single-case switch statements with if (cpp:S1301)

* refactor(sonar): format UUIDs and log timestamps with std::format (cpp:S6494, cpp:S5945)

* refactor(sonar): use std::array for local fixed-size arrays (cpp:S5945)

Arrays that are class members or part of headers are left unchanged.

* fix(sonar): test the bearing damage bit, not bit 0 (cpp:S872)

'DamageFlag & dtrain_bearing > 0' parsed as 'DamageFlag & (dtrain_bearing > 0)',
i.e. DamageFlag & 1, so bearing friction reacted to the wrong damage flag.

* refactor(sonar): assorted small fixes

- empty() instead of size() comparisons (cpp:S1155)
- member initialisers in declaration order (cpp:S3229)
- no redundant c_str() when a std::string is accepted (cpp:S7121)
- contains() on associative containers (cpp:S6171)
- const reference instead of a copying range-for (cpp:S6032)
- starts_with() for prefix checks (cpp:S6178)
- no std::move on temporaries (cpp:S5274)
- has_value() on std::optional (cpp:S7172)
- bool literals for bool members (cpp:S5820)
- inline only on the definition (cpp:S3548)
- explicit base access specifier (cpp:S5965)
- explicit element access instead of dereferencing an array (cpp:S7116)
- rely on the C++20 rewritten operator!= (cpp:S6186)

* refactor(sonar): more small fixes

- std::format instead of iostream manipulators in to_string/to_hex_str (cpp:S6495);
  output verified identical, negative hex values keep the unsigned form
- remove an empty compound statement (cpp:S108)
- drop an always-false unsigned < 0 branch (cpp:S1768)
- explicit lambda capture (cpp:S3608)
- std::make_unique (cpp:S5950)

* chore: strip stray carriage returns left in TTrain constructor comments

* fix: keep quantize() in its own value type

The S5276 change cast the result of the generic quantize<Type_>() to
unsigned int, which truncated float/double callers (shadow angle slider,
editor rotation snapping, AI speed control steps) and broke negative values.

* fix(sonar): use integer loop counters in segment sampling (cpp:S2193)

* refactor(sonar): clean up issues reported on PR 209

- remove locals left unused after the dead-store cleanup (cpp:S1481, cpp:S1854)
- unnamed unused parameter (cpp:S1172)
- single-use declarations moved into if init-statements (cpp:S6004)
- auto for casted initialisers (cpp:S5827)
- const references and pointers where nothing is modified (cpp:S5350)
- rename structured bindings shadowed by inner declarations (cpp:S1117)
2026-10-11 13:22:33 +02:00
7d331ee65a Editor: brace ImGui clipper loops, rename scenery wizard file name field 2026-10-10 19:55:50 +02:00
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
917c8f7285 Merge branch 'master' into feat/modern-editor 2026-10-08 17:44:58 +02:00
maj00r
4a7d839e5d feat(launcher): new scenery made by the wizard starts at noon with no fog and no clouds 2026-10-08 02:17:06 +02:00
maj00r
110c99a155 fix(launcher): map credits of the wizard of a new scenery wrapped to the width of its panel 2026-10-08 00:51:29 +02:00
maj00r
0a3cd55e59 feat(launcher): -edit without a scenery opens the wizard of a new scenery: file name, title and centre, picked on the OpenStreetMap map of geoportal.gov.pl in PUWG 1992 or given in degrees; the scenery is written with the centre as its //$g reference and opened in the editor; a bare -edit no longer loads the scenery of eu07.ini 2026-10-06 22:19:40 +02:00
maj00r
978b99b7e5 feat(scenery): models laid along curves (sweep nodes), bent to follow the paths or repeated along them, loaded and saved with the scenery; trainsets put on a path while the simulation runs; trainset turned around by reversed after its header: the first vehicle stays at the offset and leads towards point 1, the rest stands behind it; launcher keeps reversed trainsets and can turn one around; memory cells saved with the new name of the path they name; events tell their targets and the events of a multiple event; renderer tells whether the cursor is over a surface; vehicle placed in the editor entered when the driving goes on 2026-10-06 22:19:32 +02:00
jerrrrycho
79bd0c8e91 fix(sonar): addressing reliability/security issues (#202) 2026-10-04 20:00:13 +02:00
jerrrrycho
176427f96b refactor: sonar c++20 changes (#185) 2026-09-28 21:08:15 +02:00
Sebastian Krzyszkowiak
f249781805 launcher: Open on scenery list panel
This is the panel that allow to quickly launch a selected scenario, so
it makes sense to show it by default.
2026-08-06 16:53:58 +02:00
jerrrrycho
d85096f64d reformat: remove redundant parentheses 2026-06-30 21:19:46 +02:00
docentYT
e95e00a2e2 Use texture id casting recommended by ImGui wiki 2026-05-12 18:04:50 +02:00
docentYT
ca699d117f Remove not needed includes 2026-05-02 14:40:31 +02:00
docentYT
bd21b8f49c Replace string_starts_with and string_ends_with with string::starts_with and string::ends_with 2026-05-01 13:33:32 +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
jerrrrycho
45889a40a1 remove legacy background loading 2026-01-29 08:06:49 +01:00
411aac648f Fix shift, ctrl and alt key handling on windows 2025-09-17 17:54:12 +02:00
Ryba04
33ad7b718f Merge branch 'master' into master 2025-09-13 19:46:26 +02:00
jakubg1
5e2175302b Loading screen overhaul POC
The loading screen has been significantly changed:
- The background image is now properly picked randomly instead of taking the `textures/logo.bmp` file, prepended by an external program such as Rainsted/Starter.
- The progress bar has been moved from a floating window to a thin green line at the bottom of the loading screen.
- The log window is now hidden by default. It can be turned on by setting `loadinglog` to `true` in `eu07.ini`.
- There is an animated wheel icon on the loading screen, and a trivia text is displayed.

New translation key:
- `"Did you know"`

TODO:
- Load trivia from a separate file.
2025-09-10 01:53:22 +02:00
jakubg1
9fa22d81e5 Make launcher respond to window resize 2025-09-09 17:08:23 +02:00
jakubg1
c217081823 Launcher improvements
Launcher windows are more Starter-like now:
- The scenery picker, vehicle list and keymapper buttons are now tied to the top portion of the screen.
- The current window is spanning the entire rest of the screen.
- Scenarios are now grouped into categories in the exact same way as Starter does.
- Some drawbacks include:
  - Currently you cannot edit the current trainset, as the vehicle picker window overwrites the scenario list window.
  - The GUI doesn't update when the screen resolution is changed.
2025-09-09 16:40:04 +02:00
jakubg1
6f1b03fccf Fix Shift/Ctrl/Alt key handling on Linux
On native Linux builds, due to weird key modifier handling, key modifiers often worked backwards.
Now modifer key handling is streamlined and is not mode-dependent.
2025-09-05 14:54:29 +02:00
jakubg1
c83c123596 Add scenery category detection, launcher category list parity with Starter 2025-09-04 18:01:48 +02:00
WLs50
0280b40ca5 Merge remote-tracking branch 'manul-public/master' into manul-staging 2025-04-05 14:24:53 +02:00
Jano211
0e08086937 Fix for writing useless log informations 2025-03-16 13:44:36 +01:00
Jano211
797045e8ae Changes in camera shaking, and others:
clatter sounds, csm stage boundaries, particles physics and hiding log panel when in launcher mode.
2025-03-16 13:44:07 +01:00
WLs50
a5f6397eca merge manul 2025-03-09 15:36:11 +01:00
jakubg1
7560829d16 Launcher: Display vehicles by groups by default
This matches the Starter.
2024-04-01 19:40:32 +02:00
jakubg1
c9ccdda806 Fix loading mini textures with periods
Some textures, like textures/mini/9-107.13, had incorrectly part of their name removed (truncated to textures/mini/9-107) and thus were failing to load. The workaround was to add an explicit ".bmp" extension for that to be removed instead.
2024-03-03 04:04:42 +01:00
jakubg1
84980a4484 Improve the keymapper
The keymapper, available as one of the options in the starting menu when the EXE is run without a scenery specified, has undergone a few changes:
- Key descriptions are now parsed the way Starter does and are displayed in the window. They are also no longer consumed when saving to a file.
- Unbound keys are now also displayed as well. Not all of them though; some entries won't exist if they are not specified in the eu07_input-keyboard.ini file.
- You can now unbind a key by pressing F10.

The Parser has got a new boolean option: `skipComments`, true by default to leave current behavior unchanged. When set to false, comments will be parsed as ordinary tokens.
2024-03-03 03:00:47 +01:00
milek7
b01c19308c fix scenery_list crashes when missing vehicles 2023-05-28 21:25:05 +02:00
milek7
a182eec2a1 slightly better ui scaling 2020-12-02 01:49:58 +01:00
milek7
286f31b75c bugfixes 2020-10-23 01:23:48 +02:00
milek7
9b7f10ab57 workaround for allowing quit in launcher, fixup freeflymodeflag accesses in TTrain 2020-10-19 02:12:35 +02:00
milek7
29f8f91ad8 Merge remote-tracking branch 'tmj/master' into sim 2020-10-18 23:35:14 +02:00
milek7
1dc1bd5fcb pre-merge renames 2020-09-30 18:27:43 +02:00
milek7
078cbdb71b show file in scenery scanner errors 2020-03-29 21:56:36 +02:00
milek7
6a17b134dc random start screen image 2019-11-02 18:42:49 +01:00
milek7
203ea7f288 vehicleparams icons 2019-09-23 21:08:05 +02:00
milek7
f093956b31 launcher search tweak 2019-09-22 22:09:13 +02:00
milek7
7c444396ed launcher: search text tweak 2019-09-22 21:01:14 +02:00
milek7
8dd71f1fe6 launcher: vehicle picker filtering 2019-09-22 20:50:35 +02:00
milek7
45142cb826 launcher tweaks 2019-09-22 14:03:49 +02:00
milek7
bb408a69f3 launcher: vehicle skin filter, texture metadata parsing 2019-09-22 01:22:17 +02:00
milek7
d0d7fa6738 launcher changes 2019-09-21 23:25:48 +02:00
milek7
f7ac7cc581 launcher link start fix, assume scn files in win1250 2019-09-01 17:41:23 +02:00
milek7
30df10a58e further WIP on launcher 2019-08-29 00:10:30 +02:00
milek7
89919fc44d use explicit string() in filesystem::path 2019-08-26 12:57:35 +02:00
milek7
555d69b835 further WIP on launcher 2019-08-25 00:41:03 +02:00