private bool searchHighScoresAndReplace(int m_timeInSeconds, List <string> m_playersList, List <int> m_timeList) { // Searches the High Score array and inserts (or not) the new value. for (int i = 0; i < m_timeList.Count; i++) { // Condition A: m_timeList[i] == -1 // Condition B: m_timeInSeconds < m_timeList[i] // (Algebra Boole) Code_Section_C = A + A'*B bool A = m_timeList[i] == -1; bool B = m_timeInSeconds < m_timeList[i]; if (A || (!A && B)) { // time list: m_timeList.Insert(i, m_timeInSeconds); m_timeList.RemoveAt(highScoreEntries); // player list: frmEnterPlayerName enterPlayerName = new frmEnterPlayerName(); enterPlayerName.ShowDialog(); m_playersList.Insert(i, enterPlayerName.GetPlayerName()); m_playersList.RemoveAt(highScoreEntries); return(true); } } return(false); }
private void justAddHighScore(int m_timeInSeconds, List <string> m_playersList, List <int> m_timeList) { m_timeList.Add(m_timeInSeconds); frmEnterPlayerName enterPlayerName = new frmEnterPlayerName(); enterPlayerName.ShowDialog(); m_playersList.Add(enterPlayerName.GetPlayerName()); }