changed the stats payload

This commit is contained in:
Stephen McQuay 2014-01-23 23:03:21 -08:00
parent 7cb38a76aa
commit 29b078e637

View File

@ -118,7 +118,10 @@ func (r *robot) negociate() (err error) {
log.Printf("%s: handshake: %+v", r.name, handshake) 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) err = websocket.JSON.Receive(r.ws, &dstats)
if err != nil { if err != nil {
return err 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 // this player only ever has one robot, so we're just picking off our own
// stats // stats
_, ok := dstats[r.name] _, ok := dstats.Stats[r.name]
if !ok { if !ok {
return errors.New("my name not found in stats map") return errors.New("my name not found in stats map")
} }
r.statsCalculated = dstats[r.name] r.statsCalculated = dstats.Stats[r.name]
return nil return nil
} }