aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2023-10-06 07:08:27 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2023-10-06 07:08:27 +0200
commit0735888213d8575cf870f22d4d905af3f3c1ac9b (patch)
tree7c05f337e6db6dbff43cda22346482d7263b1e3e
parentbf546b1b4c92d3d358a85b6b760dad01bc95ea7c (diff)
fix(order): Start move of unselected units in order
-rw-r--r--main.go4
-rw-r--r--move.go6
2 files changed, 5 insertions, 5 deletions
diff --git a/main.go b/main.go
index 2226190..f61c9c8 100644
--- a/main.go
+++ b/main.go
@@ -49,7 +49,9 @@ func (g *Game) updateSelecting(cursor Point, moveMap MoveMap) {
destination := cursor.Div(100).Mul(100)
slog.Info("destination", slog.String("destination", destination.String()))
for _, e := range g.Entities {
- e.StartMove(destination, moveMap)
+ if e.Selection.IsEnabled && e.Selection.Value.IsSelected {
+ e.StartMove(destination, moveMap)
+ }
}
}
if inpututil.IsMouseButtonJustReleased(ebiten.MouseButtonLeft) {
diff --git a/move.go b/move.go
index f9a54a3..aae83ed 100644
--- a/move.go
+++ b/move.go
@@ -161,10 +161,8 @@ func (p *Path) isValid(moveMap MoveMap) bool {
func (e *Entity) StartMove(destination Point, moveMap MoveMap) {
if e.Move.IsEnabled && e.Position.IsEnabled && e.Selection.IsEnabled {
- if e.Selection.Value.IsSelected {
- e.Move.Value = NewMove(e.Position.Value, destination, moveMap)
- slog.Info("entity starting move", slog.String("destination", destination.String()))
- }
+ e.Move.Value = NewMove(e.Position.Value, destination, moveMap)
+ slog.Info("entity starting move", slog.String("destination", destination.String()))
}
}