Merge branch 'Better_Rounds_Handling' into develop

Conflicts:
	Vocaluxe/Screens/CScreenNames.cs
This commit is contained in:
Flamefire committed 2014-03-11 22:38:31 +01:00
commit 45bc144559
12 files changed
+238 -243

No files matched your search

+9
View File
@@ -47,6 +47,15 @@ namespace VocaluxeLib
return (int)result;
}
public static T Clamp<T>(this T val, T min, T max) where T : IComparable<T>
{
if (val.CompareTo(min) < 0)
return min;
if (val.CompareTo(max) > 0)
return max;
return val;
}
/// <summary>
/// Concat strings into one string with ", " as separator.
/// </summary>
+4 -10
View File
@@ -35,15 +35,13 @@ namespace VocaluxeLib.Game
_Rounds[round, player].Points = 0f;
_Rounds[round, player].PointsGoldenNotes = 0f;
_Rounds[round, player].PointsLineBonus = 0f;
_Rounds[round, player].Medley = false;
_Rounds[round, player].Duet = false;
_Rounds[round, player].ShortSong = false;
_Rounds[round, player].GameMode = EGameMode.TR_GAMEMODE_NORMAL;
_Rounds[round, player].SongFinished = false;
}
}
}
public void SetPoints(int round, int songID, SPlayer[] players, bool medley, bool duet, bool shortSong)
public void SetPoints(int round, int songID, SPlayer[] players, EGameMode gameMode)
{
long dateTicks = DateTime.Now.Ticks;
for (int player = 0; player < players.Length; player++)
@@ -53,9 +51,7 @@ namespace VocaluxeLib.Game
_Rounds[round, player].Points = players[player].Points;
_Rounds[round, player].PointsGoldenNotes = players[player].PointsGoldenNotes;
_Rounds[round, player].PointsLineBonus = players[player].PointsLineBonus;
_Rounds[round, player].Medley = medley;
_Rounds[round, player].Duet = duet;
_Rounds[round, player].ShortSong = shortSong;
_Rounds[round, player].GameMode = gameMode;
_Rounds[round, player].DateTicks = dateTicks;
_Rounds[round, player].SongFinished = players[player].SongFinished;
}
@@ -87,9 +83,7 @@ namespace VocaluxeLib.Game
players[p].PointsLineBonus = _Rounds[round, p].PointsLineBonus;
players[p].SongID = _Rounds[round, p].SongID;
players[p].VoiceNr = _Rounds[round, p].VoiceNr;
players[p].Medley = _Rounds[round, p].Medley;
players[p].Duet = _Rounds[round, p].Duet;
players[p].ShortSong = _Rounds[round, p].ShortSong;
players[p].GameMode = _Rounds[round, p].GameMode;
players[p].DateTicks = _Rounds[round, p].DateTicks;
players[p].SongFinished = _Rounds[round, p].SongFinished;
players[p].ProfileID = _Rounds[round, p].ProfileID;
+4 -9
View File
@@ -63,15 +63,10 @@ namespace VocaluxeLib.Songs
{
get
{
int min = int.MaxValue;
int max = int.MinValue;
foreach (T note in _Notes)
{
if (note.Tone < min)
min = note.Tone;
if (note.Tone > max)
max = note.Tone;
}
if (_Notes.Count == 0)
return 0;
int min = _Notes.Min(note => note.Tone);
int max = _Notes.Max(note => note.Tone);
return min - (max - min) / 4;
}
+3 -5
View File
@@ -190,20 +190,18 @@ namespace VocaluxeLib
public int CurrentNote;
public int SongID;
public bool Medley;
public bool Duet;
public bool ShortSong;
public EGameMode GameMode;
public long DateTicks;
public bool SongFinished;
}
public struct SScores
public struct SDBScoreEntry
{
public string Name;
public int Score;
public string Date;
public EGameDifficulty Difficulty;
public int LineNr;
public int VoiceNr;
public int ID;
}