diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-04-29 14:57:09 -0500 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:16 +0200 |
| commit | 9152c3e0ee2b37dfa94ccf8c781eae1a9ab8ee19 (patch) | |
| tree | ebea488f7c1b4faaf827e325d20ca850941d4387 /go/game | |
| parent | be2aad1142bde494229d9d27d4123923aa578c1a (diff) | |
| download | muhqs-game-9152c3e0ee2b37dfa94ccf8c781eae1a9ab8ee19.tar.gz muhqs-game-9152c3e0ee2b37dfa94ccf8c781eae1a9ab8ee19.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 +} |
