// applyCurrentRaceSetupToOptions takes current values in race which require more detailed configuration
// and applies them to the template opts.
applyCurrentRaceSetupToOptions takes current values in race which require more detailed configuration
and applies them to the template opts.
// applyCurrentRaceSetupToOptions takes current values in race which require more detailed configuration // and applies them to the template opts .
func (rm *RaceManager) applyCurrentRaceSetupToOptions(opts map[string]interface{}, race CurrentRaceConfig) error {
	tyres, err := ListTyres()
	if err != nil {
		return err
	}
	deselectedTyres := make(map[string]bool)
	for _, car := range varSplit(race.Cars) {
		tyresForCar, ok := tyres[car]
		if !ok {
			continue
		}
		for carTyre := range tyresForCar {
			found := false
			for _, t := range varSplit(race.LegalTyres) {
				if carTyre == t {
					found = true
					break
				}
			}
			if !found {
				deselectedTyres[carTyre] = true
			}
		}
	}
	opts["Tyres"] = tyres
	opts["DeselectedTyres"] = deselectedTyres
	return nil
}
func ( rm * RaceManager ) applyCurrentRaceSetupToOptions ( opts map [ string ] interface { } , race CurrentRaceConfig ) error { tyres , err := ListTyres ( ) if err != nil { return err } deselectedTyres := make ( map [ string ] bool ) for _ , car := range varSplit ( race . Cars ) { tyresForCar , ok := tyres [ car ] if ! ok { continue } for carTyre := range tyresForCar { found := false for _ , t := range varSplit ( race . LegalTyres ) { if carTyre == t { found = true break } } if ! found { deselectedTyres [ carTyre ] = true } } } opts [ " " ] = tyres opts [ " " ] = deselectedTyres return nil }
applyCurrentRaceSetupToOptions takes current values in race which require more detailed configuration
and applies them to the template opts.
applyCurrentRaceSetupToOptions takes current values in race which require more detailed configuration and applies them to the template opts .