mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-05 16:55:32 +01:00
ab3ec7a42e40b776d6db2e7e96ff19ff06e2cfc6
224 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ab3ec7a42e |
fix(vehicle): articulated joints keep their length, hoses bend smoothly from their cocks, buffers take the deflection of their end
- A joint of two cars (a rooted bonebend whose head is held to the whole turn of the next car) keeps the pieces of its spine as long as made (bones::keep_lengths): the bellows and the roof cables turn with the cars, no longer stretched and pressed by the play of the articulated coupling as the train brakes and pulls. - The turn is spread evenly along a rooted bend only for such a joint; a hose hanging from its cock (rooted, its head held to a line) turns along its chain, and is halved into small triangles like any other hose. - Each buffer is pressed in by the deflection of its end as the coupling has it (half the distance of the couplers, or that of the end in the physical model of the coupling) and by half of what its head stands nearer to the one it meets than the axis does: on the straight as before, on a curve the inside more. Assets (SVN pctga, scratchpad tool weze.py, not committed there yet): the .mmd of 404 vehicles get hose chains (hz_*: from each cock of pneumatic<n>[r]_On and cpneumatic<n>[r]_On to the point the heads share with the next vehicle), and those with automatic couplers a bone turning coupler<n>/cctrl<n>_on towards the pivot of the next one; the EN57 through a new attachments_<stem>_w.inc. The whole control cables of ukrotnienie.py are rehung smoothly from socket to socket. Without them the vehicles are drawn as before. |
||
|
|
b6083e57f8 |
feat(vehicle): joints bent evenly from both cars, whole control cables drawn once, buffers pressed on curves
- bonebend: an optional third point after head holds the head to the whole turn of the next car; on a rooted bend the turn is spread along the spine by its length, so a joint bends the same from both cars and two halves meeting at it (bellows, rubber collars) stand on the plane halving the angle. - Control cables: cctrl1/cctrl2 are AirCoupler buttons now. Where both coupled vehicles have cctrl<n>_xon at the ends that meet, the coupling owner (Render) shows _on, a cable modelled whole from socket to socket, and the other _xon, its plugs alone; otherwise both show _on as before. No model has _xon yet, so nothing changes for the data as it is. - Buffers: each buffer of a coupled end is pressed in by half its overlap with the nearest head of the next vehicle on the track, so the inside of a curve presses in and the outside stands clear. gfx.buffers.curve no in eu07.ini keeps both alike, by half the distance of the couplers, as before. - bones_doc.md describes them. Assets (SVN pctga, made by scratchpad tools harmonijki.py, ukrotnienie.py and gumy.py, not committed there yet): - new <stem>_h.t3d, przegub_<stem>_h.t3d and reworked *_h.t3d components for elf_v1 (27web without its e-f joint), impuls_v1, sa134_v1 and 21xm_v1, the .mmd pointing at them with bone entries; - new <stem>_u.t3d and ukrotnienie_<stem>_u.t3d (whole cables in cctrl<n>_on_kable, plugs in cctrl<n>_xon) for 4e_v1, en57_v1, 303e_v1, br285_v1, ep05_v2, et41_v2, ew58_v1, ew60_v1, m62_mod_v1, sm42_v1, sp42_v1, sp45_v1, st44_v1, st44_v2, su42_v1, su45_v2, su46_v2, tem2_v2, tem2u_v2; the EN57 .mmd name them by their parameters and a new attachments_<stem>_u.inc holding the bone entries; - new <stem>_g.t3d and gumy_<stem>_g.t3d (gangway_rubber1/2) for 110a_v2, 11xa_v2, 111arow_v1, 113aa_v1, 14xa_v1, 16xa_v1 and 168a_v1. Without them the vehicles are drawn as before. |
||
|
|
747e3da6b2 |
fix(vehicle): standing hoses keep still, and cost nothing at rest
A long hose (the 33 nodes of the test EU07's) trembled by about 2 mm a frame when standing. The solver keeps its lengths only nearly in 40 passes, so where it settles depends on the length of the substep, and the substeps took the length of each frame: 4 to 9 ms frames gave a slightly different hang each frame. Steady frames left it still. - The chains now take substeps of 1/240 s whatever the frames. The time short of a substep waits for the next frame, and the nodes as drawn go along with their ends meanwhile (bones::drawn()), so a running vehicle doesn't leave them behind. At high frame rates that is fewer substeps than before, when every frame took at least one. - A chain whose nodes and ends stand still for a second is left at rest, not simulated, until an end moves 0.1 mm. With nothing moved, its bent hose isn't posed or uploaded either. In the game, a standing EU07 of test/4e_kosci: the middle of a hose moves 0.0 mm a frame, its chain at rest. Assets: none. |
||
|
|
8a07b05d2a |
feat(steam): the boiler's efficiency by its heating surface; the Pt31 as strong as its rating against the Ty2
New optional key HeatingSurface in the Steam: section: the evaporative heating surface, m2. Given it, the boiler's efficiency falls with the coal burned an hour per m2 of it. It reaches BoilerEfficiencyMin at the 12 kg/(m2 h) of the Ty2 fired hardest, so a boiler with more surface to its grate keeps more of the heat. Without the key the efficiency falls with the firing rate of the grate alone, exactly as before. The Pt31 hauled the same trains as the Ty2 at the same speeds, and gave the same power. Its SteamRate of 3.9 kept the automatic fireman from firing to the full, and its boiler had the Ty2's efficiency on a larger grate only. The test Pt31 now has the literature's 239 m2 heating surface, 106.2 t, 110 km/h and 2000 KM (pl.wikipedia, parowozy.net), and the Ty2's steam rate scaled by the power (3.55 kg/s). Its boiler gives 1.25 times the Ty2's heat, against 1.22 by the ratings. With 650 t of coaches it keeps up 1.15 times the Ty2's power, faster on the level and up 5 per mille. The Ty2 and Ty23 get their surfaces too (177.7 and 191.1 m2); the Ty23 takes 1200 t to 67 km/h rather than 68. Assets: the placeholder vehicles in the SVN working copy, not committed yet (no release reads them): - pkp/ty2_v1/ty2.fiz gets HeatingSurface=177.7. - pkp/ty23_v1/ty23.fiz gets HeatingSurface=191.1. - pkp/pt31_v1/pt31.fiz gets M=106200, Vmax=110, PWR=1470, HeatingSurface=239 and SteamRate=3.55. - pkp/pt31_v1/pt31t.fiz gets M=67500 and Vmax=110. |
||
|
|
94fac84479 |
feat(vehicle): gangway bellows of articulated EMUs bent to the joint round a curve
A bonebend can be rooted (`bonebend: ... head <point> <point> rooted end`): the first point of its spine sits on the face of a car body, everything at or behind it stays as made, and the root does not turn. The part past it, the half of a gangway bellows on the end of the car, bends from the body to its head. `head` holds the head to the line from a point inside this car to one as far inside the next. That line halves the angle between the two cars, so the faces of the two halves stay on one plane round a curve rather than crossing at the joint. - Several bends of one submodel (the bellows on both ends of a middle car) bend one copy of it, each bend its own part. A rooted submodel is not cut into smaller triangles. - A bent submodel whose spines stand still (a train standing, or on a straight or one radius) is not posed and uploaded again. - `rooted` may stand before or after the head. Without the new entries nothing changes. Assets: none needed. The Elf EN76 (pkp/elf_v1) shows it once its 22wee-a, 22wee-b, 22wee-c and 22wee-d .mmd get the entries in bones_doc.md, before endmodels. The middle cars need a root, a joint and a head line on each end of model_glowny; the end cars need them on the inner end of pudlo. They are added in the local SVN working copy, not committed yet. |
||
|
|
7889022c8e |
feat(steam): the other steam of a steam locomotive: air pump, injectors, whistle, generator, glands
Five more parts a smoke source can show with the steam: key of its template, each driven by the steam engine: - air_pump: the exhaust of the air pump while the compressor runs on steam; - injectors: the overflow of the injectors, the more the wider they are open; - whistle: the whistle blowing (WarningSignal), while the boiler has steam; - generator: the steady exhaust of the turbo-generator with the boiler up; - leaks: steam past the glands of the cylinders, with steam in the chests, more with the engine working. Unit tests check each blows only while its part works. Templates without steam:, and vehicles without a steam engine, work as before. Assets: five new templates in the SVN's data/: smokesource_steam_pump.txt, smokesource_steam_injector.txt, smokesource_steam_whistle.txt, smokesource_steam_generator.txt and smokesource_steam_leaks.txt, made in the SVN working copy and not committed yet; the placeholder pkp/ty2_v1, ty23_v1 and pt31_v1 have sources of them. No model in the SVN uses them yet. |
||
|
|
34a257f531 |
feat(steam): steam and smoke of a steam locomotive
A smoke source of a vehicle's model now shows a part of its steam engine when its template says which, with the new optional key steam: in data/smokesource_<template>.txt: - exhaust: the blast up the chimney, in four puffs a turn of the driving wheels from two double-acting cylinders, merging into a steady blast at speed; - smoke: the smoke of the fire, denser the harder it burns; - safety_valves: the safety valves blowing off; - cocks: the open cylinder cocks, with each stroke. The engine gives each the share of the template's spawn rate and of the opacity and launch velocity of the particles (smoke::steam_emission, with unit tests). A template without steam:, or a vehicle without a steam engine, works as before: the smoke of the diesels and of the sceneries doesn't change. The AI opens the cylinder cocks of a steam locomotive while starting, under 10 km/h with the regulator open. Assets: four new templates in the SVN's data/: smokesource_steam_exhaust.txt, smokesource_steam_smoke.txt, smokesource_steam_valves.txt and smokesource_steam_cocks.txt, made in the SVN working copy and not committed yet. A model uses them with submodels of those names (the placeholder pkp/ty2_v1, ty23_v1 and pt31_v1 have them: the exhaust and the smoke at the chimney, the valves on the dome, the cocks at the cylinders). Without the templates such a source logs the missing file, as for any other template; no model in the SVN uses them yet. |
||
|
|
adb0d89dc0 |
test(steam): the Ty23 and the Pt31 from the drawings of the Stacja Muzeum collection
Two more classes for the steam engine, defined from the works drawings the Stacja Muzeum has scanned (Ty23: 1.03/1.05, 21.03, 22.01a; Pt31: 19.01, 21.04, 4.20, 1.04, 6.02), with no change to the model: - tests/unit/data/steam_ty23.json, steam_pt31.json: their definitions. The Ty23 has 650 x 720 mm cylinders, 1450 mm wheels, 14 at and full gear 84 % forwards and 70 % backwards. The Pt31 has 630 x 700 mm cylinders, 1850 mm wheels and 15 at. What the drawings don't give (the Pt31's mass, Vmax and grate, the boilers' steam rate and water) is from the literature or scaled from the Ty2. - Unit tests: both load in steam and start a few percent over the PKP's formula, as the Ty2 does: 228.6 kN against 216.1, 174.0 kN against 165.7. The Ty23 takes 1200 t to about 68 km/h on the level, the Pt31 500 t to about 86 km/h. - The test driver keeps the boiler between 3 and 1 bar under its own working pressure, rather than at the Ty2's 13 and 15 bar, which the Ty23's 13.73 and the Pt31's 14.71 never reached. The Ty2 is driven as before. - Scenario cases ty23_td_timetable and pt31_td_timetable: the AI drives each from Stacja1 to the stop at Przystanek. The Ty23's brake, as its drawing gives it (39.9 t on the shoes, in G), stops it 60 m past the mark, so its case allows 100 m. Assets: the scenario cases need the placeholder vehicles pkp/ty23_v1 and pkp/pt31_v1 (locomotive and tender each, .fiz, .mmd, .t3d, textures), made in the SVN working copy and not committed yet; their .fiz mark with ? what the drawings don't give. The unit tests need nothing from the SVN. |
||
|
|
13ea1c7808 |
fix(vehicle): hoses clamped in their cocks, the coupling head held whole
At a wide swing to the side the coupled heads seemed to come apart: - The chain hung on pins at its ends and swung about the line between the cocks like a pendulum, over 30 cm to the side. The rigid head then turned far against the rubber. - Since the hose is halved into small triangles, part of each head's vertices lay nearest the last but one piece of the spine. Those followed the rubber, not the head, and the head bent apart. Now: - An end of a chain at a fixed or coupler point is clamped: the node next to it is drawn to where it is as made, held to that vehicle (for a coupler point, to the next one). The hose leaves its cock as made. In a unit test a hose swung 40 degrees to the side goes 1.8 cm to the side clamped, where it went 13.2 cm on pins. - All of a coupling head within 8 cm of where the heads meet is held to the head as one, whichever piece it lies nearest. - Measured in a drive of two EU07, the centres of the two heads keep 55.9 mm apart (their place side by side in the coupling) with no change at all over 784 frames. Assets: none. |
||
|
|
8f840949e8 |
test(vehicle): the bone tests count their loops in whole steps (Sonar S2193)
Assets: none. |
||
|
|
ce339e2b65 |
refactor(steam): the steam engine a class, SteamEngine
As asked in the review: the engine is the class SteamEngine, with its parameters, state, controls and the angle of its cranks, and its load(), raise_steam(), cool_down(), update() and starting_force(), in place of the free functions of the namespace steam. The namespace keeps the steam tables and the plain data of the engine; the parts of an update are the class's helpers in steam.cpp. The vehicle has one SteamEngine Steam in place of SteamParameters, Steam, SteamControls and SteamCrankAngle. Nothing changes in what the engine does: the unit tests and the scenario cases ty2_td_timetable and eu07_td_timetable give the very same figures. The loops of the steam tests count in whole steps rather than in floating time (Sonar S2193). Assets: none. |
||
|
|
5c9748d067 |
feat(steam): full gear running backwards of its own, CutoffMaxReverse; the Ty23 from its drawings
The valve gear of a steam locomotive may give a shorter full gear running backwards than forwards: the Ty23's gives 84 % forwards and 70 % backwards (its drawing 21.03, valve gear results). The new optional Steam: key CutoffMaxReverse sets it; without it, backwards takes CutoffMax as before. A unit test defines the Ty23 from its drawings at Stacja Muzeum (1.03/1.05 main data, 21.03), with no more than the data of the Steam: section: its starting force comes out 228.6 kN, 5.8 % over the 22 030 kg of the drawing's formula, as the Ty2's 214 kN of the DR's tables is over the same formula. The model takes other two-cylinder simple-expansion locomotives with Heusinger gear by their data alone (the Ty23 and the Pt31 of that collection). Assets: none. A .fiz may add CutoffMaxReverse to its Steam: line. |
||
|
|
352d75a745 |
fix(vehicle): coupled hoses one chain for both vehicles, no jolts from the frame time
Driving on uneven track, the hoses between two coupled vehicles flew up and the coupled heads came apart: - The chain started at rest under a vehicle already running, and was left behind by it: the head flew 1 m up. - A frame longer than 0.1 s was cut short while the ends moved all the way, a jolt against the vehicle. - The substeps change their length from frame to frame, and the move of the last one was taken as it was: a jolt of some centimetres a substep at 50 km/h (12.8 cm of swing in the new unit test, under 5 mm now). - Each of the two vehicles moved its own copy of the hose; started apart or jolted, the copies drifted up to 25 cm. Now a chain starts going along with its ends, the move of the last substep is scaled to the next one, the chains move by the whole frame time and start again after a gap of more than 0.5 s, and a hose from cock to cock is moved by one of the two coupled vehicles, the other drawing the same chain from its end. Measured on two EU07 at 50 km/h on uneven track: the heads of the two vehicles 0.0 mm apart, the head within 0.40..0.67 m of height (it was 0.38..1.55 m). Assets: none. |
||
|
|
22bff58457 |
feat(steam): the AI drives a steam locomotive
- Ready to go with 5 bar in the boiler, where another locomotive is with its line breaker closed. - Starts its air pump: it runs on steam, so it doesn't wait for a converter as the compressor of an electric does. - Opens and closes the regulator a position at a time, the master controller, as it notches a series motor. - Notches up the valve gear with the speed, on the secondary controller: full gear up to 10 km/h, the shortest cut-off from 60 km/h, and two notches shorter when the boiler falls 4 bar below its working pressure. Other vehicles are driven as before: the scenario cases eu07_td_timetable and sm42_td_timetable pass as they did. A new scenario case, ty2_td_timetable, has the AI take the Ty2 and its tender from Stacja1 to the stop at Przystanek on td.scn. Braked in G only, the train counts as a goods train and leaves as soon as it is ready, not at 10:35. It stops 5 m past the 20 m allowed to the other cases (the G brake fills slowly, and the AI's first light application on the Knorr handle barely brakes), so it is allowed 30 m. Assets: the case needs the placeholder Ty2 (dynamic/pkp/ty2_v1), not in the SVN yet. Its ty2.fiz needs BCPN=4 in the Cntrl. line: without it the Knorr handle stops at position 2 and the train can't be braked, by the AI or by hand. |
||
|
|
35b70ce8d5 |
feat(vehicle): hoses bent along their chain, coupled head to head and swinging with inertia
A new .mmd entry, bonebend, bends a submodel made in one piece (the hoses of the existing models, pneumatic*) along a spine of points: each vertex follows the nearest piece of the spine, the turn carried along it from the cock so the rubber twists evenly. With head, the coupling head is held as one to the line between two points and the vertical of the world, so the heads of two coupled hoses stay together on one plane. The vertices are bent on the CPU into the vehicle's own copy of the submodel, drawn in its place. The chains (bonechain) now: - keep every other node at its distance as made, so a hose keeps its curve rather than folding; - damp only the swing against the vehicle, so a hose goes along with the vehicle's own motion; - average what the lengths ask of each node: the plain sum overshot, and a chain shivered and stretched by a fifth; - take up to 64 nodes, enough for one chain from a cock to the cock of the next vehicle with the head node between: both vehicles get the same chain, and the coupled heads lag and swing with the hoses; - move once a frame, by the render time, not once a render pass. Assets: none needed. A vehicle without bonebend lines in its .mmd is drawn as before; bones_doc.md has the entries for an EU07 hose. Tried on a local test copy of the EU07 (dynamic/test/4e_kosci, not in the SVN), not on a vehicle of the SVN yet. |
||
|
|
5e00999cb8 |
feat(vehicle): bones of the vehicle models: the rods of a steam locomotive, couplers and hanging hoses
A vehicle's .mmd can pin submodels of its model to points that move and turn them to keep facing another point (vehicle/bones.h, TDynamicObject::update_bones(), run with the wheels): - bonepoint: fixed, crank (going round with a wheel submodel of animwheelprefix:), slide (a crosshead on its guide keeping the length of the connecting rod), coupler (the next vehicle's hook, following it round a curve, over uneven track and with the buffers pressed in), mid (halfway between two points); - bonechain: a chain hanging between two points, its nodes swinging with gravity and inertia (Verlet integration in the world frame, substeps of 1/240 s at most), so a hose made of pieces swings when the vehicle jerks or rocks and sags as the buffers close up; - bone: a submodel moved with its anchor point and turned about it to face another point, or only moved. The submodels are posed with TSubModel::SetTranslate() and SetRotateXYZ(), in their own frame whatever their origin and axes, and get their future_transform for the motion blur. A model without these entries is drawn as before; the old entries animpistonprefix:, animconrodprefix:, animreturnprefix: and pistonfactors: still do nothing. bones_doc.md describes them, with examples. Unit tests (tests/unit/test_bones.cpp): the crank and the crosshead (the stroke twice the crank), the connecting rod keeping both its ends for a submodel turned in its frame, the angles giving what TSubModel::RaAnimation() does, the coupler, the hose meeting point, a chain hanging and swinging after a jerk, and the .mmd errors. Game data: the placeholder Ty2 of dynamic/pkp/ty2_v1 (SVN working copy, not committed) has its rods and its brake hose to the tender as bones in ty2.mmd. The EU07 (dynamic/pkp/4e_v1/4e.mmd) could take the six coupler lines of bones_doc.md, which were tried on a copy in a test folder; the data in the SVN isn't changed. |
||
|
|
0e51e37fa9 |
feat(steam): the boiler, fire and cylinders of a steam locomotive (EngineType=SteamEngine)
EngineType=SteamEngine was read and did nothing: no force, no controls, no AI. A vehicle of that type now runs a lumped model of its engine (McZapkie/steam.h), driven by TMoverParameters::steam_Update() every step: - the boiler: its pressure the saturation pressure of its water (the steam tables), the heat of the fire, the steam taken, the feed water warmed up and the heat lost; the level in the glass with its swell, priming over the top of the glass, the fusible plug melting under the bottom; the safety valves; - the fire: the coal burned as the exhaust, the blower and a little natural draught let it, the efficiency falling with the firing rate, the heat reaching the water with a delay; - the regulator as a throttle into the steam chest, choked under the critical pressure ratio, so the chest pressure falls at speed with the regulator part open; - the cylinders: the indicator diagram (admission to the cutoff, hyperbolic expansion, the back pressure of the blast pipe, the clearance), wire drawing with speed, the steam taken a revolution, the force swinging with the cranks at low speed; the pressure equalisers drifting; - the automatic fireman keeping the pressure and the water, the injectors and the blower; by hand in SteamControls; - the master controller works the regulator, the secondary controller the cutoff (0 full gear, the last position the shortest cutoff), the reverser at 0 is mid gear; - CompressorPower=Engine (and the legacy Main) of a steam locomotive is its steam air pump, running with the boiler over 3 bar; - a locomotive in steam keeps its physics awake, its boiler going on with no one in the cab. The new optional Steam: section of the .fiz sets a locomotive's own figures; without it they are those of the PKP Ty2 (DRB class 52). steam_doc.md lists the keys and what is still to come. No vehicle of the game data uses EngineType=SteamEngine, so nothing changes for any of them. Unit tests (tests/unit/test_steam.cpp): the steam tables, the starting force of the Ty2 (214 kN), a boiler kept standing by the fireman, the fusible plug, priming, the power the boiler keeps up at 65 km/h (about 1280 kW indicated), and the Ty2 of data/steam_ty2.json taking 1200 t up to about 61 km/h on the level. Game data: a placeholder Ty2 to drive, made in the SVN working copy and not committed there: dynamic/pkp/ty2_v1/ with ty2.fiz, ty2.mmd, ty2.t3d, ty2-1.tga (the locomotive) and ty2t.fiz, ty2t.mmd, ty2t.t3d, ty2t-1.tga (its tender), textures.txt. The code needs none of it. |
||
|
|
51c76da927 | fix(render): the free camera blurs with its own movement in the OpenGL 4.6 and Vulkan renderers | ||
|
|
d4f22061ee | Merge branch 'master' into feat/renderers-cleanup | ||
|
|
7c12b83ba4 |
fix(ai): an uphill start keeps the power on until the train brake is off (#396)
* fix(ai): an uphill start keeps the power on until the train brake is off The uphill start of #265 ended as soon as the power held the train (or the head of the train moved back 0.5 km/h). From then on the brake still on in the wagons made Ready false, the power went off, the train rolled back, was braked again and the start began anew; only the cylinders falling below 0.8 bar let the train get away. - Once the power holds the train, the start goes on while the train brake is released: Ready holds, the power stays on, bounded to 1.5 x the grade force. It ends when the consist is released (the same test as Ready, without the hold) or after 60 s. - A start is given up for rolling back on the mass-weighted speed of the consist, not on the speed of the locomotive, which runs back into the slack of the train held by its brake. - A train slipping back uphill is not released by the rule for a train to go on. * fix(ai): an uphill start begins only with the whole train at a stand * fix(ai): an uphill start applies the train brake further while it doesn't hold the train without the locomotive brake * fix(ai): the speed and the tractive force of an uphill start in the direction of travel also from cab 2 * fix(ai): an uphill start tops up the train brake a full application time a step, at most to full service, and keeps the power between 1.1 and 1.5 times the grade force while the brake releases * fix(ai): an uphill start no longer takes a notch back in the release phase: the notch below doesn't hold the train * refactor(ai): the train brake top-up of an uphill start in uphill_start::brake_top_up(), with unit tests |
||
|
|
988c0af589 |
fix(editor): the closing doesn't wait for a geoportal service that doesn't answer (#432)
* fix(editor): the closing doesn't wait for a geoportal service that doesn't answer When geoportal.gov.pl took the connection and never answered, the editor's closing stood still for tens of seconds and was killed: the WinHTTP client was synchronous and looked at the stop only between the reads of a body, so a request waiting for the answer held the closing for the timeouts (up to 20 s for the answer, a few tries a square), and the map of the place-picker downloaded with no stop at all, its std::async future waited for to the end. On Windows the client now uses WinHTTP asynchronously: each step is waited for while the stop is looked at every 50 ms, and a stop closes the request at once. The timeouts, the user agent, the size limit, the errors and the body of a response with an error status stay as they were. The map of the place-picker is given up when it goes. libcurl looked at the stop during the whole transfer already. The unit tests run the client against a local server that never answers (given up within 0.4 s of the stop), one with a body of 100 kB and one with an error status. * fix(editor): the capabilities of a WMS service being added don't hold the closing either The reading of the layers of a WMS service the user adds ran on a std::async future of the editor with no stop: closing the editor while such a service didn't answer waited for its three tries. The reading is given up when the editor goes, as the other downloads now are, and editor_http_get, left with no callers, goes. The unit test's silent server no longer waits for the client to close its connection, and the requests to the local server are skipped when the environment names a proxy, which couldn't reach it. * fix(editor): the stop of the WMS reading outlives the future waiting for it The flag was declared after the future of the reading, so it was destroyed first while the future's destructor still waited for the task reading it. --------- Co-authored-by: maj00r <maj00r@host> |
||
|
|
c5d14e93ac |
fix: whole-number bounds of Random() give a real number again (#416)
* fix: whole-number bounds of Random() give a real number again |
||
|
|
7524cfbcc2 |
feat(track): unevenness waves shaped by the track spectra of FRA and ORE B176 (#426)
* feat(track): unevenness waves shaped by the track spectra of FRA and ORE B176 The waves were 5-42 m sideways and 8-83 m vertically, with the long ones cut down, so a short wavelength carried a large share and the ride and the rails looked busy. They are now 7-90 m sideways and 8-110 m vertically, about the bands D1-D3 of EN 13848, each wave standing for a band of the spectrum S ~ Wc^2 / (W^2 (W^2 + Wc^2)), Wc = 0.8245 rad/m, the shape the FRA and the ORE B176 (German) spectra share: the longer a wave, the higher it is. The "uneven" value keeps its meaning, the peak deviation of a rail on a 10 m chord as PLK Id-14 measures it, so the values in sceneries stay as they are. Since the chord sees the long waves less, the amplitudes are calibrated again, and apart for the vertical and the sideways waves: stray_per_mm becomes stray_up_per_mm 0.00229 and stray_side_per_mm 0.0031, and cross_share 0.35. A track at "uneven 18" measures 18 mm vertically, 17 sideways, 15 of twist, +-10 of gauge, 21 of cross level and J 5.7 against the Id-14 limits for 80 km/h. A rail now goes up to about 5 cm off its design over the long waves, so the bound of the test goes from 40 to 60 mm; the short waves the cab shakes on are smaller, the sideways bend under the axles about 30% less. Every scenery with unevenness looks and rides differently after this. No release has unevenness yet. The grading tool follows the vertical waves; on Baltyk the pantograph keeps within 0.6 cm of the wire up to the product 1150 of the vertical value and the speed (925 before). * test(track): bound the sideways offset of an uneven track off its design The longer waves move the track about 4.5 cm sideways off its design at "uneven 18" (2 cm before), and nothing checked or stated it. The Id-14 test now bounds the peak sideways offset of the middle of the track below 5 cm, next to the vertical one, so a later change of the shares can't double it unnoticed. The doc gives the figure, and names platform edges and level crossing panels among what a rail moves away from. --------- Co-authored-by: maj00r <maj00r@host> |
||
|
|
201cae07e1 |
fix: a failed start says why and ends with an error code; a small crash dump by default (#425)
* fix: a failed start says why in the log and ends with an error code When the window could not be made, the log only said "Bad init: failed to create glfw window", without the reason glfw knows (no OpenGL driver, no pixel format that fits, no EGL). Sometimes it did not even say that: the log thread writes every 50 ms, and main() ended the process with std::_Exit(0) without stopping it, so a start that failed within that time left a log that ends at "// startup". - glfw's errors go to the log and errors.txt through glfwSetErrorCallback, set before glfwInit(); each distinct message once. - after a failed start (or an exception caught in main) the log thread is stopped and waited for, as the test runs already do, so nothing logged last is lost. - a failed start ends with exit code 1 instead of 0, so the starter can tell it from a closing. A start that worked ends as before. * fix: glfw's errors told during the start only, a closed crash dialog is no failed start After review of the previous commit: - the glfw error callback is taken off at the end of init(). Once the simulator runs, glfw would only repeat what the platform can't do (glfwSetCursorPos on Wayland, on every mouse-look) or what a scenery asks for in vain (launcher key codes below GLFW_KEY_SPACE, checked on every update), which would put new lines in errors.txt of existing sceneries and cost a format and a lock per call. - closing the crash-report window ends the simulator as before, but init() now returns 1 for it (above 0: closed by the player), and only a result below 0 gives exit code 1. - a start that throws from init() (bad_alloc, or a runtime_error on Windows) ends with exit code 1 too; an exception after a start that worked ends with 0 as before. * feat: a small crash dump by default, the full one with "crashdump.full yes" The dump written by the crash handler (Windows, WITHDUMPGEN) held all the memory of the simulator (MiniDumpWithFullMemory), so it was as large as the memory the simulator took: gigabytes on a large scenery, written to the game folder at the moment of the crash, on machines with 8 GB of RAM too. By default it now holds the stacks with the memory they point to, the threads, the modules, the handles, the memory map and the modules' data segments (MiniDumpWithDataSegs in place of MiniDumpWithFullMemory, the rest of the flags as before). The globals, Global among them, stay readable. "crashdump.full yes" in eu07.ini writes the full dump as before. Measured on td.scn with a ghostview camera (1.2 GB committed): the small dump 44 MB in 2 s, the full one 1.6 GB in 19 s. The key is new and optional: eu07.ini files without it read as before, and the setting is listed in the log at start. * fix: the small crash dump keeps the process and thread blocks MiniDumpWithProcessThreadData adds the PEB and the TEBs, a few KB: the command line (the scenery and the vehicle), the environment and the last error of each thread, which the small dump otherwise lacks, since the heap behind Global's longer strings is not in it. * fix: an exception that ends the simulator says what it was in the log After review of #425: - the exceptions main() catches are logged ("Critical error: ..."): on Windows the runtime_error that only showed a message box, and on the other systems any std::exception, which used to end the simulator through std::terminate with no word in the log. On Windows the others are still left to CrashHandler, whose dump shows where they were thrown. - every exception caught there ends with exit code 1, in the start or later, as a crash; it used to be 0 when caught, the abort code when not. - closing the crash-report window logs "Crash report window closed, closing" instead of the error "Failed to run crash gui!", which stays for a result below 0. * feat: the stack of a crash on Linux in the log and on the standard error On Linux no dump is written (the crash handler is Windows only, crashpad is off), so a crash left a log that just stopped. A handler of SIGSEGV, SIGBUS, SIGFPE, SIGILL and SIGABRT (installed at the start of main) now writes, with write() only: Crash: signal 11 (SIGSEGV) at address 0x... Version: EU07 (cmake), <hash> (...) Stack (addr2line -f -C -e <the eu07 file of this version> <offset>): <backtrace_symbols_fd> to the end of the log file (its whole path, set when the log opens it) and to the standard error, which StarterNG shows first. The Linux builds carry their symbols (GENERATE_PDB adds -g, nothing strips them), so addr2line on the eu07 file of the same version gives the files and lines. Then the signal ends the process as before (SA_RESETHAND, raise): the same exit status, and a core dump where the system makes one. The handler runs on an alternate stack, so an overflow of the main thread's stack is reported too; backtrace() is warmed up at install so it doesn't allocate in the handler, and alarm(5) ends a handler that hangs (a crash in the allocator or the loader). WAMR is built without its hardware bound checks, so it installs no SIGSEGV handler of its own. Elsewhere crash_signals does nothing. A unit test (Linux only) crashes a child process and checks the report on its standard error and in the log, and that the child still ended by SIGSEGV. * fix: the crash report can't be cut by a second crash signal or end with SIGALRM After review: - the five crash signals are blocked while a report is written, so a second one waits rather than starting a second report in its middle (a fault that comes while blocked still ends the process). - a report that hangs past alarm(5) ends the process by the signal of the crash, not by SIGALRM: a SIGALRM handler, set only in the crash handler, raises the crash signal and unblocks it. - the child of the unit test calls alarm(10) first, so a child stuck before the crash can't hang the build. --------- Co-authored-by: maj00r <maj00r@host> |
||
|
|
1b26caca24 |
fix: inverted clamp bounds give the upper bound again, as the old clamp did (#412)
* fix: inverted clamp bounds give the upper bound again, as the old clamp did The project's own clamp() of 26.05 applied the lower bound first and the upper one last, so bounds given the wrong way round always gave the upper one. Its calls became std::clamp (undefined for such bounds) and, where the bounds can cross, safe_clamp, which swapped them instead. Neither gives the old result. - safe_clamp is the old clamp again, min(max(value, lo), hi). This restores 26.05 at every place it is used, among them the AI's dynamic brake test (its demand was fAccThreshold x1.21, the swap made it x1.01), the generator voltage, the heavy cargo acceleration of the AI and the EP correction of the brake. - The cab camera is kept inside the cab with safe_clamp. The bounds come from the .mmd as written and some cabs have them reversed (the B cars of SA134 and 21xM, ET40, 754); with std::clamp the camera jumped between the two bounds every frame on MSVC, as its result is fed back. * fix: every call of the old clamp gives what it gave up to 26.05.1 |
||
|
|
267d5b3a8f |
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 |
||
|
|
053e4cacee | Merge branch 'master' into feat/renderers-cleanup | ||
|
|
80fd5aad2b |
Merge pull request #385 from MaSzyna-EU07/feat/blackbox-standalone
feat(blackbox): the black box on its own, lighter physics logs, physicslog.trains |
||
|
|
0a1c4fd425 |
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> |
||
|
|
99b93abd64 |
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> |
||
|
|
7547e6bf07 |
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. |
||
|
|
7b7529e24e |
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. |
||
|
|
03a3b4c09a |
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. |
||
|
|
f9b7e9174c |
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. |
||
|
|
afbc84c6bc |
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 |
||
|
|
d0a3694657 |
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 |
||
|
|
bac9954ad5 |
Merge pull request #333 from MaSzyna-EU07/test/parser-utilities-ladderlogic-coverage
Unit tests for the parser, the utilities and the PLC; coverage of the rest of the core library |
||
|
|
6d9a2bdd9b |
Merge remote-tracking branch 'origin/master' into fix/et42-fans-compressor-lamps-et22-louvre
Conflict in McZapkie/Mover.cpp, MotorBlowersCheck(): the blower's power source stays in MotorBlowerPowerIsAvailable(), which for a blower on the main circuit now asks MainCircuitPowered() instead of Mains (PantRequiresMain, #272), so the line contactors interlock sees it too. MotorConnectorsCheck() merged by itself: master's undervoltage relay in connectorsoff, and LineContactorsInterlockReleased() on the return. |
||
|
|
34eeca61f8 |
Merge pull request #326 from MaSzyna-EU07/test/automatic-coupler-scenarios-master
test(scenarios): automatic coupler cases (re-lands #288) |
||
|
|
e59b69462b |
Merge pull request #272 from MaSzyna-EU07/feat/mains-before-pantographs
Line breaker before the pantographs (`Cntrl.PantRequiresMain`) |
||
|
|
cce66422a3 |
docs: coverage of the rest of the core library, and what its tests found
The lines run of the files besides the physics, from the Coverage run of #325, what of the parser, the helpers and the PLC stays untested and what nothing in the game calls, and the behaviour the new tests recorded which may deserve a look. |
||
|
|
a53fed0a6f |
test: characterize the PLC of the vehicles
Programs of ladder logic made up for the tests: loading, the operations, timers and counters of scripting/ladderlogic.cpp. The game doesn't load a program into the controller yet. |
||
|
|
5764692e89 |
test: characterize the helpers of utilities
The texts, numbers, random numbers, file names and times of utilities.cpp and utilities.h as they behave now. The table of Bezogonkow() is checked as the build has it: one byte for its plus-minus sign with MSVC, two with GCC and Clang, which give other letters. |
||
|
|
2f13f052f7 |
test: characterize the parser of the text files
The tokens, comments, quotes, parameters and include directives of cParser, its numbers and its place in the text, as they behave now, with the files of the tests made in a folder of the build (scratch.h). The helpers of utilities.h which read from a parser are here too. |
||
|
|
c2ea47648b |
Merge pull request #325 from MaSzyna-EU07/feat/ci-unit-test-coverage
CI: coverage of the core library by the unit tests |
||
|
|
226eaabb7b |
fix: behind a line breaker closed ahead of the pantographs the main circuit still needs the voltage
Review of #272. The closed line breaker used to mean there's traction voltage, the undervoltage trip opening it without one. With PantRequiresMain=Yes it closes on the battery and holds without voltage, so everything that took Mains for "the main circuit is live" ran with the pantographs down, lowered for a section, or under a dead catenary. - MainCircuitPowered(): the line breaker closed, and on a vehicle with PantRequiresMain and current collectors also the voltage at least MinV (what the undervoltage trip takes). For every other vehicle it is Mains. It feeds the converter (and through it the 110 V and a compressor on it), a compressor on the main circuit, the heating from the main circuit, the motor blowers, the blowers of the starting resistors, the current of the series motors and the induction motor drive. - The undervoltage relay of such a vehicle opens the line contactors, as the line breaker opening did elsewhere: the camshaft goes back to zero and the motors get no current, also not the generator current a closed circuit without voltage gave. The relay picks up again with the voltage back and the master controller at zero or the first position, so the start begins anew instead of the camshaft running back up to the position left on the controller. Vehicles without the key are unchanged: the golden traces recorded before the change compare exactly. |
||
|
|
5d46478fa9 | Merge remote-tracking branch 'origin/master' into test/parser-utilities-ladderlogic-coverage | ||
|
|
e6fa206e47 |
Split stack 3-5c into master (switch blades, 3D sleepers, editor core, SRK stations, tutorial) (#289)
* feat(track): the rail code split by concern, the blades of the switches with the key frogs shaped from their templates The rails are laid by code of their own instead of inside Track.cpp: gauge lines (GaugeLine), knot lines (Knots.h), crossings and check rails (RailCrossings), rail materials (RailMaterials), measuring the rail profile (RailProfile), planning the cuts (RailPlan), the carving scan (RailCarve) and laying the geometry (RailLayer). A switch with the key frogs draws its blades from the tip where their planed nose ends to the heel, bent as they're thrown, and the rail behind them from the heel on, where they were laid from the start of the switch before; on a switch of the catalogue they start at the cut tip of the tables, 1.248 m from the joint at R 190, 1.5 m at R 300 (track_features::blades). The frogs cut from the rails, the wing and the check rails are built but switched off (track_features::crossings), the rails laid whole as before. The switches without the key keep the blades they had. A switch path can be a chain of pieces: pieces1 and pieces2 keep the parts of each path after the classic bezier, which stays as the approximation older versions read. A path with its radius given is a curve however gently it bends, a plain track a straight only where both of its control vectors lie along it. A vehicle trailing through a switch with a movable nose set the other way runs off the rails at it (TRAILED_SWITCH). * feat(render): the shared treads of the rails and their cut faces drawn, the cut faces in the matte variants of the rail materials Both renderers draw the treads a track shares with the rails it crosses, in the pick pass too, and a pass of their own for the faces where the rails are cut, the ends of the blades among them, in the matte variants of the rail materials, so the cut faces don't shine like the head the wheels polish. * feat(vehicle): an axle on a switch keeps to the path it came on, and coming from the frog end trails the switch through where the wheels reach the blades The switch thrown under an axle no longer moves it over onto the other path; it runs on along the one it entered. Coming from the frog end, where the blades are shaped or the frog has a movable nose, the switch set the other way is trailed through (rozprucie) only where the wheels get to the blades or to the nose, not as the axle enters the track; the other switches are trailed through as it enters, as before. * fix(track): the tracks drawn straight before, which their second control vector bends now, written to the log The simulator told a straight by the first control vector of a path alone, so a track whose second control vector bent it was drawn straight; now it's a curve. Such a track is named in the log as it loads, so a scenery made counting on the straight can be found: 25 tracks of lk357. Paths with both control vectors along them bend a centimetre or so at most and aren't named. * feat(track): 3D sleepers and switch timbers laid where the simulator makes the ballast, switched off in the build The sleepers of a track running alone are laid square to it, the timbers of the switches and crossings across the tracks running over them, shared by them, of the models set with sleepers3d and sleepers3dplain in eu07.ini; sleepers3dbed tells whether the ballast is laid under them too, lowered so they stick out of it. The layout of a cluster of tracks is worked out once and kept till a track of it changes, in a thread of its own while the simulation runs. timbermodel of a track, read and written back before, takes the place of the model of sleepers3d there. All of it is off whatever eu07.ini sets (track_features::sleepers), the tracks keeping their ballast and their sleeper models. * feat(render): the 3D sleepers and switch timbers drawn in instanced batches Render_Timbers lays the beams of the tracks in range where they're out of date and draws those of a run of tracks of a cell gathered by the model and its part or its level of detail, in as few instanced batches as they fit in; in the shadow pass only those near the camera. A track with them leaves its old sleeper model out. OpenGL 3.3 renderer only. * fix(track): the counts of what's wrong with the sleepers kept safe from the thread laying them, and that thread stopped before what it works with goes The counts of the beams clipped, dropped and off the plane, of the slowest and the biggest cluster, are counted by the thread working out the layouts in the background as well as by the simulation laying a cluster itself, and were plain values written by both; they're atomic now. What the thread keeps the clusters in, their version and the counts were made after the worker, as it first asked for them, and so destroyed before it at the exit while its thread could still be laying a cluster; they're made first now, the worker stopping and joining its thread before they go. The tracks go with the paths of the simulation, made before the worker. * revert(track): a tributary and a track of an unknown type load as before They came in with the rail code from the guards of the editor against crashing, and don't belong with the blades: a track of an unknown type loaded as a normal track of the railway could be joined to it and run on, and a tributary loaded as a river with its first path lost the second one when the editor saved the scenery. Both load as on master again; the place where the editor crashed on them is to be guarded where it is. * fix(track): the tracks drawn straight before named in the log once, as they load, and the paths of the switches with no radius told a straight as before in one term The log of the tracks the second control vector bends now was written each time the segments of a track were made again, as a track with its unevenness loads and as the editor changes or drags a track; it's written only the first time, as the track loads. The paths of a switch or a crossing with no radius keep the rule of master, a straight told by the first control vector alone, its two terms being the same length; they're one term now, with the comment saying so. * fix(track): the thread laying the sleepers stopped as the application exits, and loading no models itself The thread reads the scenery, which the application deletes as it exits well before the statics go: it's stopped and joined first thing in exit() now, the worker destroyed with the statics only where the application exits some other way, and not started again after. The models the beams are made of were loaded by the thread where it didn't find them, through the renderer, out of the thread of the renderer, into a map read by the simulation meanwhile: they're found under a lock now and loaded only by the threads other than it, again for all the tracks whenever a track changed since, before a layout is asked of it. With the 3D sleepers off in the build their settings aren't exported, and a track changed doesn't look for the tracks around to lay their beams again. * feat(track): the 3D sleepers turned on with sleepers3d in eu07.ini, no longer switched off in the build track_features::sleepers is gone: sleepers3d <model> in eu07.ini lays them, none (the default) lays nothing and the tracks keep their ballast, as before. The sleepers3d settings are written back with the others. The editor changes the tracks, so while it's open their sleepers are worked out on the main thread as they're needed, not in the background. * fix(render): only the part of a timber model drawn, not what else the model holds A timber model of parts may hold more than its begin, main and end, as the kits with the fastenings of the rails do. Those were drawn with each part of each timber, in the middle of the track; they aren't laid, so they're skipped now. * fix(track): the 3D sleepers laid only for a renderer which draws them Only the OpenGL 3.3 renderer draws the beams. With another one a track set to them lost its ballast to them, lowered or not laid at all with sleepers3dbed no, and nothing was drawn in its place. Draws_Timbers() of the renderer tells now, and where it's false the tracks keep their ballast, as with sleepers3d none. * fix(render): the submodels of a timber model left as they were after its parts are drawn They were all made visible after a part was drawn, the ones the model hides itself too, like Light_On, while the same model may stand in the scenery. The submodels of the top level besides the parts are listed as the model is loaded, hidden while a part is drawn and given back their own visibility after. The parts have to be at the top level of the model for that; a model with them deeper is logged and drawn whole. Render_Timbers no longer looks the model up under the lock for every run of tracks, the name set is enough there. * fix(render): a vertex whose faces give its texture no direction gets a tangent across its normal, not a NaN one The cut ends of the rails have one spot of the texture on all their corners, so their tangent came out of normalize() as NaN. The normal-mapped shaders then shaded them with a NaN normal: about half of the vertices of the cuts and frogs, and the end faces of the rails. * feat(track): the frogs cut from the rails turned on with frogs in eu07.ini, no longer switched off in the build frogs yes cuts the rails of the plain tracks and of the switches with the key frogs where they cross other rails, into frogs, wing rails and check rails. It's off by default: the rails are laid whole as before, the blades of the switches with the key are shaped still. * refactor(editor): the track mode file split into the files of its tools, the code as it was A pure move, so that the commits after it show what changes in each tool rather than a 4800-line file rewritten. The member functions of editor_mode go to the file the editor of this branch has them in: route, straights, lay, switchplace, switchdrive, switchtool, trackgizmo, and the rest stays in editormodetrack.cpp. The helpers of its anonymous namespace go to editormodetrackshared.h, as they were but inline, in namespace track_mode, which the files use. No line of code changes; the files add only their license, includes and the using line. * feat(editor): the groundwork the tools of the editor share - The tool interface (editortool.h), the gestures of the mouse (editorgestures.h) and what the modes share (editormodeshared.h); the projection, viewport, selection and texture picking taking them up. - Scripted input (scriptedinput): the input of a selftest script fed to the editor as if typed and clicked, the real mouse and keyboard ignored meanwhile; EU07_EDITOR_SELFTEST_HIDDEN draws into a window never shown nor focused. - The ui layers and panels of the editor, its settings, icons and the info of the includes; the layers of the scenery and their saving; the launcher mode. - utilities: user_cache_path (the cache folder of the system for the user) and the helpers of the translations. - stb_image: the gif loader takes the frame two back from the frames it decoded, not from before its buffer. - tools/editor: the scripts making the headers of the drives, the turntables, the editor and its usage. - Unit tests: test_area and the stubs of the editor the tests link. Not built on its own: the tree builds again with the selftests commit, the one before the translation. * feat(editor): the tracks laid along an alignment, to the PKP PLK norms, with their grade line and the ground - The alignment of the laying (editorAlignment, editorAlignmentStore): straights, transition curves and arcs with the cant of the norms for the speed, the radius below the minimum for it a warning; the lay, route and straights tools build on it, the route plan reading the curves going on from the tracks adjoining. - The grade line (editorProfile, the profile and gradeline tools): fitted to the terrain model or edited by hand, the tracks fitted marked in the scenery (//$f), the shared grade lines of nearly parallel tracks (//$n). - The ground under the tracks (editorGroundFollow, trackbed): the terrain drawn to the tracks and restored, the tracks put onto the terrain. - Connections between tracks (editorConnections, the connection and connection curve tools), the track presets, the shape of a track (editorTrackShape), digitizing tracks from the orthophoto, the properties sheet of the tracks (trackprops) and the track ux. - Unit tests: alignment, ground fit, heights, with the data of two fits. Not built on its own: the tree builds again with the selftests commit, the one before the translation. * feat(editor): the switches placed, slid and designed from their templates - The switch templates (editorSwitchStore, the template tool): the catalogue switches and the user's own, kept with the settings; the designer (editorSwitchDesign) with a drawing of the dimensions, a and b typed in with the shape making up the rest, a switch clicked off the orthophoto. - The curve of a switch laid into a curve (editorSwitchCurve), placement on a straight or into a curve, slide along it, crossovers and double slips (switchplace, switchslide), the drives of the switches (switchdrive) and the records of the switches placed (records). - Unit tests: test_switch_curve. Not built on its own: the tree builds again with the selftests commit, the one before the translation. * feat(editor): the tools of the infrastructure beside the tracks The gauge, speed, joints, lineside, parallel tracks, vehicles, signals, turntables, sweep and road tools with headers of their own; the kilometrage of the lines (editorKilometrage, the km tool); the infrastructure, roads and speeds behind them (editorInfra, editorRoad, editorSpeed). Not built on its own: the tree builds again with the selftests commit, the one before the translation. * feat(editor): the terrain model of geoportal.gov.pl and the orthophoto downloaded for the editor - editorNmt: the squares of the terrain model at 1 m (NMT GRID1, the WCS service of geoportal.gov.pl) fetched by two workers, kept in editor/cache/nmt/grid1 of the game folder, the heights of the scenery taken from them; the nmt mode loads it along the tracks or around the camera. - editorHttp: the HTTP client of both, WinHTTP on Windows, libcurl elsewhere where it's built with it; without it the caches only. - The orthophoto: its cache moved to the cache folder of the system for the user, the download area a polygon on the topo map (//$a) filled in the background, the 4K imagery, the tiles waiting outlined on the ground. - editorGeoMap: the topo map of the top view; heightmapterrain and the terrain streamer grow the terrain made from the model around the camera. Not built on its own: the tree builds again with the selftests commit, the one before the translation. * feat(launcher): the scenery wizard picks the place of a new scenery on the topo map the editor shares The wizard drops its own map download and decoding for the topo map widget of the editor (editorGeoMap). The place clicked becomes the geographic reference of the new scenery (//$g PUWG1992), and the scenery starts with the orthophoto of the editor on (//$o), lying under it in place. Not built on its own: the tree builds again with the selftests commit, the one before the translation. * feat(editor): the tools wired into the editor mode and the build editor_mode takes the tools of the commits before: its header declares them, editormode.cpp and the track mode drive them, and the renderers draw their overlays (opengl33 and legacy). CMakeLists lists the new sources and adds WITH_EDITOR_SELFTESTS (off by default); the unit tests build the new test files. Not built on its own: the tree builds again with the selftests commit, the one before the translation. * feat(editor): the selftests of the editor split by what they test The scripts of EU07_EDITOR_SELFTEST run the commands of editormodeselftest*.cpp: scene, track, rails, join, switch, signal, sleepers, sweep, terrain, monkey. The code is in every build; only with WITH_EDITOR_SELFTESTS=ON does the editor read the variables and run a script. The selftests of master now need the option too. The tree builds again with this commit. * feat(editor): the Polish texts of the editor, all of them in one update of editor_pl.po * fix(editor): the marks of the editor moved off the letters the starters read, and its lines told by their words The starters read some letters in a scenery file: the Starter the title //$n, the attachments //$f and the old scenery //$a, StarterNG and the launcher of the game the attachments //$f and the title //$n. The editor wrote its download area, shared grade lines and fitted tracks under them, and took every line of those marks as its own: saved, a scenery lost its title and attachments, and the starters showed the lines of the editor as them. - The download area is //$z, the shared grade lines //$w, the fitted tracks //$t. - Their lines and those of //$o are told by their first words, as //$h, //$r and //$k were: //$o only as "on 0" or "on 1", the origin or the settings of older builds after it, so a trainset described as "on ..." isn't taken. - The lines older builds wrote under //$a, //$n and //$f are read only by the words the editor wrote in them, or by its own comment line before them, under the new mark. Each save writes them again with it, also when the editor didn't change them; the lines of the starters stay. * fix(editor): a square of the terrain model cut short isn't read, and the squares are kept in the user's cache The service puts the directory of its GeoTIFF before the pixels, so a file cut short by a write or a fetch broken off was read whole, the pixels missing coming out as heights of 0 m, for good. - The reader (editorGeoTiff.hpp, with unit tests) wants all the strips the rows need, each within the file. - A square is written under a name of its own and renamed. - The squares are kept in the user's cache folder (nmt/grid1), as the orthophoto, since the game folder may not be writable; without one, in the game folder as before. The ones older builds kept there are moved over as each is asked for, a damaged one deleted. - Capabilities that didn't come aren't kept as the fallback name for the session: the next square asks again. * chore(editor): the http client said to serve the terrain model and the topo map too, the gif fix of stb_image marked local - CMake names the orthophoto, the terrain model and the topo map as what goes without libcurl. - The fix of the gif frame two back in stb_image is ours, not upstream's (v2.30 still has the old line): a comment at the line says so, for an update of stb_image to keep it. * fix(editor): the lines moved off the letters of the starters in a merged layer written once, not again with each save A merged layer's text goes into the file of its target on save, and the target is read again; the marked lines of the merged layer were dropped only for the marks the editor had changed. The lines moved to the new letters stayed with their old places, and the next save of the session wrote them into the target once more. - After a save, the marked lines of every merged layer are dropped; those of its target are read again from its file. - The lines of a dead layer aren't written again. - The selftest layermerge merges the layer of one file into another's, as the layers panel does. * feat(editor): the station as the signalling sees it, found from a switch of it, and its schematic editorStation: the switches joined by plain track no longer than 1.5 km, the tracks between them and the lines leading out, 400 m of each beyond the outermost switch; laid out as a schematic along the main track through the station. The track circuits, the signals and their lights, the lengths of the station tracks and the lines to the next stations are worked out from it for the signalling tool. Nothing uses it yet: the signalling tool, wired in the next commit, does. It builds on its own. * feat(editor): the signalling of a station in the Signalling tab, laid out from a switch of it as on the lines of PKP PLK LMB on a switch in the Signalling tab opens its station: the schematic in a window of its own, the name, the code, the line and the km of the station, and the steps of its signalling, each one step of undo: - the switches numbered along the station after its code, bpd_1, the parts of a slip bpd_15a..d; the drives and the objects naming a switch follow it, events written by hand keep the old names; - the tracks cut at the joints of the track circuits, Ie-4, and the circuits named, bpd_iz1, bpd_it1; - the entry, exit and shunting signals placed and named, A, F1, Tm1, from the templates chosen; - the signals of the lines out: the automatic block of three or four aspects, the block sections no shorter than the braking distance, or the semi-automatic one with a warning disc; block boundaries drawn by hand; - the lights each signal needs for its routes, Ie-1 and Ie-4 § 8, its template fitted to them; - the SHP track resonators the signals lack, rezonator.inc; - the lengths of the station tracks as a table, and what the station and its lines still lack, with Repair. The stations described are kept as //$s lines in the files of their layers. * fix(editor): the signals of a station and of its lines not placed with no template for a kind, no track cut for them first - Set the signals and Set the line signals cut the tracks first, and only then found no template for a kind. They stopped there, but the cuts stayed as a step of undo. Now they ask for the templates first, by the lookup signal_batch() uses (signal_template_for(), behind editor_signals::signal_templates_missing()). Without one nothing is cut. - Set the signals and Set the track circuits again under Track lengths had the ids of the buttons of the steps above them. ImGui flagged them when hovered. Each now has an id of its own. * fix(utilities): win1250_to_utf8 turns the polish letters into utf-8, not into themselves utilities.cpp starts with a byte order mark, so the compiler reads it as utf-8. The game's targets don't get /utf-8, though: set_target_properties(... COMPILE_OPTIONS ...) in the MSVC block of CMakeLists.txt replaces the options add_compile_options gave them. So the string literals went into the program in the code page of the system, windows-1250 on a polish one, and the map of win1250_to_utf8 turned each letter into itself. What read windows-1250 through it got no utf-8: the names, descriptions and categories of the sceneries and the names of the textures in the launcher, and the descriptions of the templates in the editor. The editor writes such a description back through utf8_to_win1250, which makes a question mark of each byte that doesn't start a utf-8 sequence, so the letters it had read unchanged didn't come back. The utf-8 sequences are written as bytes now, the way utf8_to_win1250 has them, so they don't depend on the options. The options stay as they are: with /utf-8 other literals of the files with a byte order mark would change, the "±" of the table of Bezogonkow would take two bytes and move the letters after it. The unit tests check the letters and that the text given is valid utf-8. (cherry picked from commit |
||
|
|
75c8ac6149 |
test(scenarios): the coupler control case checks that the units coupled
The checks of en57_2000_automatic_coupler_couples said only that nothing collided nor derailed, so the case passed just as well with the units buffering, bouncing apart or never meeting. The simulator writes nothing to the log when automatic couplers catch, but the black box of the run (physicslog/<scenery>_<date>.blackbox, written along with the physicslogs the runner turns on) gets a coupling record with the two vehicles. run.py reads the vehicle and the coupling records of it and gets a check on them, couples: the two named vehicles couple after the start and are still coupled at the end. It fails when the black box has no coupling of that pair, when they came apart again, when they were coupled from the start, and when the run left no black box. The case names the vehicles that meet: the last car of the standing unit and the first of the rolling one. The black box is moved to out/<case>/ with the other files of the run. |
||
|
|
c09c44f978 | Merge remote-tracking branch 'origin/master' into feat/mains-before-pantographs |