added ability to autovivify games in debug mode

This commit is contained in:
sm
2013-10-18 20:49:57 -07:00
parent 2edc7c61af
commit d19b3f71fa
4 changed files with 36 additions and 17 deletions
+2 -4
View File
@@ -99,11 +99,9 @@ func addPlayer(ws *websocket.Conn) {
return
}
games.Lock()
game, ok := games.m[gid.Id]
games.Unlock()
game, err := games.getOrCreate(gid.Id)
if !ok {
if err != nil {
log.Printf("ERROR: game %s not found", gid.Id)
websocket.JSON.Send(ws, NewFailure("game 404"))
return