wip: generate report

This commit is contained in:
Ilia Denisov
2026-02-03 23:41:18 +02:00
parent a567229f8a
commit adbe605783
36 changed files with 1037 additions and 391 deletions
+13 -9
View File
@@ -50,19 +50,23 @@ func (c *Cache) FleetState(fleetID uuid.UUID) (game.ShipGroupState, *uint, *game
}
// TODO: Hello! Wanna know fleet's speed? Good. Implement & test this func first.
func (c *Cache) FleetSpeed(fl game.Fleet) float64 {
result := math.MaxFloat64
for sg := range c.ShipGroupsIndex() {
if c.ShipGroup(sg).FleetID == nil || *c.ShipGroup(sg).FleetID != fl.ID {
func (c *Cache) FleetSpeedAndMass(fi int) (float64, float64) {
c.validateFleetIndex(fi)
speed := math.MaxFloat64
mass := 0.
for sgi := range c.ShipGroupsIndex() {
if c.ShipGroup(sgi).FleetID == nil || *c.ShipGroup(sgi).FleetID != c.g.Fleets[fi].ID {
continue
}
st := c.ShipGroupShipClass(sg)
typeSpeed := c.ShipGroup(sg).Speed(st)
if typeSpeed < result {
result = typeSpeed
sg := c.ShipGroup(sgi)
st := c.ShipGroupShipClass(sgi)
typeSpeed := sg.Speed(st)
if typeSpeed < speed {
speed = typeSpeed
}
mass += sg.FullMass(st)
}
return result
return speed, mass
}
func (c *Controller) JoinShipGroupToFleet(raceName, fleetName string, group, count uint) error {