fix: ship send without any planets left

This commit is contained in:
Ilia Denisov
2026-02-17 19:57:08 +02:00
parent d42cee9df1
commit f394c105b0
4 changed files with 27 additions and 7 deletions
@@ -21,6 +21,11 @@ func TestShipGroupSend(t *testing.T) {
g.ShipClassCreate(Race_0.Name, "Fortress", 0, 50, 30, 100, 0)
assert.NoError(t, c.CreateShips(Race_0_idx, "Fortress", R0_Planet_0_num, 1))
shiplessRace := "Shipless"
ri, _ := c.AddRace(shiplessRace)
assert.NoError(t, c.ShipClassCreate(ri, "Drone", 1, 0, 0, 0, 0))
sgi := c.CreateShipsUnsafe_T(ri, c.MustShipClass(ri, "Drone").ID, R0_Planet_0_num, 1)
assert.ErrorContains(t,
g.ShipGroupSend(UnknownRace, c.ShipGroup(0).ID, 2),
e.GenericErrorText(e.ErrInputUnknownRace))
@@ -36,6 +41,9 @@ func TestShipGroupSend(t *testing.T) {
assert.ErrorContains(t,
g.ShipGroupSend(Race_0.Name, c.ShipGroup(1).ID, 1),
e.GenericErrorText(e.ErrShipsBusy))
assert.ErrorContains(t,
g.ShipGroupSend(shiplessRace, c.ShipGroup(sgi).ID, 2),
e.GenericErrorText(e.ErrSendShipOwnerHasNoPlanets))
assert.ErrorContains(t,
g.ShipGroupSend(Race_0.Name, c.ShipGroup(2).ID, 2),
e.GenericErrorText(e.ErrSendShipHasNoDrives))