changed the stats payload

This commit is contained in:
Stephen McQuay 2014-01-23 23:03:21 -08:00
parent 7cb38a76aa
commit 29b078e637
1 changed files with 6 additions and 3 deletions

View File

@ -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
}