lockstep changes for server sending max points

This commit is contained in:
Stephen McQuay 2014-01-22 22:14:02 -08:00
parent 787bf9b435
commit b964a14bba
3 changed files with 9 additions and 6 deletions

View File

@ -15,10 +15,13 @@ type BoardSize struct {
Height float32 `json:"height"`
}
// This is kind of misused here; we set Name, but expect to get the other
// values back from the server
type GameParam struct {
BoardSize BoardSize `json:"boardsize"`
name string
Type string `json:"type"`
MaxPoints int `json:"max_points"`
Name string `json:"name"`
Type string `json:"type"`
}
type StatsRequest struct {

View File

@ -48,7 +48,7 @@ func main() {
port: *port,
name: fmt.Sprintf("%s%d", *botname, i),
game: GameParam{
name: gameName,
Name: gameName,
},
// XXX: update with missing fields
stats: StatsRequest{

View File

@ -45,7 +45,7 @@ type robot struct {
func (r *robot) negociate() (err error) {
if *verbose {
log.Printf("%s: trying to connect to game '%s'", r.name, r.game.name)
log.Printf("%s: trying to connect to game '%s'", r.name, r.game.Name)
}
r.ws, err = connect(r.server, r.port)
if err != nil {
@ -55,7 +55,7 @@ func (r *robot) negociate() (err error) {
err = websocket.JSON.Send(r.ws, struct {
Id string `json:"id"`
}{
r.game.name,
r.game.Name,
})
if err != nil {
return err
@ -94,7 +94,7 @@ func (r *robot) negociate() (err error) {
}
conf := ClientConfig{
ID: r.game.name,
ID: r.game.Name,
Stats: map[string]StatsRequest{
r.name: r.stats,
},