diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-08-22 15:50:26 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-22 15:50:26 +0200 |
| commit | 679a7625c3be04ab0cff878d62bee18a5c33f72d (patch) | |
| tree | f65f4c6b6df996e9e4e3e0f9f6adaffd06e728fa | |
| parent | 244226ffb4f98ce50398f4aea8248f023c9473fb (diff) | |
| download | muhqs-game-679a7625c3be04ab0cff878d62bee18a5c33f72d.tar.gz muhqs-game-679a7625c3be04ab0cff878d62bee18a5c33f72d.zip | |
do not include already selected candidates in target options
| -rw-r--r-- | go/game/targets.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/go/game/targets.go b/go/game/targets.go index 05d690c0..2eba87eb 100644 --- a/go/game/targets.go +++ b/go/game/targets.go @@ -213,7 +213,13 @@ func (t *Target) Options() (options []any) { candidates := t.candidates() for _, candidate := range candidates { - if err := t.constraint(candidate); err == nil { + + err := t.constraint(candidate) + // TODO: Fix this if a single target allows multiple selections of the same object. + if err == nil && slices.Contains(t.sel, candidate) { + err = ErrTargetAlreadySelected + } + if err == nil { options = append(options, candidate) } else { log.Debug("no valid option", "candidate", candidate, "error", err) |
