refactor: group uuid instead of index
This commit is contained in:
@@ -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]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user