revert me: default to allowing connecting players to start games

This commit is contained in:
Stephen McQuay 2013-11-14 00:18:46 -08:00
parent 2cbef76a37
commit 50868809bd
2 changed files with 8 additions and 16 deletions

View File

@ -13,7 +13,6 @@ import (
)
var addr = flag.String("addr", ":8666", "http service address")
var debug = flag.Bool("debug", false, "automatically create games if they don't exist")
var profile = flag.String("pprof", "", "if specified will run with pprof")
var netprofile = flag.Bool("netprof", false, "if specified will run with net/http/pprof")
var verbose = flag.Bool("verbose", false, "")

View File

@ -161,21 +161,14 @@ func addPlayer(ws *websocket.Conn) {
game := games.get(gid.Id)
if game == nil {
force := *debug
if force {
game = NewGame(
gid.Id,
float32(conf.Width),
float32(conf.Height),
conf.Tick,
)
go game.run()
games.add(game)
} else {
log.Printf("ERROR: game '%s' not found", gid.Id)
websocket.JSON.Send(ws, NewFailure("game 404"))
return
}
game = NewGame(
gid.Id,
float32(conf.Width),
float32(conf.Height),
conf.Tick,
)
go game.run()
games.add(game)
}
player_id := idg.Hash()