revert me: default to allowing connecting players to start games
This commit is contained in:
parent
2cbef76a37
commit
50868809bd
1
main.go
1
main.go
@ -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, "")
|
||||
|
23
protocol.go
23
protocol.go
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user