From 084a705452ff2dd8f9a95d343ad96d1142677174 Mon Sep 17 00:00:00 2001 From: maj00r Date: Tue, 6 Oct 2026 22:19:12 +0200 Subject: [PATCH] fix(vehicles): vehicle placed with a switch as its first path no longer reads the direction of a previous path it doesn't have; vehicle put back on the track keeps the direction of its axles --- vehicle/DynObj.cpp | 4 ++-- world/TrkFoll.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vehicle/DynObj.cpp b/vehicle/DynObj.cpp index 0bf8815b..a6c57f56 100644 --- a/vehicle/DynObj.cpp +++ b/vehicle/DynObj.cpp @@ -1917,11 +1917,11 @@ void TDynamicObject::place_on_track(TTrack *Track, double fDist, bool Reversed) switch (iNumAxles) { // Ra: pojazdy wstawiane są na tor początkowy, a potem przesuwane case 2: // ustawianie osi na torze - Axle0.Init(Track, this, iDirection ? 1 : -1); Axle0.Reset(); + Axle0.Init(Track, this, iDirection ? 1 : -1); Axle0.Move((iDirection ? fDist : -fDist) + fAxleDistHalf, false); - Axle1.Init(Track, this, iDirection ? 1 : -1); Axle1.Reset(); + Axle1.Init(Track, this, iDirection ? 1 : -1); Axle1.Move((iDirection ? fDist : -fDist) - fAxleDistHalf, false); // false, żeby nie generować eventów break; } diff --git a/world/TrkFoll.cpp b/world/TrkFoll.cpp index b1884896..c437553d 100644 --- a/world/TrkFoll.cpp +++ b/world/TrkFoll.cpp @@ -51,6 +51,9 @@ TTrack * TTrackFollower::SetCurrentTrack(TTrack *pTrack, int end) { case tt_Switch: // jeśli zwrotnica, to przekładamy ją, aby uzyskać dobry segment { + if( pCurrentTrack == nullptr ) { + break; + } int i = end ? pCurrentTrack->iNextDirection : pCurrentTrack->iPrevDirection; if (i > 0) // jeżeli wjazd z ostrza pTrack->SwitchForced(i >> 1, Owner); // to przełożenie zwrotnicy - rozprucie!