Explorar o código

Minor bug fixes

Ronald Peterson %!s(int64=10) %!d(string=hai) anos
pai
achega
2d7dc1be4b
Modificáronse 2 ficheiros con 4 adicións e 3 borrados
  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 != "" {