mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-21 15:54: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:
@@ -262,17 +262,16 @@ public sealed class VehicleDetails
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The vehicle's own settings. Every write path is unchanged: crew and wagon number
|
||||
/// go through the unit's active car, the coolant flag to its first car only.
|
||||
/// The vehicle's own settings: the crew is the unit's and sits where its cab is,
|
||||
/// the wagon number goes through the unit's active car, the coolant flag to its
|
||||
/// first car only.
|
||||
/// </summary>
|
||||
private Control BuildVehicleSection(ConsistItem item)
|
||||
{
|
||||
var driver = new ComboBox { FontSize = 12, MinWidth = 0 };
|
||||
foreach (string key in new[] { "DriverHead", "DriverRear", "DriverPassenger", "DriverNobody" })
|
||||
driver.Items.Add(new ComboBoxItem { Content = App.Loc[key] });
|
||||
var crewCar = _consist.ActiveCar(item);
|
||||
|
||||
driver.SelectedIndex = crewCar.DriverType switch
|
||||
driver.SelectedIndex = item.Driver switch
|
||||
{
|
||||
eDriverType.Headdriver => 0,
|
||||
eDriverType.Reardriver => 1,
|
||||
@@ -288,14 +287,9 @@ public sealed class VehicleDetails
|
||||
2 => eDriverType.Passenger,
|
||||
_ => eDriverType.Nobody
|
||||
};
|
||||
if (picked == crewCar.DriverType) return;
|
||||
if (picked == item.Driver) return;
|
||||
|
||||
crewCar.DriverType = picked;
|
||||
item.Driver = Consist.UnitDriver(item.Cars);
|
||||
if (ReferenceEquals(_consist.Selected, item))
|
||||
_consist.SyncStartingVehicle();
|
||||
_redraw();
|
||||
AppServices.Current.State.NotifyChanged();
|
||||
_consist.SetCrew(item, picked);
|
||||
};
|
||||
driver.MinWidth = 0;
|
||||
driver.HorizontalAlignment = HorizontalAlignment.Stretch;
|
||||
|
||||
Reference in New Issue
Block a user