Skip to content

Commit 34ce0ae

Browse files
committed
Start match duration from the beginning
This way, the protocol times are timed from the beginning, not only after kickoff
1 parent 616c99e commit 34ce0ae

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

internal/app/engine/engine.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,6 @@ func (e *Engine) processChange(change *statemachine.Change) (newChanges []*state
431431

432432
e.currentState = entry.State.Clone()
433433

434-
e.postProcessChange(entry)
435-
436434
if err := e.stateStore.Add(entry); err != nil {
437435
log.Println("Could not add new state to store: ", err)
438436
}
@@ -473,18 +471,10 @@ func (e *Engine) createInitialState() (s *state.State) {
473471
s.NextCommand = state.NewCommand(state.Command_KICKOFF, *s.FirstKickoffTeam)
474472
s.PlacementPos = geom.NewVector2(0.0, 0.0)
475473
s.StageTimeLeft = durationpb.New(e.gameConfig.Normal.HalfTimeDuration)
474+
s.MatchTimeStart = timestamppb.New(e.timeProvider())
476475
return
477476
}
478477

479-
// postProcessChange performs synchronous post processing steps
480-
func (e *Engine) postProcessChange(entry *statemachine.StateChange) {
481-
change := entry.Change
482-
if change.GetChangeStageChange() != nil &&
483-
*change.GetChangeStageChange().NewStage == state.Referee_NORMAL_FIRST_HALF {
484-
e.currentState.MatchTimeStart = timestamppb.New(e.timeProvider())
485-
}
486-
}
487-
488478
// GetConfig returns a deep copy of the current config
489479
func (e *Engine) GetConfig() *Config {
490480
cfg := Config{}

0 commit comments

Comments
 (0)