package report import ( "encoding/json" u "galaxy/util" "github.com/google/uuid" ) type Float float64 func F(v float64) Float { return Float(u.Fixed3(v)) } func (f Float) F() float64 { return float64(f) } type Report struct { Version uint `json:"version"` Turn uint `json:"turn"` Width uint32 `json:"mapWidth"` Height uint32 `json:"mapHeight"` PlanetCount uint32 `json:"mapPlanets"` Race string `json:"race"` RaceID uuid.UUID `json:"-"` Votes Float `json:"votes"` VoteFor string `json:"voteFor"` Player []Player `json:"player"` LocalScience []Science `json:"localScience,omitempty"` OtherScience []OtherScience `json:"otherScience,omitempty"` LocalShipClass []ShipClass `json:"localShipClass,omitempty"` OtherShipClass []OthersShipClass `json:"otherShipClass,omitempty"` Battle []BattleSummary `json:"battle,omitempty"` Bombing []*Bombing `json:"bombing,omitempty"` IncomingGroup []IncomingGroup `json:"incomingGroup,omitempty"` LocalPlanet []LocalPlanet `json:"localPlanet,omitempty"` ShipProduction []ShipProduction `json:"shipProduction,omitempty"` Route []Route `json:"route,omitempty"` OtherPlanet []OtherPlanet `json:"otherPlanet,omitempty"` UninhabitedPlanet []UninhabitedPlanet `json:"uninhabitedPlanet,omitempty"` UnidentifiedPlanet []UnidentifiedPlanet `json:"unidentifiedPlanet,omitempty"` LocalFleet []LocalFleet `json:"localFleet,omitempty"` LocalGroup []LocalGroup `json:"localGroup,omitempty"` OtherGroup []OtherGroup `json:"otherGroup,omitempty"` UnidentifiedGroup []UnidentifiedGroup `json:"unidentifiedGroup,omitempty"` OnPlanetGroupCache map[uint][]int `json:"-"` InSpaceGroupRangeCache map[int]map[uint]float64 `json:"-"` } type Route struct { Planet uint `json:"planet"` Route map[uint]string `json:"route"` } type Player struct { ID uuid.UUID `json:"-"` Name string `json:"name"` Drive Float `json:"drive"` Weapons Float `json:"weapons"` Shields Float `json:"shields"` Cargo Float `json:"cargo"` Population Float `json:"population"` Industry Float `json:"industry"` Planets uint16 `json:"planets"` Relation string `json:"relation"` Votes Float `json:"votes"` Extinct bool `json:"extinct"` } func (r Report) MarshalBinary() (data []byte, err error) { return json.Marshal(&r) } func (r *Report) UnmarshalBinary(data []byte) error { return json.Unmarshal(data, r) }