diff --git a/Vocaluxe/Lib/Database/CHighscoreDB.cs b/Vocaluxe/Lib/Database/CHighscoreDB.cs index 1e0026b5..c6683788 100644 --- a/Vocaluxe/Lib/Database/CHighscoreDB.cs +++ b/Vocaluxe/Lib/Database/CHighscoreDB.cs @@ -613,7 +613,7 @@ namespace Vocaluxe.Lib.Database { //Check for USDX 1.1 DB _CreateHighscoreDBV1(filePath); - result &= !_ConvertFrom110(filePath); + result &= _ConvertFrom110(filePath); result &= _UpdateDatabase(1, connection); result &= _UpdateDatabase(2, connection); } @@ -742,13 +742,22 @@ namespace Vocaluxe.Lib.Database transaction.Commit(); //Delete old tables after conversion - command.CommandText = "DROP TABLE US_Scores;"; + command.CommandText = "DROP TABLE IF EXISTS us_scores;"; command.ExecuteNonQuery(); - command.CommandText = "DROP TABLE US_Songs;"; + command.CommandText = "DROP TABLE IF EXISTS us_songs;"; command.ExecuteNonQuery(); - command.CommandText = "DROP TABLE us_statistics_info;"; + command.CommandText = "DROP TABLE IF EXISTS us_statistics_info;"; + command.ExecuteNonQuery(); + + command.CommandText = "DROP TABLE IF EXISTS us_users_info;"; + command.ExecuteNonQuery(); + + command.CommandText = "DROP TABLE IF EXISTS us_webs;"; + command.ExecuteNonQuery(); + + command.CommandText = "DROP TABLE IF EXISTS us_webs_stats;"; command.ExecuteNonQuery(); //This versioning is not used in Vocaluxe so reset it to 0 @@ -927,7 +936,7 @@ namespace Vocaluxe.Lib.Database if (currentVersion < 2) updated &= _ConvertV1toV2(connection); - if (currentVersion < 3) + else if (currentVersion < 3) updated &= _ConvertV2toV3(connection); return updated; diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs index cc01f135..063d3b12 100644 --- a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs +++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs @@ -15,6 +15,7 @@ // along with Vocaluxe. If not, see . #endregion +using System; using System.Collections.Generic; using System.Windows.Forms; using VocaluxeLib.Draw; @@ -587,12 +588,15 @@ namespace VocaluxeLib.Menu } else { - _NumPlayerTeams[i] = _NumPlayer; + //Get average num players per teams as default player number + _NumPlayerTeams[i] = _NumPlayer/(_NumTeams - 1); + _NumPlayer += _NumPlayerTeams[i]; _TeamList[i] = new List(); } } } _UpdateButtonState(); + _UpdateTeamSlide(); } public void DecreaseTeamNum() @@ -603,6 +607,7 @@ namespace VocaluxeLib.Menu if (_NumTeams - 1 >= _PartyMode.MinTeams) _NumTeams--; _UpdateButtonState(); + _UpdateTeamSlide(); } public void IncreasePlayerNum(int team) @@ -691,16 +696,20 @@ namespace VocaluxeLib.Menu private void _UpdateTeamSlide() { + int sel = _SelectSlides[_SelectSlideTeams].Selection; + _SelectSlides[_SelectSlideTeams].Visible = _Teams; _SelectSlides[_SelectSlideTeams].Clear(); for (int i = 1; i <= _NumTeams; i++) _SelectSlides[_SelectSlideTeams].AddValue("Team " + i, null, i); + + _SelectSlides[_SelectSlideTeams].Selection = Math.Min(sel, _SelectSlides[_SelectSlideTeams].NumValues - 1); } private void _UpdateButtonVisibility() { - _Buttons[_ButtonIncreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; - _Buttons[_ButtonDecreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; + _Buttons[_ButtonIncreaseTeams].Visible = _AllowChangeTeamNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; + _Buttons[_ButtonDecreaseTeams].Visible = _AllowChangeTeamNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; _Buttons[_ButtonIncreasePlayer].Visible = _AllowChangePlayerNum; _Buttons[_ButtonDecreasePlayer].Visible = _AllowChangePlayerNum; }