private void UpdateFrontForward(AbstractTrain Train) { // update train if (NextSectionIndex >= 0) { if (!currentRoute.Sections[NextSectionIndex].Invisible) { Train.CurrentSectionLimit = currentRoute.Sections[NextSectionIndex].CurrentAspect >= 0 ? currentRoute.Sections[NextSectionIndex].Aspects[currentRoute.Sections[NextSectionIndex].CurrentAspect].Speed : double.PositiveInfinity; Train.CurrentSectionIndex = NextSectionIndex; } } else { Train.CurrentSectionLimit = double.PositiveInfinity; Train.CurrentSectionIndex = -1; } // messages if (NextSectionIndex >= 0 || !currentRoute.Sections[NextSectionIndex].Invisible) { Train.SectionChange(); } // update sections if (NextSectionIndex >= 0) { currentRoute.Sections[NextSectionIndex].Enter(Train); currentRoute.UpdateSection(NextSectionIndex); } }
private void UpdateFrontForward(AbstractTrain Train, double currentTime) { // update train if (this.NextSectionIndex >= 0) { if (!CurrentRoute.Sections[this.NextSectionIndex].Invisible) { if (CurrentRoute.Sections[this.NextSectionIndex].CurrentAspect >= 0) { Train.CurrentSectionLimit = CurrentRoute.Sections[this.NextSectionIndex].Aspects[CurrentRoute.Sections[this.NextSectionIndex].CurrentAspect].Speed; } else { Train.CurrentSectionLimit = double.PositiveInfinity; } Train.CurrentSectionIndex = this.NextSectionIndex; } } else { Train.CurrentSectionLimit = double.PositiveInfinity; Train.CurrentSectionIndex = -1; } // messages if (this.NextSectionIndex < 0 || !CurrentRoute.Sections[this.NextSectionIndex].Invisible) { Train.SectionChange(); } // update sections if (this.NextSectionIndex >= 0) { CurrentRoute.Sections[this.NextSectionIndex].Enter(Train); CurrentRoute.Sections[this.NextSectionIndex].Update(currentTime); } }