Add several copies from a vehicle's menu in the consist too

The copies go right after the vehicle, a whole unit for one of a set. The
count flyout is shared with the browser.
This commit is contained in:
maj00r
2026-10-04 14:30:53 +02:00
parent 6232930f4c
commit 925ac87129
4 changed files with 72 additions and 36 deletions

View File

@@ -81,7 +81,10 @@ public partial class Depot : UserControl
_consist, () => _browser.Selected, InsertTextureAt, _browser.SelectInBrowser);
_cards = new VehicleCards(consistStack, _db, _consist, _cargo, _minis, _hand,
RebuildConsist, () => _details.Refresh(), _browser.SelectInBrowser, _drag.ArmCardDrag);
RebuildConsist, () => _details.Refresh(), _browser.SelectInBrowser, _drag.ArmCardDrag)
{
AddCopies = AddCopiesAfter
};
// Hidden still scrolls - it only drops the bar itself.
MiniTextures.Sharp(miniPreview);
@@ -594,6 +597,16 @@ public partial class Depot : UserControl
InsertTexturesAt(texture, at, count);
}
/// <summary>Copies of the vehicle on a card - a whole unit for one of a set - right after it.</summary>
private void AddCopiesAfter(ConsistItem item, int count)
{
int index = _consist.IndexOf(item);
if (index < 0 || item.Cars.Count == 0 || _db.TextureForSkin(item.Cars[0].SkinFile) is not { } texture)
return;
InsertTexturesAt(texture, index + 1, count);
}
private void InsertTextureAt(VehicleTexture texture, int at) => InsertTexturesAt(texture, at, 1);
/// <summary>The vehicle count times in a row from at - each staffed as added - and one redraw.</summary>