Changed players->Profile handling (no redundant entries)

This commit is contained in:
Flamefire committed 2013-04-25 18:27:59 +02:00
1 parent dfc705aea4
commit bdca0554e4
18 files changed
+232 -323

No files matched your search

@@ -459,33 +459,22 @@ namespace VocaluxeLib.PartyModes.Challenge
CBase.Game.AddSong(songID, gm);
CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce);
SPlayer[] player = CBase.Game.GetPlayer();
SPlayer[] player = CBase.Game.GetPlayers();
if (player == null)
return;
if (player.Length < _GameData.NumPlayerAtOnce)
return;
SProfile[] profiles = CBase.Profiles.GetProfiles();
CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{
//default values
player[i].Name = "foobar";
player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY;
player[i].ProfileID = -1;
//try to fill with the right data
if (c != null)
{
if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length)
{
player[i].Name = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName;
player[i].Difficulty = profiles[_GameData.ProfileIDs[c.Player[i]]].Difficulty;
player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
}
}
player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
else
player[i].ProfileID = -1;
}
CBase.Songs.AddPartySongSung(songID);
@@ -593,7 +582,7 @@ namespace VocaluxeLib.PartyModes.Challenge
}
else
{
SPlayer[] results = CBase.Game.GetPlayer();
SPlayer[] results = CBase.Game.GetPlayers();
if (results == null)
return;
@@ -482,33 +482,22 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
#region PlayerNames
CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce);
SPlayer[] player = CBase.Game.GetPlayer();
SPlayer[] player = CBase.Game.GetPlayers();
if (player == null)
return false;
if (player.Length < _GameData.NumPlayerAtOnce)
return false;
SProfile[] profiles = CBase.Profiles.GetProfiles();
CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{
//default values
player[i].Name = "foobar";
player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY;
player[i].ProfileID = -1;
//try to fill with the right data
if (c != null)
{
if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length)
{
player[i].Name = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName;
player[i].Difficulty = profiles[_GameData.ProfileIDs[c.Player[i]]].Difficulty;
player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
}
}
player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
else
player[i].ProfileID = -1;
}
#endregion PlayerNames
@@ -718,7 +718,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
CBase.Game.SetNumPlayer(2);
SPlayer[] player = CBase.Game.GetPlayer();
SPlayer[] player = CBase.Game.GetPlayers();
if (player == null)
return;
@@ -732,8 +732,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
for (int i = 0; i < 2; i++)
{
//default values
player[i].Name = "foobar";
player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY;
player[i].ProfileID = -1;
}
@@ -742,16 +740,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{
if (_GameData.ProfileIDsTeam1[r.SingerTeam1] < profiles.Length)
{
player[0].Name = profiles[_GameData.ProfileIDsTeam1[r.SingerTeam1]].PlayerName;
player[0].Difficulty = profiles[_GameData.ProfileIDsTeam1[r.SingerTeam1]].Difficulty;
player[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
if (isDuet)
player[0].LineNr = 0;
}
if (_GameData.ProfileIDsTeam2[r.SingerTeam2] < profiles.Length)
{
player[1].Name = profiles[_GameData.ProfileIDsTeam2[r.SingerTeam2]].PlayerName;
player[1].Difficulty = profiles[_GameData.ProfileIDsTeam2[r.SingerTeam2]].Difficulty;
player[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
if (isDuet)
player[1].LineNr = 1;
@@ -792,7 +786,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (!_GameData.Rounds[_GameData.SingRoundNr].Finished)
_GameData.CurrentRoundNr++;
SPlayer[] results = CBase.Game.GetPlayer();
SPlayer[] results = CBase.Game.GetPlayers();
if (results == null)
return;