aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-07-28 23:29:24 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-07-28 23:29:24 +0200
commit24aad8335be3612f26134736fae5e6c3041718a3 (patch)
tree684d6b3aaea39b12109c0615cf6b73d3db7ed07f
parent4dafe0f4a2b197145c3bd70ba56521cbf31130d7 (diff)
downloadmuhqs-game-24aad8335be3612f26134736fae5e6c3041718a3.tar.gz
muhqs-game-24aad8335be3612f26134736fae5e6c3041718a3.zip
only clear the selections if the target is not nil
-rw-r--r--go/game/state.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/go/game/state.go b/go/game/state.go
index d16bd51d..dd3cb007 100644
--- a/go/game/state.go
+++ b/go/game/state.go
@@ -882,11 +882,14 @@ func (s *LocalState) endOfTurn() []*Player {
return s.stateBasedActions()
}
-// ResolveAction resolves an action without using the stack.
+// ResolveAction resolves an action.
+// Additionally it resets the targets of the action to make it reusable.
func (s *LocalState) ResolveAction(a Action) {
a.resolve(s)
- // Clear selections to make the acrion reusable
- a.Targets().ClearSelections()
+ // Clear selections to make the action reusable
+ if a.Targets() != nil {
+ a.Targets().ClearSelections()
+ }
}
func (s *LocalState) SetPhase(p PhaseType) {