moved MapLock to control
This commit is contained in:
@@ -23,27 +23,6 @@ type Scanner struct {
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type MapLock struct {
|
||||
M map[string]*Game
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
// get is a function that returns a game if found, and creates one if
|
||||
// not found and force is true. In order to get a hash (rather than use
|
||||
// the string you pass) send "" for id.
|
||||
func (ml *MapLock) get(id string) *Game {
|
||||
ml.Lock()
|
||||
g, _ := ml.M[id]
|
||||
ml.Unlock()
|
||||
return g
|
||||
}
|
||||
|
||||
func (ml *MapLock) add(g *Game) {
|
||||
ml.Lock()
|
||||
ml.M[g.id] = g
|
||||
ml.Unlock()
|
||||
}
|
||||
|
||||
type BotStats struct {
|
||||
Kills int
|
||||
Deaths int
|
||||
|
||||
Reference in New Issue
Block a user