take game id to start a new game instead of generating
This commit is contained in:
		| @@ -3,8 +3,6 @@ package lobby | |||||||
| import ( | import ( | ||||||
| 	"sync" | 	"sync" | ||||||
|  |  | ||||||
| 	"github.com/google/uuid" |  | ||||||
|  |  | ||||||
| 	"git.sunturtle.xyz/studio/shotgun/game" | 	"git.sunturtle.xyz/studio/shotgun/game" | ||||||
| 	"git.sunturtle.xyz/studio/shotgun/player" | 	"git.sunturtle.xyz/studio/shotgun/player" | ||||||
| 	"git.sunturtle.xyz/studio/shotgun/serve" | 	"git.sunturtle.xyz/studio/shotgun/serve" | ||||||
| @@ -35,8 +33,7 @@ func (l *Lobby) Game(id GameID) *game.Game { | |||||||
| // Start begins a new game in the lobby. | // Start begins a new game in the lobby. | ||||||
| // The caller must be able to distinguish the dealer's and challenger's conns | // The caller must be able to distinguish the dealer's and challenger's conns | ||||||
| // in order to provide correct game start DTOs to each. | // in order to provide correct game start DTOs to each. | ||||||
| func (l *Lobby) Start(dealer, challenger player.ID) GameID { | func (l *Lobby) Start(id GameID, dealer, challenger player.ID) GameID { | ||||||
| 	id := uuid.New() |  | ||||||
| 	g := game.New(dealer, challenger) | 	g := game.New(dealer, challenger) | ||||||
| 	l.mu.Lock() | 	l.mu.Lock() | ||||||
| 	defer l.mu.Unlock() | 	defer l.mu.Unlock() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user