aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UPlaylist.pas
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code/Classes/UPlaylist.pas')
-rw-r--r--Game/Code/Classes/UPlaylist.pas38
1 files changed, 36 insertions, 2 deletions
diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas
index 66bd8189..36bbf051 100644
--- a/Game/Code/Classes/UPlaylist.pas
+++ b/Game/Code/Classes/UPlaylist.pas
@@ -47,7 +47,9 @@ type
Procedure DelItem(const iItem: Cardinal; const iPlaylist: Integer = -1);
Procedure GetNames(var PLNames: array of String);
+ Procedure GetNamesAndNumSongs(var PLNames: array of String);
Function GetIndexbySongID(const SongID: Cardinal; const iPlaylist: Integer = -1): Integer;
+ Function GetNumSongs(Index: Cardinal): integer;
end;
{Modes:
@@ -414,13 +416,13 @@ end;
//----------
//GetNames - Writes Playlist Names in a Array
//----------
-Procedure TPlayListManager.GetNames(var PLNames: array of String);
+Procedure TPlayListManager.GetNames(var PLNames: array of String);
var
I: Integer;
Len: Integer;
begin
Len := High(Playlists);
-
+
if (Length(PLNames) <> Len + 1) then
exit;
@@ -429,6 +431,23 @@ begin
end;
//----------
+//GetNamesAndNumSongs - Writes Playlist Names + Num Songs in an Array
+//----------
+Procedure TPlayListManager.GetNamesAndNumSongs(var PLNames: array of String);
+var
+ I: Integer;
+ Len: Integer;
+begin
+ Len := High(Playlists);
+
+ if (Length(PLNames) <> Len + 1) then
+ exit;
+
+ For I := 0 to Len do
+ PLNames[I] := Playlists[I].Name + ' ( ' + IntToStr(GetNumSongs(I)) + ' Songs)';
+end;
+
+//----------
//GetIndexbySongID - Returns Index in the specified Playlist of the given Song
//----------
Function TPlayListManager.GetIndexbySongID(const SongID: Cardinal; const iPlaylist: Integer): Integer;
@@ -455,4 +474,19 @@ begin
end;
end;
+function TPlayListManager.GetNumSongs(Index: Cardinal): integer;
+var
+ I: integer;
+
+begin
+ Result := 0;
+
+ //Count Songs in Playlist
+ For I := 0 to high(PlayLists[Index].Items) do
+ begin
+ if (ScreenSong.Mode=smNormal) or not CatSongs.Song[PlayLists[Index].Items[I].SongID].isDuet then
+ Inc(Result);
+ end;
+end;
+
end.