diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-08-15 18:40:22 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-08-15 18:40:22 +0000 |
commit | 0a2abc145a59bfb2b0e0402a86115fa2da53c681 (patch) | |
tree | 8bdbe6a44697096bca21803d7c5ead94c8c12438 /Game/Code/Classes/UCatCovers.pas | |
parent | 0c5f07f9e3b9bcc7bf2ae9c81c7d6525514fef56 (diff) | |
download | usdx-0a2abc145a59bfb2b0e0402a86115fa2da53c681.tar.gz usdx-0a2abc145a59bfb2b0e0402a86115fa2da53c681.tar.xz usdx-0a2abc145a59bfb2b0e0402a86115fa2da53c681.zip |
- Support for multiple song/cover paths.
- Add multiple Song-Paths to the Ini file:
[Directories]
SongDir1=C:\...
SongDir2=D:\...
SongDirA=D:\...
- UIni.pas clean-up
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1266 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/UCatCovers.pas')
-rw-r--r-- | Game/Code/Classes/UCatCovers.pas | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/Game/Code/Classes/UCatCovers.pas b/Game/Code/Classes/UCatCovers.pas index 8e7a2f62..d8f6cdb0 100644 --- a/Game/Code/Classes/UCatCovers.pas +++ b/Game/Code/Classes/UCatCovers.pas @@ -13,11 +13,12 @@ uses UIni; type TCatCovers = class protected - cNames: array [low(ISorting)..high(ISorting)] of array of string; - cFiles: array [low(ISorting)..high(ISorting)] of array of string; + cNames: array [0..high(ISorting)] of array of string; + cFiles: array [0..high(ISorting)] of array of string; public constructor Create; procedure Load; //Load Cover aus Cover.ini and Cover Folder + procedure LoadPath(const CoversPath: string); procedure Add(Sorting: integer; Name, Filename: string); //Add a Cover function CoverExists(Sorting: integer; Name: string): boolean; //Returns True when a cover with the given Name exists function GetCover(Sorting: integer; Name: string): string; //Returns the Filename of a Cover @@ -42,9 +43,19 @@ begin Load; end; - //Load Cover aus Cover.ini and Cover Folder procedure TCatCovers.Load; var + I: integer; +begin + for I := 0 to CoverPaths.Count-1 do + LoadPath(CoverPaths[I]); +end; + +(** + * Load Cover from Cover.ini and Cover Folder + *) +procedure TCatCovers.LoadPath(const CoversPath: string); +var Ini: TMemIniFile; SR: TSearchRec; List: TStringlist; @@ -59,7 +70,7 @@ begin List := TStringlist.Create; //Add every Cover in Covers Ini for Every Sorting option - for I := low(ISorting) to high(ISorting) do + for I := 0 to High(ISorting) do begin Ini.ReadSection(ISorting[I], List); @@ -80,7 +91,7 @@ begin Filename := CoversPath + Name; Delete (Name, length(Name) - 3, 4); - for I := low(ISorting) to high(ISorting) do + for I := 0 to high(ISorting) do begin Temp := Name; if ((I = sTitle) or (I = sTitle2)) and (Pos ('Title', Temp) <> 0) then @@ -118,7 +129,7 @@ begin Result := False; Name := Uppercase(Name); //Case Insensitiv - for I := low(cNames[Sorting]) to high(cNames[Sorting]) do + for I := 0 to high(cNames[Sorting]) do begin if (cNames[Sorting][I] = Name) then //Found Name begin @@ -131,12 +142,12 @@ end; //Returns the Filename of a Cover function TCatCovers.GetCover(Sorting: integer; Name: string): string; var -I: Integer; + I: Integer; begin Result := ''; Name := Uppercase(Name); - for I := low(cNames[Sorting]) to high(cNames[Sorting]) do + for I := 0 to high(cNames[Sorting]) do begin if cNames[Sorting][I] = Name then begin @@ -146,8 +157,17 @@ begin end; //No Cover - if (Result = '') AND (FileExists(CoversPath + 'NoCover.jpg')) then - Result := CoversPath + 'NoCover.jpg'; + if (Result = '') then + begin + for I := 0 to CoverPaths.Count-1 do + begin + if (FileExists(CoverPaths[I] + 'NoCover.jpg')) then + begin + Result := CoverPaths[I] + 'NoCover.jpg'; + Break; + end; + end; + end; end; end. |