Example #1
0
        private void AddNonExistingHorses(FullSystem other)
        {
            for (int raceNumber = 0; raceNumber < NumberOfRaces; ++raceNumber)
            {
                RaceSelection rs = other.GetRaceSelection(raceNumber);

                for (int j = 0; j < rs.Count; ++j)
                {
                    int horse = rs.Get(j);

                    if (false == GetRaceSelection(raceNumber).ContainsHorse(horse))
                    {
                        GetRaceSelection(raceNumber).AddHorse(horse);
                        // this can be eliminated by using a pointer to parent but let's live with it for a while May102008

                        for (int groupIndex = 0; groupIndex < _group.Count; ++groupIndex)
                        {
                            _group[groupIndex].AddHorse(raceNumber, horse);
                        }
                    }
                }
            }
        }
Example #2
0
        private void RemoveNonSelectedHorses(FullSystem other)
        {
            for (int raceNumber = 0; raceNumber < NumberOfRaces; ++raceNumber)
            {
                RaceSelection rs = GetRaceSelection(raceNumber);

                for (int j = 0; j < rs.Count; ++j)
                {
                    int horse = rs.Get(j);

                    if (false == other.GetRaceSelection(raceNumber).ContainsHorse(horse))
                    {
                        GetRaceSelection(raceNumber).Remove(horse);

                        // this can be eliminated by using a pointer to parent but let's live with it for a while May102008

                        for (int groupIndex = 0; groupIndex < _group.Count; ++groupIndex)
                        {
                            _group[groupIndex].RemoveHorse(raceNumber, horse);
                        }

                        // The following statement that rolls back the index
                        // was missing, thus creating a nusty bug
                        // where a horse previously selected was not removed since its index
                        // was skipped after the removal ... June082008
                        // PLEASE BE CAREFULL IN SIMILAR SITUATIONS IN THE FUTURE!

                        --j;
                    }
                }
            }
        }