Seat a unit's crew in the car that has the cab

A driver in cab 1 goes into the first car of a unit and one in cab 2 into the
last - the ET42-A has only cab 1, the ET42-B only cab 2. The crew is the
unit's: the card, the details and replacing a vehicle all set it there,
rather than in whichever car happened to be selected.
This commit is contained in:
maj00r
2026-10-04 19:11:44 +02:00
parent 526ff91b3b
commit ee87055eed
4 changed files with 65 additions and 28 deletions

View File

@@ -123,6 +123,39 @@ public class ConsistCrewTests
Assert.Equal(eDriverType.Headdriver, loco.Cars[0].DriverType);
}
[Fact]
public void A_unit_staffed_at_the_head_has_its_driver_in_cab_1_of_the_first_car()
{
var unit = Unit("ep07-001", "ep07-002");
_consist.Staff(unit, 0);
Assert.Equal(eDriverType.Headdriver, unit.Cars[0].DriverType);
Assert.Equal(eDriverType.Nobody, unit.Cars[1].DriverType);
}
[Fact]
public void A_driver_in_cab_2_moves_into_the_last_car_of_a_unit()
{
var loco = Add("ep07-001", 0);
loco.Cars[0].DriverType = eDriverType.Reardriver;
loco.Driver = eDriverType.Reardriver;
var unit = Unit("ep07-001", "ep07-002");
_consist.Replace(0, unit);
Assert.Equal(eDriverType.Nobody, unit.Cars[0].DriverType);
Assert.Equal(eDriverType.Reardriver, unit.Cars[1].DriverType);
Assert.Equal(eDriverType.Reardriver, unit.Driver);
}
private ConsistItem Unit(params string[] skins) =>
new()
{
Cars = skins.Select(skin => _consist.MakeDynamic(_catalog.TextureForSkin(skin)!, null)).ToList(),
Grouped = true
};
private ConsistItem Add(string skin, int at)
{
var item = Item(skin);