Nanook.TheGhost.ProjectSong.adjustBattleStarPower C# (CSharp) Method

adjustBattleStarPower() private method

Remove empty star power / battle power sections. Remove overlapping sections. Ensure note count is correct
private adjustBattleStarPower ( int battleStarPower, int notes ) : int[]
battleStarPower int
notes int
return int[]
        private int[] adjustBattleStarPower(int[] battleStarPower, int[] notes)
        {
            int c;

            List<int> sec = new List<int>();
            for (int i = 0; i < battleStarPower.Length; i += 3)
            {
                c = countNotes(notes, battleStarPower[i], battleStarPower[i + 1]);

                if (c != 0 && battleStarPower[i] + battleStarPower[i + 1] < this.Length)
                {
                    //if this section overlaps with the last section then skip this section
                    if (i == 0 || (i >= 3 && battleStarPower[i - 3] + battleStarPower[(i - 3) + 1] < battleStarPower[i]))
                    {
                        sec.Add(battleStarPower[i]);
                        sec.Add(battleStarPower[i + 1]);
                        sec.Add(c);
                    }
                }
            }

            return sec.ToArray();
        }