changed the stats payload
This commit is contained in:
parent
7cb38a76aa
commit
29b078e637
9
robot.go
9
robot.go
@ -118,7 +118,10 @@ func (r *robot) negociate() (err error) {
|
||||
log.Printf("%s: handshake: %+v", r.name, handshake)
|
||||
}
|
||||
|
||||
dstats := map[string]Stats{}
|
||||
dstats := struct {
|
||||
Stats map[string]Stats `json:"stats"`
|
||||
Type string `json:"type"`
|
||||
}{}
|
||||
err = websocket.JSON.Receive(r.ws, &dstats)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -126,11 +129,11 @@ func (r *robot) negociate() (err error) {
|
||||
|
||||
// this player only ever has one robot, so we're just picking off our own
|
||||
// stats
|
||||
_, ok := dstats[r.name]
|
||||
_, ok := dstats.Stats[r.name]
|
||||
if !ok {
|
||||
return errors.New("my name not found in stats map")
|
||||
}
|
||||
r.statsCalculated = dstats[r.name]
|
||||
r.statsCalculated = dstats.Stats[r.name]
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user