Selaa lähdekoodia

Minor bug fixes

Ronald Peterson 10 vuotta sitten
vanhempi
commit
2d7dc1be4b
2 muutettua tiedostoa jossa 4 lisäystä ja 3 poistoa
  1. 2 1
      games/game.go
  2. 2 2
      urlrouter.go

+ 2 - 1
games/game.go

@@ -19,11 +19,12 @@ type Game struct {
 }
 
 func NewGame(cols, rows int) *Game {
-	createTime := time.Now().UnixNano() / 1000
+	createTime := time.Now().Unix()
 
 	game := &Game{
 		StartTime: createTime,
 		Board:     board.New(cols, rows),
+		Players:	make([]*player.Player, 0),
 	}
 
 	return game

+ 2 - 2
urlrouter.go

@@ -53,8 +53,8 @@ func listGames(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
 }
 
 func createGame(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
-	xString := ps.ByName("x")
-	yString := ps.ByName("y")
+	xString := ps.ByName("cols")
+	yString := ps.ByName("rows")
 	var game *games.Game
 
 	if xString != "" && yString != "" {