Skip to content

Commit cfbead4

Browse files
committed
Halt the game if no team can place the ball
1 parent 767ef84 commit cfbead4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/app/statemachine/change_ballplacement.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ func (s *StateMachine) processChangeStartBallPlacement(newState *state.State) (c
2828
}
2929
log.Printf("Start ball placement for %v", teamInFavor)
3030

31-
if !*newState.TeamInfo(teamInFavor).CanPlaceBall {
31+
if noTeamCanPlaceBall(newState) {
32+
log.Printf("No team can place the ball. Human ref places the ball for team %v", teamInFavor)
33+
changes = append(changes, s.createCommandChange(state.NewCommandNeutral(state.Command_HALT)))
34+
} else if !*newState.TeamInfo(teamInFavor).CanPlaceBall && *newState.TeamInfo(teamInFavor.Opposite()).CanPlaceBall {
3235
log.Printf("Placement for team %v is disabled, team %v places the ball for team %v", teamInFavor, teamInFavor.Opposite(), teamInFavor)
3336
changes = append(changes, s.createCommandChange(state.NewCommand(state.Command_BALL_PLACEMENT, teamInFavor.Opposite())))
3437
} else if !*newState.TeamInfo(teamInFavor).BallPlacementFailuresReached {

0 commit comments

Comments
 (0)