refactor: planet owner

This commit is contained in:
Ilia Denisov
2026-02-04 19:26:17 +02:00
parent 6a603ea9ad
commit c1d397c993
17 changed files with 170 additions and 183 deletions
+1 -2
View File
@@ -4,7 +4,6 @@ import (
"math"
"slices"
"github.com/google/uuid"
e "github.com/iliadenisov/galaxy/internal/error"
"github.com/iliadenisov/galaxy/internal/model/game"
)
@@ -31,7 +30,7 @@ func (c *Cache) UpgradeGroup(ri int, groupIndex uint, techInput string, limitShi
}
p := c.MustPlanet(sg.Destination)
if p.Owner != uuid.Nil && p.Owner != c.g.Race[ri].ID {
if p.Owned() && !p.OwnedBy(c.g.Race[ri].ID) {
return e.NewEntityNotOwnedError("planet #%d for upgrade group #%d", p.Number, groupIndex)
}