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
+4 -4
View File
@@ -105,10 +105,10 @@ func (t Tech) String() string {
}
type ShipGroup struct {
Index uint `json:"index"` // FIXME: use UUID for Group Index (ordered)
OwnerID uuid.UUID `json:"ownerId"` // Race link
TypeID uuid.UUID `json:"typeId"` // ShipType link
FleetID *uuid.UUID `json:"fleetId,omitempty"` // Fleet link
ID uuid.UUID `json:"id"`
OwnerID uuid.UUID `json:"ownerId"` // Race reference
TypeID uuid.UUID `json:"typeId"` // ShipType reference
FleetID *uuid.UUID `json:"fleetId,omitempty"` // Fleet reference
Number uint `json:"number"` // Number (quantity) ships of specific ShipType
CargoType *CargoType `json:"loadType,omitempty"` //
Load Float `json:"load"` // Cargo loaded - "Масса груза"
+2 -2
View File
@@ -162,7 +162,7 @@ func TestShipGroupEqual(t *testing.T) {
mat := game.CargoMaterial
cap := game.CargoCapital
left := &game.ShipGroup{
Index: 1,
ID: uuid.New(),
Number: 1,
OwnerID: uuid.New(),
@@ -241,7 +241,7 @@ func TestShipGroupEqual(t *testing.T) {
// non-essential properties
right = *left
left.Index = 2
left.ID = uuid.New()
assert.True(t, left.Equal(right))
// dirty hack to equalize loads
+5 -3
View File
@@ -1,5 +1,7 @@
package report
import "github.com/google/uuid"
type ShipClass struct {
Name string `json:"name"`
Drive Float `json:"drive"`
@@ -34,9 +36,9 @@ type IncomingGroup struct {
type LocalGroup struct {
OtherGroup
Index uint `json:"index"`
State string `json:"state"`
Fleet *string `json:"fleet"`
ID uuid.UUID `json:"id"`
State string `json:"state"`
Fleet *string `json:"fleet"`
}
type OtherGroup struct {