Send roll event when player selects doubles in acey-deucey games
This commit is contained in:
parent
242b6132e6
commit
a5b4c03e9f
2 changed files with 14 additions and 2 deletions
5
event.go
5
event.go
|
@ -78,8 +78,9 @@ type EventBoard struct {
|
|||
|
||||
type EventRolled struct {
|
||||
Event
|
||||
Roll1 int
|
||||
Roll2 int
|
||||
Roll1 int
|
||||
Roll2 int
|
||||
Selected bool // Whether the roll is selected by the player (used in acey-deucey games).
|
||||
}
|
||||
|
||||
type EventFailedRoll struct {
|
||||
|
|
|
@ -249,6 +249,7 @@ func (s *server) listenWebSocket(address string) {
|
|||
func (s *server) handleLocal(conns chan net.Conn) {
|
||||
for {
|
||||
local, remote := net.Pipe()
|
||||
|
||||
conns <- local
|
||||
go s.handleConnection(remote)
|
||||
}
|
||||
|
@ -1351,6 +1352,16 @@ COMMANDS:
|
|||
clientGame.NextTurn(true)
|
||||
clientGame.Roll1, clientGame.Roll2 = doubles, doubles
|
||||
clientGame.Reroll = true
|
||||
|
||||
clientGame.eachClient(func(client *serverClient) {
|
||||
ev := &bgammon.EventRolled{
|
||||
Roll1: clientGame.Roll1,
|
||||
Roll2: clientGame.Roll2,
|
||||
Selected: true,
|
||||
}
|
||||
ev.Player = string(cmd.client.name)
|
||||
client.sendEvent(ev)
|
||||
})
|
||||
} else if clientGame.Acey && clientGame.Reroll {
|
||||
clientGame.NextTurn(true)
|
||||
clientGame.Roll1, clientGame.Roll2 = 0, 0
|
||||
|
|
Loading…
Reference in a new issue