Skip to content

Commit a48df68

Browse files
committed
[bugfix] Only send stop if not already stopped
1 parent fd8ebcb commit a48df68

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

internal/app/controller/engine.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,12 +547,14 @@ func (e *Engine) processGameEvent(event *GameEvent) error {
547547

548548
if e.State.GameState() != GameStateHalted && !event.IsContinued() {
549549
teamInFavor := event.ByTeam().Opposite()
550-
if e.State.PlacementPos == nil {
551-
e.SendCommand(CommandStop, "")
552-
} else if e.State.TeamState[teamInFavor].CanPlaceBall {
553-
e.SendCommand(CommandBallPlacement, teamInFavor)
554-
} else if e.State.TeamState[teamInFavor.Opposite()].CanPlaceBall {
555-
e.SendCommand(CommandBallPlacement, teamInFavor.Opposite())
550+
if e.State.PlacementPos != nil {
551+
if e.State.TeamState[teamInFavor].CanPlaceBall {
552+
e.SendCommand(CommandBallPlacement, teamInFavor)
553+
} else if e.State.TeamState[teamInFavor.Opposite()].CanPlaceBall {
554+
e.SendCommand(CommandBallPlacement, teamInFavor.Opposite())
555+
} else if e.State.GameState() != GameStateStopped {
556+
e.SendCommand(CommandStop, "")
557+
}
556558
} else if e.State.GameState() != GameStateStopped {
557559
e.SendCommand(CommandStop, "")
558560
}

0 commit comments

Comments
 (0)