Skip to content

Commit

Permalink
[bugfix] Count time during breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
g3force committed Aug 25, 2018
1 parent 49eafe3 commit e7dd7fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/app/controller/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,12 @@ func (e *Engine) loadStages() {
e.StageTimes[StageShootoutBreak] = e.config.Overtime.BreakAfter
}

func (e *Engine) countStageTime() bool {
return e.State.Stage.IsPausedStage() || e.State.GameState() == GameStateRunning
}

func (e *Engine) updateTimes(delta time.Duration) {
if e.State.GameState() == GameStateRunning {
if e.countStageTime() {
e.State.StageTimeElapsed += delta
e.State.StageTimeLeft -= delta

Expand Down
8 changes: 8 additions & 0 deletions internal/app/controller/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ func (s Stage) IsPreStage() bool {
return false
}

func (s Stage) IsPausedStage() bool {
switch s {
case StageHalfTime, StageOvertimeBreak, StageOvertimeHalfTime, StageShootoutBreak:
return true
}
return false
}

// RefCommand is a command to be send to the teams
type RefCommand string

Expand Down

0 comments on commit e7dd7fc

Please sign in to comment.