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 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 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 netprofile = flag.Bool("netprof", false, "if specified will run with net/http/pprof")
|
||||||
var verbose = flag.Bool("verbose", false, "")
|
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)
|
game := games.get(gid.Id)
|
||||||
if game == nil {
|
if game == nil {
|
||||||
force := *debug
|
game = NewGame(
|
||||||
if force {
|
gid.Id,
|
||||||
game = NewGame(
|
float32(conf.Width),
|
||||||
gid.Id,
|
float32(conf.Height),
|
||||||
float32(conf.Width),
|
conf.Tick,
|
||||||
float32(conf.Height),
|
)
|
||||||
conf.Tick,
|
go game.run()
|
||||||
)
|
games.add(game)
|
||||||
go game.run()
|
|
||||||
games.add(game)
|
|
||||||
} else {
|
|
||||||
log.Printf("ERROR: game '%s' not found", gid.Id)
|
|
||||||
websocket.JSON.Send(ws, NewFailure("game 404"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
player_id := idg.Hash()
|
player_id := idg.Hash()
|
||||||
|
Loading…
Reference in New Issue
Block a user