From 7f0f49979ee27f76d8dff3786194df1f43d4300f Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Tue, 28 Dec 2010 06:46:38 +0000 Subject: don't close menu when adding songs git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2776 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlaylist.pas | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Game/Code/Classes/UPlaylist.pas') diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 36bbf051..7fa621ae 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -43,6 +43,8 @@ type Function AddPlaylist(Name: String): Cardinal; Procedure DelPlaylist(const Index: Cardinal); + Function SongExists(const SongID: Cardinal; const iPlaylist: Integer): boolean; + Procedure AddItem(const SongID: Cardinal; const iPlaylist: Integer = -1); Procedure DelItem(const iItem: Cardinal; const iPlaylist: Integer = -1); @@ -342,6 +344,30 @@ begin end; end; +Function TPlayListManager.SongExists(const SongID: Cardinal; const iPlaylist: Integer): boolean; +var + P: Cardinal; + I: Cardinal; +begin + Result := false; + + if iPlaylist = -1 then + P := CurPlaylist + else if (iPlaylist >= 0) AND (iPlaylist <= high(Playlists)) then + P := iPlaylist + else + exit; + + if (SongID <= High(CatSongs.Song)) AND (NOT CatSongs.Song[SongID].Main) then + begin + for I := 0 to High(Playlists[P].Items) do + begin + if (Playlists[P].Items[I].SongID = SongID) then + Result := true; + end; + end; +end; + //---------- //AddItem - Adds an Item to a specific Playlist //---------- -- cgit v1.2.3