diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-04-29 14:57:09 -0500 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-05-01 09:46:15 -0500 |
| commit | 57692ff8964bea8cc6167772da8d58c6246fa502 (patch) | |
| tree | 8b607a2b6b7954403ac7d33d8a27cb8be396dc6a /go/game | |
| parent | 6c4645eea5f26e32bc462c8627031a3563b1c39a (diff) | |
| download | muhqs-game-57692ff8964bea8cc6167772da8d58c6246fa502.tar.gz muhqs-game-57692ff8964bea8cc6167772da8d58c6246fa502.zip | |
improve the sealed activity
Do not export the sealed client type.
Validate the entered set list.
Show the default set list.
Diffstat (limited to 'go/game')
| -rw-r--r-- | go/game/set.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/go/game/set.go b/go/game/set.go index 23cc7084..fe25e3a1 100644 --- a/go/game/set.go +++ b/go/game/set.go @@ -1,6 +1,8 @@ package game import ( + "errors" + "fmt" "log" "net/http" "path" @@ -115,3 +117,19 @@ func (set SetIdentifier) CardPaths() []string { walk(doc) return paths } + +func SetListToSets(setList string) ([]SetIdentifier, error) { + var err error + sets := []SetIdentifier{} + setList = strings.Replace(setList, " ", "", 0) + setsRaw := strings.Split(setList, ",") + for _, s := range setsRaw { + set, found := SetNames[s] + if found { + sets = append(sets, set) + } else { + err = errors.New(fmt.Sprintf("Unknown set: %s", set)) + } + } + return sets, err +} |
