race quit, transfer state, refactor
This commit is contained in:
@@ -9,14 +9,6 @@ import (
|
||||
"github.com/iliadenisov/galaxy/internal/model/game"
|
||||
)
|
||||
|
||||
func (c *Controller) UpgradeGroup(raceName string, groupIndex uint, techInput string, limitShips uint, limitLevel float64) error {
|
||||
ri, err := c.Cache.raceIndex(raceName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.Cache.UpgradeGroup(ri, groupIndex, techInput, limitShips, limitLevel)
|
||||
}
|
||||
|
||||
func (c *Cache) UpgradeGroup(ri int, groupIndex uint, techInput string, limitShips uint, limitLevel float64) error {
|
||||
c.validateRaceIndex(ri)
|
||||
sgi, ok := c.raceShipGroupIndex(ri, groupIndex)
|
||||
@@ -26,8 +18,8 @@ func (c *Cache) UpgradeGroup(ri int, groupIndex uint, techInput string, limitShi
|
||||
st := c.ShipGroupShipClass(sgi)
|
||||
sg := c.ShipGroup(sgi)
|
||||
|
||||
if s := sg.State(); s != game.StateInOrbit { // && s != game.StateUpgrade
|
||||
return e.NewShipsBusyError()
|
||||
if state := sg.State(); state != game.StateInOrbit {
|
||||
return e.NewShipsBusyError("state: %s", state)
|
||||
}
|
||||
|
||||
p := c.MustPlanet(sg.Destination)
|
||||
|
||||
Reference in New Issue
Block a user