mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 05:09:20 +02:00
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
This commit is contained in:
@@ -1917,11 +1917,11 @@ void TDynamicObject::place_on_track(TTrack *Track, double fDist, bool Reversed)
|
|||||||
switch (iNumAxles) {
|
switch (iNumAxles) {
|
||||||
// Ra: pojazdy wstawiane są na tor początkowy, a potem przesuwane
|
// Ra: pojazdy wstawiane są na tor początkowy, a potem przesuwane
|
||||||
case 2: // ustawianie osi na torze
|
case 2: // ustawianie osi na torze
|
||||||
Axle0.Init(Track, this, iDirection ? 1 : -1);
|
|
||||||
Axle0.Reset();
|
Axle0.Reset();
|
||||||
|
Axle0.Init(Track, this, iDirection ? 1 : -1);
|
||||||
Axle0.Move((iDirection ? fDist : -fDist) + fAxleDistHalf, false);
|
Axle0.Move((iDirection ? fDist : -fDist) + fAxleDistHalf, false);
|
||||||
Axle1.Init(Track, this, iDirection ? 1 : -1);
|
|
||||||
Axle1.Reset();
|
Axle1.Reset();
|
||||||
|
Axle1.Init(Track, this, iDirection ? 1 : -1);
|
||||||
Axle1.Move((iDirection ? fDist : -fDist) - fAxleDistHalf, false); // false, żeby nie generować eventów
|
Axle1.Move((iDirection ? fDist : -fDist) - fAxleDistHalf, false); // false, żeby nie generować eventów
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
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;
|
int i = end ? pCurrentTrack->iNextDirection : pCurrentTrack->iPrevDirection;
|
||||||
if (i > 0) // jeżeli wjazd z ostrza
|
if (i > 0) // jeżeli wjazd z ostrza
|
||||||
pTrack->SwitchForced(i >> 1, Owner); // to przełożenie zwrotnicy - rozprucie!
|
pTrack->SwitchForced(i >> 1, Owner); // to przełożenie zwrotnicy - rozprucie!
|
||||||
|
|||||||
Reference in New Issue
Block a user