2021-08-04 23:42:21 +00:00
|
|
|
package application
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"sirlab.de/go/knyt/game"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (app Application) GetGameById(id string) (*game.Game, error) {
|
2021-08-09 08:36:19 +00:00
|
|
|
app.mu.Lock()
|
|
|
|
defer app.mu.Unlock()
|
|
|
|
|
2021-08-04 23:42:21 +00:00
|
|
|
gm := app.games[id]
|
|
|
|
if gm == nil {
|
|
|
|
return nil, fmt.Errorf("unknown id")
|
|
|
|
}
|
|
|
|
return gm, nil
|
|
|
|
}
|