@@ -13,7 +13,7 @@ const maxDatagramSize = 8192
13
13
// Publisher can publish state and commands to the teams
14
14
type Publisher struct {
15
15
conn * net.UDPConn
16
- message sslproto.SSL_Referee
16
+ message sslproto.Referee
17
17
}
18
18
19
19
// NewPublisher creates a new publisher that publishes referee messages via UDP to the teams
@@ -38,21 +38,21 @@ func NewPublisher(address string) (publisher Publisher, err error) {
38
38
return
39
39
}
40
40
41
- func initRefereeMessage (m * sslproto.SSL_Referee ) {
41
+ func initRefereeMessage (m * sslproto.Referee ) {
42
42
m .PacketTimestamp = new (uint64 )
43
- m .Stage = new (sslproto.SSL_Referee_Stage )
43
+ m .Stage = new (sslproto.Referee_Stage )
44
44
m .StageTimeLeft = new (int32 )
45
- m .Command = new (sslproto.SSL_Referee_Command )
45
+ m .Command = new (sslproto.Referee_Command )
46
46
m .CommandCounter = new (uint32 )
47
47
m .CommandTimestamp = new (uint64 )
48
- m .Yellow = new (sslproto.SSL_Referee_TeamInfo )
48
+ m .Yellow = new (sslproto.Referee_TeamInfo )
49
49
initTeamInfo (m .Yellow )
50
- m .Blue = new (sslproto.SSL_Referee_TeamInfo )
50
+ m .Blue = new (sslproto.Referee_TeamInfo )
51
51
initTeamInfo (m .Blue )
52
52
m .BlueTeamOnPositiveHalf = new (bool )
53
53
}
54
54
55
- func initTeamInfo (t * sslproto.SSL_Referee_TeamInfo ) {
55
+ func initTeamInfo (t * sslproto.Referee_TeamInfo ) {
56
56
t .Name = new (string )
57
57
t .Score = new (uint32 )
58
58
t .RedCards = new (uint32 )
@@ -84,7 +84,7 @@ func (p *Publisher) Publish(state *State, command *EventCommand) {
84
84
}
85
85
}
86
86
87
- func updateMessage (r * sslproto.SSL_Referee , state * State , command * EventCommand ) {
87
+ func updateMessage (r * sslproto.Referee , state * State , command * EventCommand ) {
88
88
89
89
* r .PacketTimestamp = uint64 (time .Now ().UnixNano () / 1000 )
90
90
* r .Stage = mapStage (state .Stage )
@@ -100,42 +100,42 @@ func updateMessage(r *sslproto.SSL_Referee, state *State, command *EventCommand)
100
100
}
101
101
}
102
102
103
- func mapCommand (c * EventCommand ) sslproto.SSL_Referee_Command {
103
+ func mapCommand (c * EventCommand ) sslproto.Referee_Command {
104
104
switch c .Type {
105
105
case CommandHalt :
106
- return sslproto .SSL_Referee_HALT
106
+ return sslproto .Referee_HALT
107
107
case CommandStop :
108
- return sslproto .SSL_Referee_STOP
108
+ return sslproto .Referee_STOP
109
109
case CommandNormalStart :
110
- return sslproto .SSL_Referee_NORMAL_START
110
+ return sslproto .Referee_NORMAL_START
111
111
case CommandForceStart :
112
- return sslproto .SSL_Referee_FORCE_START
112
+ return sslproto .Referee_FORCE_START
113
113
case CommandDirect :
114
- return commandByTeam (c , sslproto .SSL_Referee_DIRECT_FREE_BLUE , sslproto .SSL_Referee_DIRECT_FREE_YELLOW )
114
+ return commandByTeam (c , sslproto .Referee_DIRECT_FREE_BLUE , sslproto .Referee_DIRECT_FREE_YELLOW )
115
115
case CommandIndirect :
116
- return commandByTeam (c , sslproto .SSL_Referee_INDIRECT_FREE_BLUE , sslproto .SSL_Referee_INDIRECT_FREE_YELLOW )
116
+ return commandByTeam (c , sslproto .Referee_INDIRECT_FREE_BLUE , sslproto .Referee_INDIRECT_FREE_YELLOW )
117
117
case CommandKickoff :
118
- return commandByTeam (c , sslproto .SSL_Referee_PREPARE_KICKOFF_BLUE , sslproto .SSL_Referee_PREPARE_KICKOFF_YELLOW )
118
+ return commandByTeam (c , sslproto .Referee_PREPARE_KICKOFF_BLUE , sslproto .Referee_PREPARE_KICKOFF_YELLOW )
119
119
case CommandPenalty :
120
- return commandByTeam (c , sslproto .SSL_Referee_PREPARE_PENALTY_BLUE , sslproto .SSL_Referee_PREPARE_PENALTY_YELLOW )
120
+ return commandByTeam (c , sslproto .Referee_PREPARE_PENALTY_BLUE , sslproto .Referee_PREPARE_PENALTY_YELLOW )
121
121
case CommandTimeout :
122
- return commandByTeam (c , sslproto .SSL_Referee_TIMEOUT_BLUE , sslproto .SSL_Referee_TIMEOUT_YELLOW )
122
+ return commandByTeam (c , sslproto .Referee_TIMEOUT_BLUE , sslproto .Referee_TIMEOUT_YELLOW )
123
123
case CommandBallPlacement :
124
- return commandByTeam (c , sslproto .SSL_Referee_BALL_PLACEMENT_BLUE , sslproto .SSL_Referee_BALL_PLACEMENT_YELLOW )
124
+ return commandByTeam (c , sslproto .Referee_BALL_PLACEMENT_BLUE , sslproto .Referee_BALL_PLACEMENT_YELLOW )
125
125
case CommandGoal :
126
- return commandByTeam (c , sslproto .SSL_Referee_GOAL_BLUE , sslproto .SSL_Referee_GOAL_YELLOW )
126
+ return commandByTeam (c , sslproto .Referee_GOAL_BLUE , sslproto .Referee_GOAL_YELLOW )
127
127
}
128
128
return - 1
129
129
}
130
130
131
- func commandByTeam (command * EventCommand , blueCommand sslproto.SSL_Referee_Command , yellowCommand sslproto.SSL_Referee_Command ) sslproto.SSL_Referee_Command {
131
+ func commandByTeam (command * EventCommand , blueCommand sslproto.Referee_Command , yellowCommand sslproto.Referee_Command ) sslproto.Referee_Command {
132
132
if * command .ForTeam == TeamBlue {
133
133
return blueCommand
134
134
}
135
135
return yellowCommand
136
136
}
137
137
138
- func updateTeam (team * sslproto.SSL_Referee_TeamInfo , state * TeamInfo ) {
138
+ func updateTeam (team * sslproto.Referee_TeamInfo , state * TeamInfo ) {
139
139
* team .Name = state .Name
140
140
* team .Score = uint32 (state .Goals )
141
141
* team .RedCards = uint32 (state .RedCards )
@@ -157,36 +157,36 @@ func mapTimes(durations []time.Duration) []uint32 {
157
157
return times
158
158
}
159
159
160
- func mapStage (stage Stage ) sslproto.SSL_Referee_Stage {
160
+ func mapStage (stage Stage ) sslproto.Referee_Stage {
161
161
switch stage {
162
162
case StagePreGame :
163
- return sslproto .SSL_Referee_NORMAL_FIRST_HALF_PRE
163
+ return sslproto .Referee_NORMAL_FIRST_HALF_PRE
164
164
case StageFirstHalf :
165
- return sslproto .SSL_Referee_NORMAL_FIRST_HALF
165
+ return sslproto .Referee_NORMAL_FIRST_HALF
166
166
case StageHalfTime :
167
- return sslproto .SSL_Referee_NORMAL_HALF_TIME
167
+ return sslproto .Referee_NORMAL_HALF_TIME
168
168
case StageSecondHalfPre :
169
- return sslproto .SSL_Referee_NORMAL_SECOND_HALF_PRE
169
+ return sslproto .Referee_NORMAL_SECOND_HALF_PRE
170
170
case StageSecondHalf :
171
- return sslproto .SSL_Referee_NORMAL_SECOND_HALF
171
+ return sslproto .Referee_NORMAL_SECOND_HALF
172
172
case StageOvertimeBreak :
173
- return sslproto .SSL_Referee_EXTRA_TIME_BREAK
173
+ return sslproto .Referee_EXTRA_TIME_BREAK
174
174
case StageOvertimeFirstHalfPre :
175
- return sslproto .SSL_Referee_EXTRA_FIRST_HALF_PRE
175
+ return sslproto .Referee_EXTRA_FIRST_HALF_PRE
176
176
case StageOvertimeFirstHalf :
177
- return sslproto .SSL_Referee_EXTRA_FIRST_HALF
177
+ return sslproto .Referee_EXTRA_FIRST_HALF
178
178
case StageOvertimeHalfTime :
179
- return sslproto .SSL_Referee_EXTRA_HALF_TIME
179
+ return sslproto .Referee_EXTRA_HALF_TIME
180
180
case StageOvertimeSecondHalfPre :
181
- return sslproto .SSL_Referee_EXTRA_SECOND_HALF_PRE
181
+ return sslproto .Referee_EXTRA_SECOND_HALF_PRE
182
182
case StageOvertimeSecondHalf :
183
- return sslproto .SSL_Referee_EXTRA_SECOND_HALF
183
+ return sslproto .Referee_EXTRA_SECOND_HALF
184
184
case StageShootoutBreak :
185
- return sslproto .SSL_Referee_PENALTY_SHOOTOUT_BREAK
185
+ return sslproto .Referee_PENALTY_SHOOTOUT_BREAK
186
186
case StageShootout :
187
- return sslproto .SSL_Referee_PENALTY_SHOOTOUT
187
+ return sslproto .Referee_PENALTY_SHOOTOUT
188
188
case StagePostGame :
189
- return sslproto .SSL_Referee_POST_GAME
189
+ return sslproto .Referee_POST_GAME
190
190
}
191
191
return - 1
192
192
}
0 commit comments