aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-22 00:43:55 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-22 00:43:55 +0000
commit776e4ffb42b0cc5f32c2dcc54745a3537e3bcc15 (patch)
tree977cbd285effba85fbd3a9dbb16a136af17a095f
parentdc3c42586733e84bc5d92c037f837f5a83e96bd9 (diff)
downloadusdx-776e4ffb42b0cc5f32c2dcc54745a3537e3bcc15.tar.gz
usdx-776e4ffb42b0cc5f32c2dcc54745a3537e3bcc15.tar.xz
usdx-776e4ffb42b0cc5f32c2dcc54745a3537e3bcc15.zip
fixed regression of last commit
- now all catcover accesses are type-safe git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2272 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--src/base/UCatCovers.pas32
-rw-r--r--src/base/USongs.pas2
2 files changed, 17 insertions, 17 deletions
diff --git a/src/base/UCatCovers.pas b/src/base/UCatCovers.pas
index 433763d8..55f07daf 100644
--- a/src/base/UCatCovers.pas
+++ b/src/base/UCatCovers.pas
@@ -44,15 +44,15 @@ uses
type
TCatCovers = class
protected
- cNames: array [0..high(ISorting)] of array of UTF8String;
- cFiles: array [0..high(ISorting)] of array of IPath;
+ cNames: array [TSortingType] of array of UTF8String;
+ cFiles: array [TSortingType] of array of IPath;
public
constructor Create;
procedure Load; //Load Cover aus Cover.ini and Cover Folder
procedure LoadPath(const CoversPath: IPath);
- procedure Add(Sorting: integer; const Name: UTF8String; const Filename: IPath); //Add a Cover
- function CoverExists(Sorting: integer; const Name: UTF8String): boolean; //Returns True when a cover with the given Name exists
- function GetCover(Sorting: integer; const Name: UTF8String): IPath; //Returns the Filename of a Cover
+ procedure Add(Sorting: TSortingType; const Name: UTF8String; const Filename: IPath); //Add a Cover
+ function CoverExists(Sorting: TSortingType; const Name: UTF8String): boolean; //Returns True when a cover with the given Name exists
+ function GetCover(Sorting: TSortingType; const Name: UTF8String): IPath; //Returns the Filename of a Cover
end;
var
@@ -91,7 +91,7 @@ procedure TCatCovers.LoadPath(const CoversPath: IPath);
var
Ini: TMemIniFile;
List: TStringlist;
- I, J: Integer;
+ I: Integer;
SortType: TSortingType;
Filename: IPath;
Name, TmpName: UTF8String;
@@ -107,14 +107,14 @@ begin
List := TStringlist.Create;
//Add every Cover in Covers Ini for Every Sorting option
- for I := 0 to High(ISorting) do
+ for SortType := Low(TSortingType) to High(TSortingType) do
begin
- Ini.ReadSection(ISorting[I], List);
+ Ini.ReadSection(ISorting[Ord(SortType)], List);
- for J := 0 to List.Count - 1 do
+ for I := 0 to List.Count - 1 do
begin
- CatCover := Path(Ini.ReadString(ISorting[I], List.Strings[J], 'NoCover.jpg'));
- Add(I, List.Strings[J], CoversPath.Append(CatCover));
+ CatCover := Path(Ini.ReadString(ISorting[Ord(SortType)], List.Strings[I], 'NoCover.jpg'));
+ Add(SortType, List.Strings[I], CoversPath.Append(CatCover));
end;
end;
finally
@@ -140,14 +140,14 @@ begin
else if (SortType = sArtist) and (UTF8Pos('Artist', TmpName) <> 0) then
UTF8Delete(TmpName, UTF8Pos('Artist', TmpName), 6);
- if not CoverExists(I, TmpName) then
- Add(I, TmpName, Filename);
+ if not CoverExists(SortType, TmpName) then
+ Add(SortType, TmpName, Filename);
end;
end;
end;
//Add a Cover
-procedure TCatCovers.Add(Sorting: integer; const Name: UTF8String; const Filename: IPath);
+procedure TCatCovers.Add(Sorting: TSortingType; const Name: UTF8String; const Filename: IPath);
begin
if Filename.IsFile then //If Exists -> Add
begin
@@ -160,7 +160,7 @@ begin
end;
//Returns True when a cover with the given Name exists
-function TCatCovers.CoverExists(Sorting: integer; const Name: UTF8String): boolean;
+function TCatCovers.CoverExists(Sorting: TSortingType; const Name: UTF8String): boolean;
var
I: Integer;
UpperName: UTF8String;
@@ -179,7 +179,7 @@ begin
end;
//Returns the Filename of a Cover
-function TCatCovers.GetCover(Sorting: integer; const Name: UTF8String): IPath;
+function TCatCovers.GetCover(Sorting: TSortingType; const Name: UTF8String): IPath;
var
I: Integer;
UpperName: UTF8String;
diff --git a/src/base/USongs.pas b/src/base/USongs.pas
index 0056d75b..cfc32a99 100644
--- a/src/base/USongs.pas
+++ b/src/base/USongs.pas
@@ -486,7 +486,7 @@ var
Song[CatIndex].Main := true;
Song[CatIndex].OrderTyp := 0;
Song[CatIndex].OrderNum := Order;
- Song[CatIndex].Cover := CatCovers.GetCover(Ini.Sorting, CategoryName);
+ Song[CatIndex].Cover := CatCovers.GetCover(TSortingType(Ini.Sorting), CategoryName);
Song[CatIndex].Visible := true;
// set number of songs in previous category