aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UDataBase.pas
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code/Classes/UDataBase.pas')
-rw-r--r--Game/Code/Classes/UDataBase.pas30
1 files changed, 30 insertions, 0 deletions
diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas
index 586e742d..40079b1e 100644
--- a/Game/Code/Classes/UDataBase.pas
+++ b/Game/Code/Classes/UDataBase.pas
@@ -57,6 +57,8 @@ type
function GetHandicap(P1: string; P2: string): THandicapResult; //for Handicap-Mode
function GetAspect(Artist, Title: string; def: integer): integer;
procedure SetAspect(Artist, Title: string; aspect: integer);
+
+ function GetMaxScore(Artist, Title: string; difficulty: integer): integer;
end;
var
@@ -119,6 +121,34 @@ begin
end;
end;
+function TDataBaseSystem.GetMaxScore(Artist, Title: string; difficulty: integer): integer;
+var
+ ID: Integer;
+ tArtist, tTitle: string;
+
+begin
+ Result := 0;
+
+ if not Assigned(ScoreDB) then
+ Exit;
+
+ try
+ tArtist := StringReplace(Artist,'"','""',[rfReplaceAll, rfIgnoreCase]);
+ tTitle := StringReplace(Title,'"','""',[rfReplaceAll, rfIgnoreCase]);
+
+ ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' +
+ tArtist + '" AND `Title` = "' + tTitle + '"');
+
+ if ID <> 0 then
+ begin
+ Result := ScoreDB.GetTableValue('SELECT MAX(`Score`) FROM `US_Scores` WHERE `SongID` = "' +
+ IntToStr(ID) + '" AND `Difficulty` = "' + IntToStr(difficulty) + '"');
+ end;
+ except
+ Result := 0;
+ end;
+end;
+
function TDataBaseSystem.GetAspect(Artist, Title: string; def: integer): integer;
var
ID: Integer;