17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-08 08:27:17 +01:00

fix(track): the cab keeps the shake a track doesn't replace, and the editor redraws all that an edit changes

The side sway from the lateral acceleration now goes off only on a track with a sideways value, and the random jolts on one with a vertical or a sideways value. Dips at the rail joints and cross level alone replace neither. On a switch it goes by the path set and what its joined tracks allow.

An edit in the editor also rebuilds the other switches of a joined group with the tracks they meet, and the tracks of a rail run whose joints moved. Removing a track does the same. While dragging, the tracks further off wait until the drag ends.

The clatter of a bogie's axles was right: the followers stand at the pivots and the offsets are the places of the wheel sets. The misleading name goes.

Also what Sonar had left: a parameter as a span, a const method, a struct and its member apart, commented out code, and a function of the grading tool split, with the same output.
This commit is contained in:
maj00r
2026-11-01 20:12:33 +01:00
parent dbc173ebea
commit a68c535be9
13 changed files with 140 additions and 33 deletions

View File

@@ -261,20 +261,29 @@ def plain_neighbours(t, joints):
return [other for key in ("p1", "p2") for other, _, _ in joints.at(t["paths"][0][key]) if other is not t and other["kind"] == "normal"]
def joined_at(t, point, joints, seen):
# the plain tracks joined at a point, and the far ends of the straight paths of the switches joined there
plain, further = [], []
for other, part, side in joints.at(point):
if other is t or id(part) in seen:
continue
seen.add(id(part))
if other["kind"] != "switch":
plain.append(other)
elif other["paths"].index(part) != other["bent"]:
further.append(part["p2" if side == "p1" else "p1"])
return plain, further
def plain_past_switches(t, point, joints):
# the plain tracks reached from a point of a track along the straight paths of switches
points, seen, found = [point], set(), []
for _ in range(6):
onward = []
for reached in points:
for other, part, side in joints.at(reached):
if other is t or id(part) in seen:
continue
seen.add(id(part))
if other["kind"] != "switch":
found.append(other)
elif other["paths"].index(part) != other["bent"]:
onward.append(part["p2" if side == "p1" else "p1"])
plain, further = joined_at(t, reached, joints, seen)
found += plain
onward += further
points = onward
return found