Cargo give: the bay no longer holds a stack below one, so the give's positive-stack filter and its zero-stack test go
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ddae55759d
commit
fa5820f516
2 changed files with 3 additions and 4 deletions
|
|
@ -110,7 +110,7 @@ public static class CargoTransfer
|
|||
}
|
||||
else if (bay.ItemsOfType.TryGetValue(order.Item.Data.Key, out var stacks))
|
||||
{
|
||||
var stack = stacks.OfType<SimpleCommodity>().FirstOrDefault(s => s.Quantity > 0);
|
||||
var stack = stacks.OfType<SimpleCommodity>().FirstOrDefault();
|
||||
if (stack != null) return (bay, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -697,15 +697,14 @@ public sealed class CargoTransferTests : IDisposable
|
|||
Assert.Equal(5, order.Remaining);
|
||||
}
|
||||
|
||||
// An empty stack in a hold is no unit to give: the give moves the real units and then has nothing left.
|
||||
// A give of more than the hold has moves the real units and then has nothing left.
|
||||
[Fact]
|
||||
public void AnEmptyStackIsNotAUnitToGive()
|
||||
public void AGiveOfMoreThanTheHoldHasEndsNothingLeft()
|
||||
{
|
||||
var giver = ShipWithBays("Crate");
|
||||
var receiver = ShipWithBays("Crate");
|
||||
var grit = Commodity("Grit", 2);
|
||||
Assert.True(giver.CargoBays[0].TryStore(grit));
|
||||
Assert.True(giver.CargoBays[0].TryStore(Commodity("Grit", 0)));
|
||||
Place(giver, receiver);
|
||||
giver.Command.Give(receiver, grit, 3);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue