Add setting for traditional opponent move space numbers
This commit is contained in:
parent
eacc21fcf3
commit
09878764aa
6 changed files with 35 additions and 30 deletions
15
event.go
15
event.go
|
@ -121,13 +121,14 @@ type EventWin struct {
|
|||
|
||||
type EventSettings struct {
|
||||
Event
|
||||
AutoPlay bool
|
||||
Highlight bool
|
||||
Pips bool
|
||||
Moves bool
|
||||
Flip bool
|
||||
Advanced bool
|
||||
Speed int8
|
||||
AutoPlay bool
|
||||
Highlight bool
|
||||
Pips bool
|
||||
Moves bool
|
||||
Flip bool
|
||||
Traditional bool
|
||||
Advanced bool
|
||||
Speed int8
|
||||
}
|
||||
|
||||
type EventReplay struct {
|
||||
|
|
4
go.mod
4
go.mod
|
@ -32,13 +32,13 @@ require (
|
|||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/rivo/uniseg v0.4.6 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
|
||||
github.com/vanng822/css v1.0.1 // indirect
|
||||
github.com/vanng822/go-premailer v1.20.2 // indirect
|
||||
golang.org/x/crypto v0.19.0 // indirect
|
||||
golang.org/x/net v0.20.0 // indirect
|
||||
golang.org/x/net v0.21.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
)
|
||||
|
|
8
go.sum
8
go.sum
|
@ -78,8 +78,8 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6
|
|||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.6 h1:Sovz9sDSwbOz9tgUy8JpT+KgCkPYJEN/oYzlJiYTNLg=
|
||||
github.com/rivo/uniseg v0.4.6/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
|
@ -123,8 +123,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
|||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
|
||||
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
|
||||
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
|
|
|
@ -6,13 +6,14 @@ type account struct {
|
|||
username []byte
|
||||
password []byte
|
||||
|
||||
autoplay bool
|
||||
highlight bool
|
||||
pips bool
|
||||
moves bool
|
||||
flip bool
|
||||
advanced bool
|
||||
speed int8
|
||||
autoplay bool
|
||||
highlight bool
|
||||
pips bool
|
||||
moves bool
|
||||
flip bool
|
||||
traditional bool
|
||||
advanced bool
|
||||
speed int8
|
||||
|
||||
casual *clientRating
|
||||
competitive *clientRating
|
||||
|
|
|
@ -52,6 +52,7 @@ CREATE TABLE account (
|
|||
pips smallint NOT NULL DEFAULT 1,
|
||||
moves smallint NOT NULL DEFAULT 0,
|
||||
flip smallint NOT NULL DEFAULT 0,
|
||||
traditional smallint NOT NULL DEFAULT 0,
|
||||
advanced smallint NOT NULL DEFAULT 0,
|
||||
speed smallint NOT NULL DEFAULT 1
|
||||
);
|
||||
|
@ -343,8 +344,8 @@ func accountByID(id int) (*account, error) {
|
|||
casual: &clientRating{},
|
||||
competitive: &clientRating{},
|
||||
}
|
||||
var autoplay, highlight, pips, moves, flip, advanced int
|
||||
err = tx.QueryRow(context.Background(), "SELECT id, email, username, password, autoplay, highlight, pips, moves, flip, advanced, speed, casual_backgammon_single, casual_backgammon_multi, casual_acey_single, casual_acey_multi, casual_tabula_single, casual_tabula_multi, rated_backgammon_single, rated_backgammon_multi, rated_acey_single, rated_acey_multi, rated_tabula_single, rated_tabula_multi FROM account WHERE id = $1", id).Scan(&a.id, &a.email, &a.username, &a.password, &autoplay, &highlight, &pips, &moves, &flip, &advanced, &a.speed, &a.casual.backgammonSingle, &a.casual.backgammonMulti, &a.casual.aceySingle, &a.casual.aceyMulti, &a.casual.tabulaSingle, &a.casual.tabulaMulti, &a.competitive.backgammonSingle, &a.competitive.backgammonMulti, &a.competitive.aceySingle, &a.competitive.aceyMulti, &a.competitive.tabulaSingle, &a.competitive.tabulaMulti)
|
||||
var autoplay, highlight, pips, moves, flip, traditional, advanced int
|
||||
err = tx.QueryRow(context.Background(), "SELECT id, email, username, password, autoplay, highlight, pips, moves, flip, traditional, advanced, speed, casual_backgammon_single, casual_backgammon_multi, casual_acey_single, casual_acey_multi, casual_tabula_single, casual_tabula_multi, rated_backgammon_single, rated_backgammon_multi, rated_acey_single, rated_acey_multi, rated_tabula_single, rated_tabula_multi FROM account WHERE id = $1", id).Scan(&a.id, &a.email, &a.username, &a.password, &autoplay, &highlight, &pips, &moves, &flip, &traditional, &advanced, &a.speed, &a.casual.backgammonSingle, &a.casual.backgammonMulti, &a.casual.aceySingle, &a.casual.aceyMulti, &a.casual.tabulaSingle, &a.casual.tabulaMulti, &a.competitive.backgammonSingle, &a.competitive.backgammonMulti, &a.competitive.aceySingle, &a.competitive.aceyMulti, &a.competitive.tabulaSingle, &a.competitive.tabulaMulti)
|
||||
if err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
@ -353,6 +354,7 @@ func accountByID(id int) (*account, error) {
|
|||
a.pips = pips == 1
|
||||
a.moves = moves == 1
|
||||
a.flip = flip == 1
|
||||
a.traditional = traditional == 1
|
||||
a.advanced = advanced == 1
|
||||
return a, nil
|
||||
}
|
||||
|
|
|
@ -189,13 +189,14 @@ COMMANDS:
|
|||
if cmd.client.account != nil {
|
||||
a := cmd.client.account
|
||||
cmd.client.sendEvent(&bgammon.EventSettings{
|
||||
AutoPlay: a.autoplay,
|
||||
Highlight: a.highlight,
|
||||
Pips: a.pips,
|
||||
Moves: a.moves,
|
||||
Flip: a.flip,
|
||||
Advanced: a.advanced,
|
||||
Speed: a.speed,
|
||||
AutoPlay: a.autoplay,
|
||||
Highlight: a.highlight,
|
||||
Pips: a.pips,
|
||||
Moves: a.moves,
|
||||
Flip: a.flip,
|
||||
Traditional: a.traditional,
|
||||
Advanced: a.advanced,
|
||||
Speed: a.speed,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1110,7 +1111,7 @@ COMMANDS:
|
|||
}
|
||||
|
||||
name := string(bytes.ToLower(params[0]))
|
||||
settings := []string{"autoplay", "highlight", "pips", "moves", "flip", "advanced", "speed"}
|
||||
settings := []string{"autoplay", "highlight", "pips", "moves", "flip", "traditional", "advanced", "speed"}
|
||||
var found bool
|
||||
for i := range settings {
|
||||
if name == settings[i] {
|
||||
|
|
Loading…
Reference in a new issue