refactor: planet owner
This commit is contained in:
@@ -71,7 +71,7 @@ func buildGameOnMap(races []string, m generator.Map) (*game.Game, error) {
|
||||
gameMap.Planet = append(gameMap.Planet, NewPlanet(
|
||||
planetCount,
|
||||
m.HomePlanets[i].HW.RandomName(),
|
||||
raceID,
|
||||
&raceID,
|
||||
m.HomePlanets[i].HW.Position.X,
|
||||
m.HomePlanets[i].HW.Position.Y,
|
||||
m.HomePlanets[i].HW.Size,
|
||||
@@ -85,7 +85,7 @@ func buildGameOnMap(races []string, m generator.Map) (*game.Game, error) {
|
||||
gameMap.Planet = append(gameMap.Planet, NewPlanet(
|
||||
planetCount,
|
||||
m.HomePlanets[i].DW[dw].RandomName(),
|
||||
raceID,
|
||||
&raceID,
|
||||
m.HomePlanets[i].DW[dw].Position.X,
|
||||
m.HomePlanets[i].DW[dw].Position.Y,
|
||||
m.HomePlanets[i].DW[dw].Size,
|
||||
@@ -107,7 +107,7 @@ func buildGameOnMap(races []string, m generator.Map) (*game.Game, error) {
|
||||
gameMap.Planet = append(gameMap.Planet, NewPlanet(
|
||||
planetCount,
|
||||
m.FreePlanets[i].RandomName(),
|
||||
uuid.Nil,
|
||||
&uuid.Nil,
|
||||
m.FreePlanets[i].Position.X,
|
||||
m.FreePlanets[i].Position.Y,
|
||||
m.FreePlanets[i].Size,
|
||||
@@ -128,23 +128,20 @@ func buildGameOnMap(races []string, m generator.Map) (*game.Game, error) {
|
||||
return g, nil
|
||||
}
|
||||
|
||||
func NewPlanet(num uint, name string, owner uuid.UUID, x, y, size, pop, ind, res float64, prod game.Production) game.Planet {
|
||||
func NewPlanet(num uint, name string, owner *uuid.UUID, x, y, size, pop, ind, res float64, prod game.Production) game.Planet {
|
||||
if owner != nil && *owner == uuid.Nil {
|
||||
owner = nil
|
||||
}
|
||||
return game.Planet{
|
||||
Owner: owner,
|
||||
PlanetReport: game.PlanetReport{
|
||||
UninhabitedPlanet: game.UninhabitedPlanet{
|
||||
UnidentifiedPlanet: game.UnidentifiedPlanet{
|
||||
X: game.F(x),
|
||||
Y: game.F(y),
|
||||
Number: num,
|
||||
},
|
||||
Size: game.F(size),
|
||||
Name: name,
|
||||
Resources: game.F(res),
|
||||
},
|
||||
Population: game.F(pop),
|
||||
Industry: game.F(ind),
|
||||
Production: prod,
|
||||
},
|
||||
Owner: owner,
|
||||
X: game.F(x),
|
||||
Y: game.F(y),
|
||||
Number: num,
|
||||
Size: game.F(size),
|
||||
Name: name,
|
||||
Resources: game.F(res),
|
||||
Population: game.F(pop),
|
||||
Industry: game.F(ind),
|
||||
Production: prod,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user