Skip to content

Commit c618747

Browse files
committed
Correctly detect when penalty kick is prepared
1 parent 7828dd0 commit c618747

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

internal/app/engine/process_continue.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ func (e *Engine) processContinue() {
8484
}
8585

8686
if *e.currentState.Command.Type == state.Command_STOP &&
87-
!e.readyToContinueFromStop() {
87+
(e.currentState.NextCommand == nil ||
88+
!e.readyToContinueFromStop()) {
8889
return
8990
}
9091

@@ -120,8 +121,8 @@ func (e *Engine) robotPos(robotId *state.RobotId) *geom.Vector2 {
120121
}
121122

122123
func (e *Engine) posInsideGoal(pos *geom.Vector2) bool {
123-
forTeam := *e.currentState.Command.ForTeam
124-
teamInfo := e.currentState.TeamState[forTeam.String()]
124+
goalTeam := e.currentState.Command.ForTeam.Opposite()
125+
teamInfo := e.currentState.TeamState[goalTeam.String()]
125126
goalCenter := geom.GoalCenter(e.getGeometry(), *teamInfo.OnPositiveHalf)
126127
goalArea := geom.NewRectangleFromCenter(goalCenter, robotRadius*2, e.getGeometry().GoalWidth)
127128
return goalArea.IsPointInside(pos)

internal/app/geom/rectangle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (r *Rectangle) MaxY() float64 {
5555

5656
// MaxX returns the smallest y value
5757
func (r *Rectangle) MinY() float64 {
58-
return r.center.Y64() + r.yExtent/2.0
58+
return r.center.Y64() - r.yExtent/2.0
5959
}
6060

6161
// IsPointInside returns true if the given point is inside the rectangle

0 commit comments

Comments
 (0)