public void racesFromString(string aString) { string s = Base64.Base64Decode(aString); string[] split = s.Split (new char[] {'%'}); for(int i = 0;i<split.Length;i++) { string[] raceSplit = split[i].Split (new char[] {'|'}); if(raceSplit.Length==2) { ChampionshipRaceSettings raceSetting = new ChampionshipRaceSettings(); raceSetting.startDate = Convert.ToInt32(raceSplit[0]); for(int j = 0;j<TrackDatabase.REF.tracks.Count;j++) { if(TrackDatabase.REF.tracks[j].name==raceSplit[1]) { raceSetting.track = TrackDatabase.REF.tracks[j]; raceSetting.setupDefaultsForLeague(this.divisionNumber,Convert.ToInt32(raceSplit[0]),TrackDatabase.REF.tracks[j]); break; } } races.Add(raceSetting); } } }
public void initRaces() { switch(this.divisionNumber) { case(1): this.leagueName = "Premier Championship"; break; case(2): this.leagueName = "Division 1"; break; case(3): this.leagueName = "Division 2"; break; case(4): this.leagueName = "Division 3"; break; } List<TrackDatabaseRecord> allTracks = new List<TrackDatabaseRecord>(); for(int i = 0;i<TrackDatabase.REF.tracks.Count;i++) { if(TrackDatabase.REF.tracks[i].canUseInDivision(this.divisionNumber)) { allTracks.Add(TrackDatabase.REF.tracks[i]); } } bool allowTracksLikeThis = false; while(!allowTracksLikeThis) { allTracks.Sort(randTrackSort); if(allTracks[0].name.ToLower().Contains("oval")) { allowTracksLikeThis = false; } else { allowTracksLikeThis = true; } } for(int i = 0;i<this.teams.Count;i++) { teams[i].seasonPoints = 0; teams[i].ignoreFromRelegationAndPromotion = false; teams[i].drivers[0].championshipPoints = 0; teams[i].drivers[0].lastRacePoints = 0; teams[i].drivers[1].lastRacePoints = 0; teams[i].drivers[1].championshipPoints = 0; } int dayOfNextSunday = ChampionshipSeason.ACTIVE_SEASON.secondsPast+1; DateTime theDate = new DateTime( 2015, 12, 28 ).AddDays( dayOfNextSunday ); while(!theDate.ToLongDateString().ToLower().Contains("sunday")) { dayOfNextSunday++; theDate = new DateTime( 2015, 12, 28 ).AddDays( dayOfNextSunday ); } for(int i = 0;i<allTracks.Count&&i<MAX_RACES_IN_SEASON;i++) { ChampionshipRaceSettings race = new ChampionshipRaceSettings(); race.setupDefaultsForLeague(divisionNumber,dayOfNextSunday,allTracks[i]); races.Add(race); dayOfNextSunday += 14; } }