@@ -71,27 +71,12 @@ func (e *Engine) nextActions() (actions []*ContinueAction, hints []*ContinueHint
71
71
}
72
72
73
73
if * e .currentState .Command .Type == state .Command_STOP || * e .currentState .Command .Type == state .Command_HALT {
74
- newActions , newHints := e .actionsToContinueFromStop ()
74
+ newActions , newHints := e .actionsDuringHaltAndStop ()
75
75
actions = append (actions , newActions ... )
76
76
hints = append (hints , newHints ... )
77
- } else {
78
- // reset random placing team
79
- e .randomPlacingTeam = state .Team_UNKNOWN
80
77
}
81
78
82
79
if * e .currentState .Command .Type == state .Command_HALT {
83
- // disable continue actions that can't be used after halt
84
- for _ , action := range actions {
85
- switch * action .Type {
86
- case
87
- ContinueAction_FORCE_START ,
88
- ContinueAction_FREE_KICK ,
89
- ContinueAction_NEXT_COMMAND ,
90
- ContinueAction_BALL_PLACEMENT_START :
91
- * action .State = ContinueAction_DISABLED
92
- }
93
- }
94
-
95
80
continueFromHalt := createContinueAction (
96
81
ContinueAction_RESUME_FROM_HALT ,
97
82
state .Team_UNKNOWN ,
@@ -107,13 +92,36 @@ func (e *Engine) nextActions() (actions []*ContinueAction, hints []*ContinueHint
107
92
* continueFromHalt .State = ContinueAction_DISABLED
108
93
}
109
94
110
- actions = append ([]* ContinueAction {continueFromHalt }, actions ... )
95
+ actions = append (actions , continueFromHalt )
96
+ }
97
+
98
+ if * e .currentState .Command .Type == state .Command_STOP || * e .currentState .Command .Type == state .Command_HALT {
99
+ newActions , newHints := e .actionsToContinueFromStop ()
100
+ actions = append (actions , newActions ... )
101
+ hints = append (hints , newHints ... )
102
+ } else {
103
+ // reset random placing team
104
+ e .randomPlacingTeam = state .Team_UNKNOWN
105
+ }
106
+
107
+ if * e .currentState .Command .Type == state .Command_HALT {
108
+ // disable continue actions that can't be used after halt
109
+ for _ , action := range actions {
110
+ switch * action .Type {
111
+ case
112
+ ContinueAction_FORCE_START ,
113
+ ContinueAction_FREE_KICK ,
114
+ ContinueAction_NEXT_COMMAND ,
115
+ ContinueAction_BALL_PLACEMENT_START :
116
+ * action .State = ContinueAction_DISABLED
117
+ }
118
+ }
111
119
}
112
120
113
121
return
114
122
}
115
123
116
- func (e * Engine ) actionsToContinueFromStop () (actions []* ContinueAction , hints []* ContinueHint ) {
124
+ func (e * Engine ) actionsDuringHaltAndStop () (actions []* ContinueAction , hints []* ContinueHint ) {
117
125
for _ , team := range state .BothTeams () {
118
126
if e .currentState .GameState .IsHalted () &&
119
127
e .currentState .HasGameEventByTeam (state .GameEvent_POSSIBLE_GOAL , team ) &&
@@ -191,7 +199,10 @@ func (e *Engine) actionsToContinueFromStop() (actions []*ContinueAction, hints [
191
199
ContinueAction_READY_MANUAL ,
192
200
))
193
201
}
202
+ return actions , hints
203
+ }
194
204
205
+ func (e * Engine ) actionsToContinueFromStop () (actions []* ContinueAction , hints []* ContinueHint ) {
195
206
if e .ballPlacementRequired () {
196
207
placingTeam := e .ballPlacementTeam ()
197
208
if placingTeam .Known () {
0 commit comments