race quit, transfer state, refactor

This commit is contained in:
Ilia Denisov
2026-02-07 01:59:11 +02:00
parent 43ba5eb07c
commit fc73cbf83a
27 changed files with 520 additions and 341 deletions
+1 -9
View File
@@ -6,14 +6,6 @@ import (
"github.com/iliadenisov/galaxy/internal/util"
)
func (c *Controller) SendGroup(raceName string, groupIndex, planetNumber, quantity uint) error {
ri, err := c.Cache.raceIndex(raceName)
if err != nil {
return err
}
return c.Cache.SendGroup(ri, groupIndex, planetNumber, quantity)
}
func (c *Cache) SendGroup(ri int, groupIndex, planetNumber, quantity uint) error {
c.validateRaceIndex(ri)
@@ -29,7 +21,7 @@ func (c *Cache) SendGroup(ri int, groupIndex, planetNumber, quantity uint) error
sourcePlanet, ok := c.ShipGroup(sgi).AtPlanet()
if !ok {
return e.NewShipsBusyError()
return e.NewShipsBusyError("state: %s", c.ShipGroup(sgi).State())
}
if c.ShipGroup(sgi).Number < quantity {