Skip to content

Commit

Permalink
Fix consists not honoring the locomotive preference (first bug caught…
Browse files Browse the repository at this point in the history
… by testing!).
  • Loading branch information
YoRyan committed Jul 23, 2020
1 parent 0b66e51 commit d189ea9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Orts.Formats.Msts/ConsistFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ public ISet<PreferredLocomotive> GetReverseLocomotiveChoices(string basePath, ID

public IEnumerable<WagonReference> GetForwardWagonList(string basePath, IDictionary<string, string> folders, PreferredLocomotive preference = null)
{
if (GetLeadLocomotiveChoices(basePath, folders).FirstOrDefault().Equals(preference))
if (preference != null && !GetLeadLocomotiveChoices(basePath, folders).Contains(preference))
return new WagonReference[0] { };
return Train.TrainCfg.WagonList
.Select((Wagon wagon) => new WagonReference(EngineOrWagonPath(basePath, wagon), wagon.Flip, wagon.UiD));
}

public IEnumerable<WagonReference> GetReverseWagonList(string basePath, IDictionary<string, string> folders, PreferredLocomotive preference = null)
{
if (GetReverseLocomotiveChoices(basePath, folders).FirstOrDefault().Equals(preference))
if (preference != null && !GetReverseLocomotiveChoices(basePath, folders).Contains(preference))
return new WagonReference[0] { };
return Train.TrainCfg.WagonList
.Select((Wagon wagon) => new WagonReference(EngineOrWagonPath(basePath, wagon), !wagon.Flip, wagon.UiD))
Expand Down

0 comments on commit d189ea9

Please sign in to comment.