Skip to content

Commit

Permalink
fix country swap bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nhanb committed Jun 23, 2023
1 parent 4eab1ca commit 9494397
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tcl/main.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,17 @@ ttk::button .n.m.buttons.reset -text "↶ Reset scores" -command {
set scoreboard(p2score) 0
}
ttk::button .n.m.buttons.swap -text "⇄ Swap players" -command {
foreach key {name country score team} {
# Since country is updated whenever name is updated, we'll need to write
# countries last.
set p1country $scoreboard(p1country)
set p2country $scoreboard(p2country)
foreach key {name score team} {
set tmp $scoreboard(p1$key)
set scoreboard(p1$key) $scoreboard(p2$key)
set scoreboard(p2$key) $tmp
}
set scoreboard(p1country) $p2country
set scoreboard(p2country) $p1country
}
ttk::label .n.m.status -textvariable mainstatus
grid .n.m.description -row 0 -column 0 -sticky NESW -pady {0 5}
Expand Down

0 comments on commit 9494397

Please sign in to comment.