// Start a 2hr long Practice Event based off the existing championship event with eventID
Start a 2hr long Practice Event based off the existing championship event with eventID
// Start a 2hr long Practice Event based off the existing championship event with eventID
func (cm *ChampionshipManager) StartPracticeEvent(championshipID string, eventID string) error {
	championship, err := cm.LoadChampionship(championshipID)
	if err != nil {
		return err
	}
	event, err := championship.EventByID(eventID)
	if err != nil {
		return err
	}
	config := ConfigIniDefault
	raceSetup := event.RaceSetup
	raceSetup.Sessions = make(map[SessionType]SessionConfig)
	raceSetup.Sessions[SessionTypePractice] = SessionConfig{
		Name:   "Practice",
		Time:   120,
		IsOpen: 1,
	}
	raceSetup.Cars = strings.Join(championship.ValidCarIDs(), ";")
	raceSetup.LoopMode = 1
	raceSetup.MaxClients = championship.NumEntrants()
	config.CurrentRaceConfig = raceSetup
	return cm.RaceManager.applyConfigAndStart(config, championship.AllEntrants(), false)
}
func ( cm * ChampionshipManager ) StartPracticeEvent ( championshipID string , eventID string ) error { championship , err := cm . LoadChampionship ( championshipID ) if err != nil { return err } event , err := championship . EventByID ( eventID ) if err != nil { return err } config := ConfigIniDefault raceSetup := event . RaceSetup raceSetup . Sessions = make ( map [ SessionType ] SessionConfig ) raceSetup . Sessions [ SessionTypePractice ] = SessionConfig { Name : " " , Time : 120 , IsOpen : 1 , } raceSetup . Cars = strings . Join ( championship . ValidCarIDs ( ) , " " ) raceSetup . LoopMode = 1 raceSetup . MaxClients = championship . NumEntrants ( ) config . CurrentRaceConfig = raceSetup return cm . RaceManager . applyConfigAndStart ( config , championship . AllEntrants ( ) , false ) }
Start a 2hr long Practice Event based off the existing championship event with eventID
Start a 2hr long Practice Event based off the existing championship event with eventID