@@ -111,17 +111,17 @@ func (g *MessageGenerator) StateToRefereeMessage(matchState *state.State) (r *st
111
111
112
112
func updateTeam (teamInfo * state.Referee_TeamInfo , teamState * state.TeamInfo ) {
113
113
* teamInfo .Name = * teamState .Name
114
- * teamInfo .Score = uint32 (* teamState .Goals )
115
- * teamInfo .RedCards = uint32 (len (teamState .RedCards ))
114
+ * teamInfo .Score = unsigned32 (* teamState .Goals )
115
+ * teamInfo .RedCards = unsigned (len (teamState .RedCards ))
116
116
teamInfo .YellowCardTimes = mapYellowCardTimes (teamState .YellowCards )
117
- * teamInfo .YellowCards = uint32 (len (teamState .YellowCards ))
118
- * teamInfo .Timeouts = uint32 (* teamState .TimeoutsLeft )
119
- * teamInfo .Goalkeeper = uint32 (* teamState .Goalkeeper )
120
- * teamInfo .FoulCounter = uint32 (len (teamState .Fouls ))
121
- * teamInfo .BallPlacementFailures = uint32 (* teamState .BallPlacementFailures )
117
+ * teamInfo .YellowCards = unsigned (len (teamState .YellowCards ))
118
+ * teamInfo .Timeouts = unsigned32 (* teamState .TimeoutsLeft )
119
+ * teamInfo .Goalkeeper = unsigned32 (* teamState .Goalkeeper )
120
+ * teamInfo .FoulCounter = unsigned (len (teamState .Fouls ))
121
+ * teamInfo .BallPlacementFailures = unsigned32 (* teamState .BallPlacementFailures )
122
122
* teamInfo .BallPlacementFailuresReached = * teamState .BallPlacementFailuresReached
123
123
* teamInfo .CanPlaceBall = * teamState .CanPlaceBall
124
- * teamInfo .MaxAllowedBots = uint32 (* teamState .MaxAllowedBots )
124
+ * teamInfo .MaxAllowedBots = unsigned32 (* teamState .MaxAllowedBots )
125
125
* teamInfo .BotSubstitutionIntent = * teamState .BotSubstitutionIntent
126
126
timeoutTime , _ := ptypes .Duration (teamState .TimeoutTimeLeft )
127
127
* teamInfo .TimeoutTime = mapTime (timeoutTime )
@@ -160,3 +160,16 @@ func newTeamInfo() (t *state.Referee_TeamInfo) {
160
160
t .BotSubstitutionIntent = new (bool )
161
161
return
162
162
}
163
+
164
+ func unsigned32 (v int32 ) uint32 {
165
+ if v < 0 {
166
+ return 0
167
+ }
168
+ return uint32 (v )
169
+ }
170
+ func unsigned (v int ) uint32 {
171
+ if v < 0 {
172
+ return 0
173
+ }
174
+ return uint32 (v )
175
+ }
0 commit comments