diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 636e3cfe..e867335b 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -20,6 +20,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Runtime.InteropServices; +using VocaluxeLib.Game; using VocaluxeLib.Menu; using VocaluxeLib.Songs; @@ -530,13 +531,33 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (!GameData.Rounds[GameData.FieldNr].Finished) GameData.CurrentRoundNr++; + CPoints points = CBase.Game.GetPoints(); SPlayer[] results = CBase.Game.GetPlayers(); - if (results == null) + + if (results == null || results.Length < 2) return; - if (results.Length < 2) - return; + //Sum up all points + for (int r = 0; r < points.NumRounds; r++) + { + SPlayer[] player = points.GetPlayer(r, 2); + for (int i = 0; i < 2; i++) + { + results[i].Points += player[i].Points; + results[i].PointsGoldenNotes += player[i].PointsGoldenNotes; + results[i].PointsLineBonus += player[i].PointsLineBonus; + } + } + //Calc average of points + for (int i = 0; i < 2; i++) + { + results[i].Points /= points.NumRounds; + results[i].PointsGoldenNotes /= points.NumRounds; + results[i].PointsLineBonus /= points.NumRounds; + } + + //Decide who has won GameData.Rounds[GameData.FieldNr].PointsTeam1 = (int)Math.Round(results[0].Points); GameData.Rounds[GameData.FieldNr].PointsTeam2 = (int)Math.Round(results[1].Points); GameData.Rounds[GameData.FieldNr].Finished = true;