added bw calcs
unfortunately there is an issue with how these are calculated, and they don't decrease as things quiet down. Well, the bad numbers are their for your consumption, and should Just Work TM when appropriate changes in bitbucket.org/smcquay/bandwith land. And they will. But I'm tired now.
This commit is contained in:
+9
-3
@@ -153,7 +153,8 @@ func addPlayer(ws *websocket.Conn) {
|
||||
|
||||
game := games.get(gid.Id)
|
||||
if game == nil {
|
||||
game = NewGame(
|
||||
var err error
|
||||
game, err = NewGame(
|
||||
gid.Id,
|
||||
float32(conf.Width),
|
||||
float32(conf.Height),
|
||||
@@ -162,6 +163,11 @@ func addPlayer(ws *websocket.Conn) {
|
||||
conf.MaxPoints,
|
||||
"",
|
||||
)
|
||||
if err != nil {
|
||||
log.Printf("problem creating game: %s", gid.Id)
|
||||
websocket.JSON.Send(ws, NewFailure("game creation error"))
|
||||
return
|
||||
}
|
||||
go game.run()
|
||||
games.add(game)
|
||||
}
|
||||
@@ -230,7 +236,7 @@ func addPlayer(ws *websocket.Conn) {
|
||||
}
|
||||
}
|
||||
|
||||
p := NewPlayer(player_id, ws)
|
||||
p := NewPlayer(player_id, ws, game.bw)
|
||||
log.Printf("%s: made a player: %s", gid.Id, p.Id)
|
||||
|
||||
convertedStats := map[string]Stats{}
|
||||
@@ -285,7 +291,7 @@ func addPlayer(ws *websocket.Conn) {
|
||||
gid.Id,
|
||||
)
|
||||
case "spectator":
|
||||
s := NewSpectator(player_id, ws)
|
||||
s := NewSpectator(player_id, ws, game.bw)
|
||||
log.Printf("%s, %s: about to register this spectator", gid.Id, s.Id)
|
||||
game.sregister <- s
|
||||
log.Printf("%s, %s: registered spectator", gid.Id, s.Id)
|
||||
|
||||
Reference in New Issue
Block a user