mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-04 21:16:58 +01:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user