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
+1 -7
View File
@@ -18,13 +18,7 @@ func (h JsonHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
func startGame(w http.ResponseWriter, req *http.Request) {
log.Println("asked to create a game")
new_game_name := idg.Hash()
_g := NewGame(new_game_name, *width, *height)
go _g.run()
games.Lock()
games.m[new_game_name] = _g
games.Unlock()
games.getOrCreate(new_game_name)
game_json := struct {
Id string `json:"id"`