diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 9ee47abf..31c9f8d6 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -804,12 +804,12 @@ namespace Vocaluxe.Base /// Use saved players from config now for games /// public static void UsePlayers() - { - for (int i = 0; i < CProfiles.Profiles.Length; i++) + { + for (int j = 0; j < CSettings.MaxNumPlayer; j++) { - for (int j = 0; j < CSettings.MaxNumPlayer; j++) + if (Players[j].Length > 0) { - if (Players[j].Length > 0) + for (int i = 0; i < CProfiles.Profiles.Length; i++) { if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON) { @@ -819,9 +819,9 @@ namespace Vocaluxe.Base CGame.Player[j].ProfileID = i; } } - else - CGame.Player[j].ProfileID = -1; } + else + CGame.Player[j].ProfileID = -1; } } } diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 176807e1..fe80eafa 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -251,8 +251,25 @@ namespace Vocaluxe.Base { try { + //Check if profile saved in config + for (int i = 0; i < CConfig.Players.Length; i++) + { + if (CConfig.Players[i] == _Profiles[profileID].ProfileFile) + { + CConfig.Players[i] = string.Empty; + CConfig.SaveConfig(); + } + } File.Delete(_Profiles[profileID].ProfileFile); _Profiles.RemoveAt(profileID); + //Check if profile is selected in game + for (int i = 0; i < CGame.Player.Length; i++) + { + if (CGame.Player[i].ProfileID > profileID) + CGame.Player[i].ProfileID--; + else if (CGame.Player[i].ProfileID == profileID) + CGame.Player[i].ProfileID = -1; + } } catch (Exception) { diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 064c9b7d..ea94f0e6 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -577,14 +577,15 @@ namespace Vocaluxe.Screens for (int i = 0; i < CSettings.MaxNumPlayer; i++) { - //Update texture and name - if (CConfig.Players[i].Length > 0) + if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) { - if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) - { - Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; - Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; - } + Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; + Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; + } + else + { + Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i]; + Texts[_TextPlayer[i]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1).ToString(); } if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) {