allow the control interface to specify game type
This commit is contained in:
+3
-3
@@ -24,8 +24,8 @@ func startGame(w http.ResponseWriter, req *http.Request) {
|
||||
requested_game_name := idg.Hash()
|
||||
width, height := float32(conf.Width), float32(conf.Height)
|
||||
obstacles := 0
|
||||
tick := conf.Tick
|
||||
maxPoints := conf.MaxPoints
|
||||
mode := "deathmatch"
|
||||
|
||||
// here we determine if we are going to run with defaults or pick them off
|
||||
// a posted json blob
|
||||
@@ -50,14 +50,14 @@ func startGame(w http.ResponseWriter, req *http.Request) {
|
||||
width = float32(cfg.Width)
|
||||
height = float32(cfg.Height)
|
||||
obstacles = cfg.Obstacles
|
||||
tick = cfg.Tick
|
||||
maxPoints = cfg.MaxPoints
|
||||
mode = cfg.Mode
|
||||
}
|
||||
|
||||
g := games.get(requested_game_name)
|
||||
if g == nil {
|
||||
log.Printf("Game '%s' non-existant; making it now", requested_game_name)
|
||||
g = NewGame(requested_game_name, width, height, obstacles, tick, maxPoints)
|
||||
g = NewGame(requested_game_name, width, height, obstacles, conf.Tick, maxPoints, mode)
|
||||
go g.run()
|
||||
games.add(g)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user