knowyt/server/src/game/saveSelection.go

18 lines
329 B
Go
Raw Normal View History

2021-08-30 08:55:07 +00:00
package game
import (
"sirlab.de/go/knyt/user"
)
2021-08-30 10:24:28 +00:00
func (gm *Game) SaveSelection(usr *user.User, selection string) {
gm.updateSelection(usr, selection)
gm.notifyClients()
}
func (gm *Game) updateSelection(usr *user.User, selection string) {
2021-08-30 08:55:07 +00:00
gm.mu.Lock()
defer gm.mu.Unlock()
2021-08-30 10:24:28 +00:00
gm.round.selection[usr.GetId()] = selection
2021-08-30 08:55:07 +00:00
}