Fix sending roll events
This commit is contained in:
parent
9b8b1767eb
commit
e8fb2fd4d2
1 changed files with 12 additions and 9 deletions
|
@ -814,6 +814,18 @@ COMMANDS:
|
|||
continue
|
||||
}
|
||||
|
||||
clientGame.eachClient(func(client *serverClient) {
|
||||
ev := &bgammon.EventRolled{
|
||||
Roll1: clientGame.Roll1,
|
||||
Roll2: clientGame.Roll2,
|
||||
}
|
||||
ev.Player = string(cmd.client.name)
|
||||
if clientGame.Turn == 0 && client.playerNumber == 2 {
|
||||
ev.Roll1, ev.Roll2 = ev.Roll2, ev.Roll1
|
||||
}
|
||||
client.sendEvent(ev)
|
||||
})
|
||||
|
||||
if clientGame.Turn == 0 && clientGame.Roll1 != 0 && clientGame.Roll2 != 0 {
|
||||
if clientGame.Roll1 > clientGame.Roll2 {
|
||||
clientGame.Turn = 1
|
||||
|
@ -825,15 +837,6 @@ COMMANDS:
|
|||
}
|
||||
}
|
||||
clientGame.eachClient(func(client *serverClient) {
|
||||
ev := &bgammon.EventRolled{
|
||||
Roll1: clientGame.Roll1,
|
||||
Roll2: clientGame.Roll2,
|
||||
}
|
||||
ev.Player = string(cmd.client.name)
|
||||
if client.playerNumber == 2 {
|
||||
ev.Roll1, ev.Roll2 = ev.Roll2, ev.Roll1
|
||||
}
|
||||
client.sendEvent(ev)
|
||||
if clientGame.Turn != 0 || !client.json {
|
||||
clientGame.sendBoard(client)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue