19 lines
298 B
Go
19 lines
298 B
Go
|
package game
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"sirlab.de/go/knyt/quote"
|
||
|
)
|
||
|
|
||
|
func (gm *Game) getQuoteById(id string) (*quote.Quote, error) {
|
||
|
gm.mu.Lock()
|
||
|
defer gm.mu.Unlock()
|
||
|
|
||
|
quote := gm.quotes[id]
|
||
|
if quote == nil {
|
||
|
return nil, fmt.Errorf("player id \"%s\" not found in game\n", id)
|
||
|
}
|
||
|
|
||
|
return quote, nil
|
||
|
}
|