feat: remove instant group breaking

This commit is contained in:
Ilia Denisov
2026-02-11 09:35:33 +02:00
parent 1515bc8599
commit 6e84cc3c51
17 changed files with 223 additions and 403 deletions
+1 -13
View File
@@ -7,7 +7,7 @@ import (
"github.com/iliadenisov/galaxy/internal/util"
)
func (c *Cache) shipGroupSend(ri int, groupID uuid.UUID, planetNumber, quantity uint) error {
func (c *Cache) shipGroupSend(ri int, groupID uuid.UUID, planetNumber uint) error {
c.validateRaceIndex(ri)
sgi, ok := c.raceShipGroupIndex(ri, groupID)
@@ -25,10 +25,6 @@ func (c *Cache) shipGroupSend(ri int, groupID uuid.UUID, planetNumber, quantity
return e.NewShipsBusyError("state: %s", c.ShipGroup(sgi).State())
}
if c.ShipGroup(sgi).Number < quantity {
return e.NewBeakGroupNumberNotEnoughError("%d<%d", c.ShipGroup(sgi).Number, quantity)
}
p1, ok := c.Planet(sourcePlanet)
if !ok {
return e.NewGameStateError("source planet #%d does not exists", sourcePlanet)
@@ -42,14 +38,6 @@ func (c *Cache) shipGroupSend(ri int, groupID uuid.UUID, planetNumber, quantity
return e.NewSendUnreachableDestinationError("range=%.03f", rangeToDestination)
}
if quantity > 0 && quantity < c.ShipGroup(sgi).Number {
nsgi, err := c.breakGroup(ri, groupID, quantity)
if err != nil {
return err
}
sgi = nsgi
}
if p1.Number == p2.Number {
c.UnsendShips(sgi)
c.shipGroupMerge(ri)