Files
galaxy-game/pkg/schema/fbs/report/OtherGroup.go
T
Ilia Denisov 24c68e9846
Tests · UI / test (push) Has been cancelled
Tests · Go / test (pull_request) Successful in 2m6s
Tests · Go / test (push) Successful in 2m6s
Tests · Integration / integration (pull_request) Successful in 1m51s
Tests · UI / test (pull_request) Successful in 3m53s
feat(model+ui): F8-05 — race on OtherGroup, real attribution + N×M label
Issue #48 п.32 ("Stationed ship groups") shipped with a fragile race
fallback: when a foreign group sat on a non-`other`-kind planet the
inspector printed a generic "foreign" label, which collapsed the
race dropdown to a single uninformative bucket. The engine FBS
contract did not carry per-group race either, so live games hit the
same gap. This patch carries race authoritatively from the engine
through every layer down to the inspector.

Wire format & engine
- `pkg/schema/fbs/report.fbs`: add `race:string` to `OtherGroup` and
  `LocalGroup` (additive — old clients ignore).
- `pkg/schema/fbs/report/`: regenerated Go bindings.
- `ui/frontend/src/proto/galaxy/fbs/report/`: regenerated TS bindings.
- `pkg/model/report.OtherGroup.Race`: new field; carried through
  `LocalGroup` via the embedded `OtherGroup`.
- `pkg/transcoder/report.go`: encode + decode `race` on both
  `LocalGroup` and `OtherGroup`.
- `game/internal/controller/report.go.otherGroup`: set `v.Race`
  from `c.g.Race[c.RaceIndex(sg.OwnerID)].Name` so every emitted
  group — own or foreign — carries the resolved race name.

Legacy parser
- `tools/local-dev/legacy-report/parser.go`: capture the
  `<Race> Groups` header into `pendingOtherGroup.race`, fill local
  group `Race` from `p.rep.Race`, propagate both into the
  `report.OtherGroup` rows.
- Tests + smoke counts updated; regenerated `KNNTS{039,041}.json`
  fixtures so the synthetic loader carries the new field.

UI
- `ui/frontend/src/api/`: `ReportShipGroupBase.race` field;
  synthetic loader + FBS decoder populate it.
- `ui/frontend/src/lib/inspectors/planet/ship-groups.svelte`: the
  stationed-groups inspector picks race directly from
  `group.race` (own falls back to `localRace`, both finally to the
  `race.unknown` placeholder). The planet-owner / "foreign"
  heuristic is gone.
- Row label changes from "N ships mass M" to a compact
  `<class>` | `<N ×>` | `<mass>` three-column layout: the count
  cell is right-aligned tabular, the mass cell is right-aligned
  monospace + tabular, matching the inspector / calculator number
  conventions. Stale i18n keys removed
  (`ship_groups.row.count`, `.row.mass`, `.race.foreign`).
- All affected unit tests (8 files) carry the new `race` field.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 16:23:17 +02:00

218 lines
5.5 KiB
Go

// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package report
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type OtherGroup struct {
_tab flatbuffers.Table
}
func GetRootAsOtherGroup(buf []byte, offset flatbuffers.UOffsetT) *OtherGroup {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &OtherGroup{}
x.Init(buf, n+offset)
return x
}
func FinishOtherGroupBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
builder.Finish(offset)
}
func GetSizePrefixedRootAsOtherGroup(buf []byte, offset flatbuffers.UOffsetT) *OtherGroup {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &OtherGroup{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func FinishSizePrefixedOtherGroupBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
builder.FinishSizePrefixed(offset)
}
func (rcv *OtherGroup) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *OtherGroup) Table() flatbuffers.Table {
return rcv._tab
}
func (rcv *OtherGroup) Number() uint64 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.GetUint64(o + rcv._tab.Pos)
}
return 0
}
func (rcv *OtherGroup) MutateNumber(n uint64) bool {
return rcv._tab.MutateUint64Slot(4, n)
}
func (rcv *OtherGroup) Class() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
func (rcv *OtherGroup) Tech(obj *TechEntry, j int) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
x := rcv._tab.Vector(o)
x += flatbuffers.UOffsetT(j) * 4
x = rcv._tab.Indirect(x)
obj.Init(rcv._tab.Bytes, x)
return true
}
return false
}
func (rcv *OtherGroup) TechLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *OtherGroup) Cargo() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
func (rcv *OtherGroup) Load() float32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
return rcv._tab.GetFloat32(o + rcv._tab.Pos)
}
return 0.0
}
func (rcv *OtherGroup) MutateLoad(n float32) bool {
return rcv._tab.MutateFloat32Slot(12, n)
}
func (rcv *OtherGroup) Destination() uint64 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
return rcv._tab.GetUint64(o + rcv._tab.Pos)
}
return 0
}
func (rcv *OtherGroup) MutateDestination(n uint64) bool {
return rcv._tab.MutateUint64Slot(14, n)
}
func (rcv *OtherGroup) Origin() *uint64 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
if o != 0 {
v := rcv._tab.GetUint64(o + rcv._tab.Pos)
return &v
}
return nil
}
func (rcv *OtherGroup) MutateOrigin(n uint64) bool {
return rcv._tab.MutateUint64Slot(16, n)
}
func (rcv *OtherGroup) Range() *float32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(18))
if o != 0 {
v := rcv._tab.GetFloat32(o + rcv._tab.Pos)
return &v
}
return nil
}
func (rcv *OtherGroup) MutateRange(n float32) bool {
return rcv._tab.MutateFloat32Slot(18, n)
}
func (rcv *OtherGroup) Speed() float32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(20))
if o != 0 {
return rcv._tab.GetFloat32(o + rcv._tab.Pos)
}
return 0.0
}
func (rcv *OtherGroup) MutateSpeed(n float32) bool {
return rcv._tab.MutateFloat32Slot(20, n)
}
func (rcv *OtherGroup) Mass() float32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(22))
if o != 0 {
return rcv._tab.GetFloat32(o + rcv._tab.Pos)
}
return 0.0
}
func (rcv *OtherGroup) MutateMass(n float32) bool {
return rcv._tab.MutateFloat32Slot(22, n)
}
func (rcv *OtherGroup) Race() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(24))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
func OtherGroupStart(builder *flatbuffers.Builder) {
builder.StartObject(11)
}
func OtherGroupAddNumber(builder *flatbuffers.Builder, number uint64) {
builder.PrependUint64Slot(0, number, 0)
}
func OtherGroupAddClass(builder *flatbuffers.Builder, class flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(class), 0)
}
func OtherGroupAddTech(builder *flatbuffers.Builder, tech flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(tech), 0)
}
func OtherGroupStartTechVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func OtherGroupAddCargo(builder *flatbuffers.Builder, cargo flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(cargo), 0)
}
func OtherGroupAddLoad(builder *flatbuffers.Builder, load float32) {
builder.PrependFloat32Slot(4, load, 0.0)
}
func OtherGroupAddDestination(builder *flatbuffers.Builder, destination uint64) {
builder.PrependUint64Slot(5, destination, 0)
}
func OtherGroupAddOrigin(builder *flatbuffers.Builder, origin uint64) {
builder.PrependUint64(origin)
builder.Slot(6)
}
func OtherGroupAddRange(builder *flatbuffers.Builder, range_ float32) {
builder.PrependFloat32(range_)
builder.Slot(7)
}
func OtherGroupAddSpeed(builder *flatbuffers.Builder, speed float32) {
builder.PrependFloat32Slot(8, speed, 0.0)
}
func OtherGroupAddMass(builder *flatbuffers.Builder, mass float32) {
builder.PrependFloat32Slot(9, mass, 0.0)
}
func OtherGroupAddRace(builder *flatbuffers.Builder, race flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(10, flatbuffers.UOffsetT(race), 0)
}
func OtherGroupEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}