@@ -84,22 +84,31 @@ func (r *RobotSpecHandler) handleRobotSpecs() {
8484func (r * RobotSpecHandler ) updateTeam (team referee.Team , teamName string ) {
8585 if r .appliedTeams [team ] != teamName {
8686 if spec , ok := r .teamRobotSpecs .Teams [teamName ]; ok {
87- var protoSpecs []* RobotSpecs
88- for id := 0 ; id < 16 ; id ++ {
89- protoSpec := mapRobotSpec (spec )
90- protoSpec .Id = new (referee.RobotId )
91- protoSpec .Id .Id = new (uint32 )
92- protoSpec .Id .Team = new (referee.Team )
93- * protoSpec .Id .Team = team
94- * protoSpec .Id .Id = uint32 (id )
95- protoSpecs = append (protoSpecs , protoSpec )
96- }
97- r .sendConfig (protoSpecs )
98- r .appliedTeams [team ] = teamName
87+ r .applySpecs (team , teamName , spec )
88+ } else if spec , ok := r .teamRobotSpecs .Teams ["Unknown" ]; ok {
89+ log .Printf ("Team %v not found, using fallback" , teamName )
90+ r .applySpecs (team , teamName , spec )
91+ } else {
92+ log .Printf ("Team %v not found and also no fallback found" , teamName )
9993 }
10094 }
10195}
10296
97+ func (r * RobotSpecHandler ) applySpecs (team referee.Team , teamName string , spec RobotSpec ) {
98+ var protoSpecs []* RobotSpecs
99+ for id := 0 ; id < 16 ; id ++ {
100+ protoSpec := mapRobotSpec (spec )
101+ protoSpec .Id = new (referee.RobotId )
102+ protoSpec .Id .Id = new (uint32 )
103+ protoSpec .Id .Team = new (referee.Team )
104+ * protoSpec .Id .Team = team
105+ * protoSpec .Id .Id = uint32 (id )
106+ protoSpecs = append (protoSpecs , protoSpec )
107+ }
108+ r .sendConfig (protoSpecs )
109+ r .appliedTeams [team ] = teamName
110+ }
111+
103112func (r * RobotSpecHandler ) sendConfig (robotSpec []* RobotSpecs ) {
104113 log .Printf ("Sending robot spec %v" , robotSpec )
105114
0 commit comments