aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-08-06 09:35:57 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:34 +0200
commitf21eed02a2d0ac4184976589be48f69bf3345b66 (patch)
tree3b04d4f77b20479116e8aabc40ff3ea9037e2db4
parent6eb0cde9c815527db2059a006ec9bbd664b6f65d (diff)
downloadmuhqs-game-f21eed02a2d0ac4184976589be48f69bf3345b66.tar.gz
muhqs-game-f21eed02a2d0ac4184976589be48f69bf3345b66.zip
recheck the source position each time
This allows the reuse of the targets.
-rw-r--r--go/game/targets.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/go/game/targets.go b/go/game/targets.go
index a7e89740..61cf3436 100644
--- a/go/game/targets.go
+++ b/go/game/targets.go
@@ -480,9 +480,8 @@ func posFromTileOrPermanent(tileOrPermanent any) Position {
}
func rangeTargetConstraint(source any, r int) TargetConstraintFunc {
- sourcePos := posFromTileOrPermanent(source)
-
return func(t any) (err error) {
+ sourcePos := posFromTileOrPermanent(source)
targetPos := posFromTileOrPermanent(t)
if !IsPositionInRange(sourcePos, targetPos, r) {
err = fmt.Errorf("Position %v of target %v not in range %d of source's position %v",