refactor: group uuid instead of index

This commit is contained in:
IliaDenisov
2026-02-10 20:54:43 +03:00
parent 6c8384ce7a
commit 56998d4c2d
26 changed files with 333 additions and 363 deletions
+6 -6
View File
@@ -69,14 +69,14 @@ func (c *Cache) cacheShipsAndGroups() {
} else {
c.cacheShipClassByShipGroupIndex = make(map[int]*game.ShipType)
}
for groupIndex := range c.g.ShipGroups {
ri := c.RaceIndex(c.g.ShipGroups[groupIndex].OwnerID)
c.cacheRaceIndexByShipGroupIndex[groupIndex] = ri
sti, ok := ShipClassIndex(c.g, ri, c.g.ShipGroups[groupIndex].TypeID)
for sgi := range c.g.ShipGroups {
ri := c.RaceIndex(c.g.ShipGroups[sgi].OwnerID)
c.cacheRaceIndexByShipGroupIndex[sgi] = ri
sci, ok := ShipClassIndex(c.g, ri, c.g.ShipGroups[sgi].TypeID)
if !ok {
panic(fmt.Sprintf("CollectPlanetGroups: ship class not found for race=%q group=%v", c.g.Race[ri].Name, c.g.ShipGroups[groupIndex].Index))
panic(fmt.Sprintf("CollectPlanetGroups: ship class not found for race=%q group=%v", c.g.Race[ri].Name, c.g.ShipGroups[sgi].ID))
}
c.cacheShipClassByShipGroupIndex[groupIndex] = &c.g.Race[ri].ShipTypes[sti]
c.cacheShipClassByShipGroupIndex[sgi] = &c.g.Race[ri].ShipTypes[sci]
}
}