fix: production with free P.I.

This commit is contained in:
Ilia Denisov
2026-02-06 21:43:47 +02:00
parent 3c4968ab8f
commit 43ba5eb07c
7 changed files with 62 additions and 54 deletions
+5 -12
View File
@@ -423,7 +423,7 @@ func (c *Cache) ReportLocalPlanet(ri int, rep *mr.Report) {
}
sliceIndexValidate(&rep.LocalPlanet, i)
c.localPlanet(&rep.LocalPlanet[i], p, rep)
c.localPlanet(&rep.LocalPlanet[i], p)
// rep.LocalPlanet[i].UnidentifiedPlanet.Number = p.Number
// rep.LocalPlanet[i].UnidentifiedPlanet.X = mr.F(p.X.F())
// rep.LocalPlanet[i].UnidentifiedPlanet.Y = mr.F(p.Y.F())
@@ -466,7 +466,7 @@ func (c *Cache) ReportOtherPlanet(ri int, rep *mr.Report) {
}
sliceIndexValidate(&rep.OtherPlanet, i)
c.localPlanet(&rep.OtherPlanet[i].LocalPlanet, p, rep)
c.localPlanet(&rep.OtherPlanet[i].LocalPlanet, p)
rep.OtherPlanet[i].Owner = c.g.Race[c.RaceIndex(*p.Owner)].Name
i++
}
@@ -728,21 +728,14 @@ func (c *Cache) otherGroup(v *mr.OtherGroup, sg *game.ShipGroup, st *game.ShipTy
v.Mass = mr.F(st.EmptyMass())
}
func (c *Cache) localPlanet(v *mr.LocalPlanet, p *game.Planet, rep *mr.Report) {
func (c *Cache) localPlanet(v *mr.LocalPlanet, p *game.Planet) {
uninhabitedPlanet(&v.UninhabitedPlanet, p)
v.Industry = mr.F(p.Industry.F())
v.Population = mr.F(p.Population.F())
v.Colonists = mr.F(p.Colonists.F())
v.Production = c.PlanetProductionDisplayName(p.Number)
v.FreeIndustry = mr.F(p.ProductionCapacity())
for _, sgi := range rep.OnPlanetGroupCache[p.Number] {
sg := c.ShipGroup(sgi)
if sg.StateUpgrade == nil {
break
}
// between-turn report: ships upgrading on the planet decreases free indistrial potential
v.FreeIndustry -= mr.F(sg.StateUpgrade.Cost())
}
// between-turn report: ships upgrading on the planet decreases free indistrial potential
v.FreeIndustry = mr.F(c.PlanetProductionCapacity(p.Number))
}
func uninhabitedPlanet(v *mr.UninhabitedPlanet, p *game.Planet) {