feat: enroute groups
This commit is contained in:
@@ -504,6 +504,10 @@ func (c *Cache) breakGroupSafe(ri int, groupIndex uint, newGroupShips uint) (int
|
||||
if c.ShipGroup(sgi).Number < newGroupShips {
|
||||
return -1, e.NewBreakGroupIllegalNumberError("group #%d ships: %d -> %d", c.ShipGroup(sgi).Index, c.ShipGroup(sgi).Number, newGroupShips)
|
||||
}
|
||||
return c.breakGroupUnsafe(ri, sgi, newGroupShips), nil
|
||||
}
|
||||
|
||||
func (c *Cache) breakGroupUnsafe(ri, sgi int, newGroupShips uint) int {
|
||||
newGroup := *c.ShipGroup(sgi)
|
||||
if c.ShipGroup(sgi).CargoType != nil {
|
||||
newGroup.Load = c.ShipGroup(sgi).Load / float64(c.ShipGroup(sgi).Number) * float64(newGroupShips)
|
||||
@@ -511,7 +515,7 @@ func (c *Cache) breakGroupSafe(ri int, groupIndex uint, newGroupShips uint) (int
|
||||
newGroup.Number = newGroupShips
|
||||
c.ShipGroupShipsNumber(sgi, c.ShipGroup(sgi).Number-newGroup.Number)
|
||||
newGroup.FleetID = nil
|
||||
return c.appendShipGroup(ri, &newGroup), nil
|
||||
return c.appendShipGroup(ri, &newGroup)
|
||||
}
|
||||
|
||||
// Internal funcs
|
||||
|
||||
Reference in New Issue
Block a user