wip: generate report
This commit is contained in:
@@ -576,10 +576,12 @@ func (c *Cache) listShipGroups(ri int) iter.Seq[*game.ShipGroup] {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: order upgradable groups by cost descending, describe in Rules
|
||||
func (c *Cache) shipGroupsInUpgrade(planetNumber uint) iter.Seq[*game.ShipGroup] {
|
||||
return func(yield func(*game.ShipGroup) bool) {
|
||||
for sg := range c.g.ShipGroups {
|
||||
if c.g.ShipGroups[sg].Destination == planetNumber && c.g.ShipGroups[sg].State() == game.StateUpgrade {
|
||||
// number checked for further sanity after battles
|
||||
if c.g.ShipGroups[sg].Number > 0 && c.g.ShipGroups[sg].Destination == planetNumber && c.g.ShipGroups[sg].State() == game.StateUpgrade {
|
||||
if !yield(&c.g.ShipGroups[sg]) {
|
||||
break
|
||||
}
|
||||
@@ -588,9 +590,9 @@ func (c *Cache) shipGroupsInUpgrade(planetNumber uint) iter.Seq[*game.ShipGroup]
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Cache) unsafeDeleteShipGroup(i int) {
|
||||
c.validateShipGroupIndex(i)
|
||||
c.g.ShipGroups = append(c.g.ShipGroups[:i], c.g.ShipGroups[i+1:]...)
|
||||
func (c *Cache) unsafeDeleteShipGroup(sgi int) {
|
||||
c.validateShipGroupIndex(sgi)
|
||||
c.g.ShipGroups = append(c.g.ShipGroups[:sgi], c.g.ShipGroups[sgi+1:]...)
|
||||
c.invalidateShipGroupCache()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user