mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-20 09:15:01 +01:00
Merge branch 'master' into feat/renderers-cleanup
This commit is contained in:
@@ -71,19 +71,8 @@ void TTrackFollower::Reset()
|
||||
fDirection = 1.0;
|
||||
}
|
||||
|
||||
// the end of the next track joined to the end of the current one, of the path of a switch the axle runs on
|
||||
int TTrackFollower::JoinedEnd(int const End) const
|
||||
{
|
||||
if( iPath >= 0 && pCurrentTrack->eType == tt_Switch ) {
|
||||
return End ? pCurrentTrack->SwitchExtension->iNextDirection[ iPath ] : pCurrentTrack->SwitchExtension->iPrevDirection[ iPath ];
|
||||
}
|
||||
return End ? pCurrentTrack->iNextDirection : pCurrentTrack->iPrevDirection;
|
||||
}
|
||||
|
||||
TTrack * TTrackFollower::SetCurrentTrack(TTrack *pTrack, int end)
|
||||
{ // przejechanie na inny odcinkek toru, z ewentualnym rozpruciem
|
||||
auto path { -1 };
|
||||
auto trailat { -1.0 };
|
||||
if (pTrack)
|
||||
switch (pTrack->eType)
|
||||
{
|
||||
@@ -92,14 +81,8 @@ TTrack * TTrackFollower::SetCurrentTrack(TTrack *pTrack, int end)
|
||||
if( pCurrentTrack == nullptr ) {
|
||||
break;
|
||||
}
|
||||
int i = JoinedEnd( end );
|
||||
if( i & 1 ) {
|
||||
// coming from the frog end the axle runs on its path whichever way the switch is set; it gets trailed through
|
||||
// only where the wheels get to the blades, or to the nose of a movable frog
|
||||
path = i >> 1;
|
||||
trailat = pTrack->trailing_point( path );
|
||||
}
|
||||
else if (i > 0) // jeżeli wjazd z ostrza
|
||||
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!
|
||||
}
|
||||
break;
|
||||
@@ -141,13 +124,7 @@ TTrack * TTrackFollower::SetCurrentTrack(TTrack *pTrack, int end)
|
||||
pCurrentTrack->AxleCounter(-1, Owner); // opuszczenie tamtego toru
|
||||
}
|
||||
pCurrentTrack = pTrack;
|
||||
// on a switch the axle keeps to the path it came on, the switch thrown under it doesn't move it over to the other one
|
||||
iPath = ( pCurrentTrack != nullptr && pCurrentTrack->eType == tt_Switch && pCurrentTrack->SwitchExtension ) ? ( path >= 0 ? path : pCurrentTrack->SwitchExtension->CurrentIndex ) : -1;
|
||||
fTrailAt = ( iPath >= 0 ? trailat : -1.0 );
|
||||
pCurrentSegment =
|
||||
iPath >= 0 ? pCurrentTrack->SwitchExtension->Segments[ iPath ] :
|
||||
pCurrentTrack != nullptr ? pCurrentTrack->CurrentSegment() :
|
||||
nullptr;
|
||||
pCurrentSegment = pCurrentTrack != nullptr ? pCurrentTrack->CurrentSegment() : nullptr;
|
||||
if (!pCurrentTrack)
|
||||
Error(Owner->MoverParameters->Name + " at NULL track");
|
||||
return pCurrentTrack;
|
||||
@@ -281,11 +258,6 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
return false;
|
||||
// if (fDistance==0.0) return true; //Ra: jak stoi, to chyba dalej nie ma co kombinować?
|
||||
s = fCurrentDistance + fDistance; // doliczenie przesunięcia
|
||||
if( fTrailAt >= 0.0 && s <= fTrailAt ) {
|
||||
// the wheels got to the blades of the switch coming from its frog end: pushed over if set the other way - rozprucie
|
||||
fTrailAt = -1.0;
|
||||
pCurrentTrack->SwitchForced( iPath, Owner );
|
||||
}
|
||||
// Ra: W Point2 toru może znajdować się "dziura", która zamieni energię kinetyczną
|
||||
// ruchu wzdłużnego na energię potencjalną, zamieniającą się potem na energię
|
||||
// sprężystości na amortyzatorach. Należałoby we wpisie toru umieścić współczynnik
|
||||
@@ -315,7 +287,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
if (!SetCurrentTrack(pCurrentTrack->Connected(iSegment, fDirection), 0))
|
||||
return false; // wyjście z błędem
|
||||
}
|
||||
else if (!SetCurrentTrack(pCurrentTrack->Connected(-1, fDirection, iPath), 0)) // ustawia fDirection
|
||||
else if (!SetCurrentTrack(pCurrentTrack->Connected(-1, fDirection), 0)) // ustawia fDirection
|
||||
return false; // wyjście z błędem
|
||||
if (dir == fDirection) //(pCurrentTrack->iPrevDirection)
|
||||
{ // gdy kierunek bez zmiany (Point1->Point2)
|
||||
@@ -349,7 +321,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
if (!SetCurrentTrack(pCurrentTrack->Connected(iSegment, fDirection), 1))
|
||||
return false; // wyjście z błędem
|
||||
}
|
||||
else if (!SetCurrentTrack(pCurrentTrack->Connected(1, fDirection, iPath), 1)) // ustawia fDirection
|
||||
else if (!SetCurrentTrack(pCurrentTrack->Connected(1, fDirection), 1)) // ustawia fDirection
|
||||
return false; // wyjście z błędem
|
||||
if (dir != fDirection) //(pCurrentTrack->iNextDirection)
|
||||
{ // gdy zmiana kierunku toru (Point2->Point2)
|
||||
|
||||
Reference in New Issue
Block a user