@@ -7,16 +7,15 @@ import (
77
88func (s * StateMachine ) processChangeStartBallPlacement (newState * state.State ) (changes []* Change ) {
99
10- if newState .PlacementPos == nil || noTeamCanPlaceBall (newState ) {
10+ if newState .NextCommand == nil || newState . PlacementPos == nil || noTeamCanPlaceBall (newState ) {
1111 log .Print ("placement not possible, human ref must help out" )
12- changes = append (changes , s .newCommandChange (state .NewCommandNeutral (state .Command_HALT )))
12+ changes = append (changes , s .createCommandChange (state .NewCommandNeutral (state .Command_HALT )))
1313 return
1414 }
1515
16- if newState .NextCommand != nil &&
17- (* newState .NextCommand .Type == state .Command_PENALTY || * newState .NextCommand .Type == state .Command_KICKOFF ) {
16+ if * newState .NextCommand .Type == state .Command_PENALTY || * newState .NextCommand .Type == state .Command_KICKOFF {
1817 log .Printf ("Human ref places the ball for %v" , * newState .NextCommand )
19- changes = append (changes , s .newCommandChange (state .NewCommandNeutral (state .Command_HALT )))
18+ changes = append (changes , s .createCommandChange (state .NewCommandNeutral (state .Command_HALT )))
2019 }
2120
2221 var teamInFavor state.Team
@@ -31,17 +30,17 @@ func (s *StateMachine) processChangeStartBallPlacement(newState *state.State) (c
3130
3231 if ! * newState .TeamInfo (teamInFavor ).CanPlaceBall {
3332 log .Printf ("Placement for team %v is disabled, team %v places the ball for team %v" , teamInFavor , teamInFavor .Opposite (), teamInFavor )
34- changes = append (changes , s .newCommandChange (state .NewCommand (state .Command_BALL_PLACEMENT , teamInFavor .Opposite ())))
33+ changes = append (changes , s .createCommandChange (state .NewCommand (state .Command_BALL_PLACEMENT , teamInFavor .Opposite ())))
3534 } else if ! * newState .TeamInfo (teamInFavor ).BallPlacementFailuresReached {
3635 log .Printf ("Team %v places the ball for itself" , teamInFavor )
37- changes = append (changes , s .newCommandChange (state .NewCommand (state .Command_BALL_PLACEMENT , teamInFavor )))
36+ changes = append (changes , s .createCommandChange (state .NewCommand (state .Command_BALL_PLACEMENT , teamInFavor )))
3837 } else if ballLeftField (newState ) {
3938 log .Printf ("Team %v reached the maximum allowed placement failures and ball left the field. Team %v places ball for its own free kick" , teamInFavor , teamInFavor .Opposite ())
4039 newState .NextCommand = state .NewCommand (state .Command_DIRECT , teamInFavor .Opposite ())
41- changes = append (changes , s .newCommandChange (state .NewCommand (state .Command_BALL_PLACEMENT , teamInFavor .Opposite ())))
40+ changes = append (changes , s .createCommandChange (state .NewCommand (state .Command_BALL_PLACEMENT , teamInFavor .Opposite ())))
4241 } else {
4342 log .Printf ("Team %v reached the maximum allowed placement failures, but ball has not left the field. Human ref places the ball for team %v" , teamInFavor , teamInFavor )
44- changes = append (changes , s .newCommandChange (state .NewCommandNeutral (state .Command_HALT )))
43+ changes = append (changes , s .createCommandChange (state .NewCommandNeutral (state .Command_HALT )))
4544 }
4645
4746 return
0 commit comments