From 06dd168485ab960930c907976e242b28c6a621ff Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 12 Jul 2008 16:47:43 +0000 Subject: cleanup + comments git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1187 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'Game/Code/Classes/USongs.pas') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index a1ab86f9..fb423ff7 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -696,22 +696,35 @@ begin end; //Wrong song selected when tabs on bug End +(** + * Returns the number of visible songs. + *) function TCatSongs.VisibleSongs: integer; var - S: integer; // song + SongIndex: integer; begin Result := 0; - for S := 0 to high(CatSongs.Song) do - if CatSongs.Song[S].Visible = true then Inc(Result); + for SongIndex := 0 to High(CatSongs.Song) do + begin + if (CatSongs.Song[SongIndex].Visible) then + Inc(Result); + end; end; +(** + * Returns the index of a song in the subset of all visible songs. + * If all songs are visible, the result will be equal to the Index parameter. + *) function TCatSongs.VisibleIndex(Index: integer): integer; var - S: integer; // song + SongIndex: integer; begin Result := 0; - for S := 0 to Index-1 do - if CatSongs.Song[S].Visible = true then Inc(Result); + for SongIndex := 0 to Index-1 do + begin + if (CatSongs.Song[SongIndex].Visible) then + Inc(Result); + end; end; function TCatSongs.SetFilter(FilterStr: string; const fType: Byte): Cardinal; -- cgit v1.2.3