Skip to content

Commit 0afd958

Browse files
committed
Initialize a game with nextCommand and placementPos
1 parent f9e9456 commit 0afd958

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

internal/app/engine/engine.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package engine
22

33
import (
44
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/config"
5+
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/geom"
56
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/state"
67
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/statemachine"
78
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/store"
@@ -327,6 +328,8 @@ func (e *Engine) createInitialState() (s *state.State) {
327328
*s.TeamInfo(team).MaxAllowedBots = e.gameConfig.MaxBots[e.gameConfig.DefaultDivision]
328329
*s.TeamInfo(team).ChallengeFlags = e.gameConfig.ChallengeFlags
329330
}
331+
s.NextCommand = state.NewCommand(state.Command_KICKOFF, *s.FirstKickoffTeam)
332+
s.PlacementPos = geom.NewVector2(0.0, 0.0)
330333
return
331334
}
332335

internal/app/statemachine/change_config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ func (s *StateMachine) processChangeUpdateConfig(newState *state.State, change *
1414
if change.FirstKickoffTeam != nil {
1515
log.Printf("Change first kickoff team to %v", *change.FirstKickoffTeam)
1616
newState.FirstKickoffTeam = change.FirstKickoffTeam
17+
if *newState.Stage == state.Referee_NORMAL_FIRST_HALF_PRE {
18+
newState.NextCommand = state.NewCommand(state.Command_KICKOFF, *newState.FirstKickoffTeam)
19+
}
1720
}
1821
if change.AutoContinue != nil {
1922
log.Printf("Change auto continue to %v", *change.AutoContinue)

0 commit comments

Comments
 (0)