From db28bfea110c8946a5a8776f4b77e8885b19070a Mon Sep 17 00:00:00 2001 From: Stephen McQuay Date: Sat, 26 Apr 2014 08:56:40 -0700 Subject: [PATCH] Renamed obstacle -> obstacle count --- config.go | 44 ++++++++++++++++++++++---------------------- control.go | 6 +++--- protocol.go | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/config.go b/config.go index 574a29b..659a957 100644 --- a/config.go +++ b/config.go @@ -15,24 +15,24 @@ import ( // ways (json POSTed to server, config file, constants) and are typically owned // by a Controller. type Config struct { - Tick int `json:"tick"` // ms - Timescale float32 `json:"timescale"` - Delta float32 `json:"delta"` - Width int `json:"width"` - Height int `json:"height"` - Obstacles int `json:"obstacles"` - MaxPoints int `json:"max_points"` - Mode string `json:"mode"` + Tick int `json:"tick"` // ms + Timescale float32 `json:"timescale"` + Delta float32 `json:"delta"` + Width int `json:"width"` + Height int `json:"height"` + ObstacleCount int `json:"obstacle_count"` + MaxPoints int `json:"max_points"` + Mode string `json:"mode"` } const ( - TICK = 60 // ms, this is how often physics is updated - TIMESCALE = 1.0 // this tweaks the temporal duration of a TICK - WIDTH = 800 - HEIGHT = 550 - OBSTACLES = 10 - MAX_POINTS = 500 // allowing for 50 pts in every category - DEFAULT_MODE = "deathmatch" + TICK = 60 // ms, this is how often physics is updated + TIMESCALE = 1.0 // this tweaks the temporal duration of a TICK + WIDTH = 800 + HEIGHT = 550 + OBSTACLE_COUNT = 5 + MAX_POINTS = 500 // allowing for 50 pts in every category + DEFAULT_MODE = "deathmatch" ) // LoadConfig takes the location of a json file that contains values desired to @@ -41,13 +41,13 @@ const ( // followed by constants defined above. func LoadConfig(filename string) (Config, error) { c := Config{ - Tick: TICK, - Timescale: TIMESCALE, - Width: WIDTH, - Height: HEIGHT, - Obstacles: OBSTACLES, - MaxPoints: MAX_POINTS, - Mode: DEFAULT_MODE, + Tick: TICK, + Timescale: TIMESCALE, + Width: WIDTH, + Height: HEIGHT, + ObstacleCount: OBSTACLE_COUNT, + MaxPoints: MAX_POINTS, + Mode: DEFAULT_MODE, } u, err := user.Current() if err != nil { diff --git a/control.go b/control.go index 2f9d2fb..3593446 100644 --- a/control.go +++ b/control.go @@ -63,7 +63,7 @@ func (c *Controller) StartGame(w http.ResponseWriter, req *http.Request) { requested_game_name := c.Idg.Hash() width, height := float32(c.Conf.Width), float32(c.Conf.Height) - obstacles := 0 + obstacleCount := 0 maxPoints := c.Conf.MaxPoints mode := "deathmatch" @@ -89,7 +89,7 @@ func (c *Controller) StartGame(w http.ResponseWriter, req *http.Request) { requested_game_name = cfg.Name width = float32(cfg.Width) height = float32(cfg.Height) - obstacles = cfg.Obstacles + obstacleCount = cfg.ObstacleCount maxPoints = cfg.MaxPoints mode = cfg.Mode } @@ -98,7 +98,7 @@ func (c *Controller) StartGame(w http.ResponseWriter, req *http.Request) { if g == nil { log.Printf("Game '%s' non-existant; making it now", requested_game_name) var err error - g, err = NewGame(requested_game_name, width, height, obstacles, c.Conf.Tick, maxPoints, mode) + g, err = NewGame(requested_game_name, width, height, obstacleCount, c.Conf.Tick, maxPoints, mode) if err != nil { log.Printf("problem creating game: %s: %s", requested_game_name, err) b, _ := json.Marshal(NewFailure("game creation failure")) diff --git a/protocol.go b/protocol.go index b32b5e8..7653536 100644 --- a/protocol.go +++ b/protocol.go @@ -177,7 +177,7 @@ func (c *Controller) AddPlayer(ws *websocket.Conn) { gid.Id, float32(c.Conf.Width), float32(c.Conf.Height), - c.Conf.Obstacles, + c.Conf.ObstacleCount, c.Conf.Tick, c.Conf.MaxPoints, "",