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-06 09:35:57 +0200
commitbd6362cb92c9105a36ed900cfbaafa2b2ee81ab8 (patch)
treefa6542e34e46e73381fd74ee7bd4140267884d95
parent8aedaa204ced2eec921af6d1c28df5cbf8593363 (diff)
downloadmuhqs-game-bd6362cb92c9105a36ed900cfbaafa2b2ee81ab8.tar.gz
muhqs-game-bd6362cb92c9105a36ed900cfbaafa2b2ee81ab8.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",