aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-03-09 18:48:19 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-03-09 18:48:19 +0000
commit65ba06b73c91c92a99f2ed88432e05a1b694531d (patch)
tree412b8cacd259e0271984c1f7306865ec0144e600 /Game/Code
parentaceec1dc77e57c20d73e2430c0168a6449b46210 (diff)
downloadusdx-65ba06b73c91c92a99f2ed88432e05a1b694531d.tar.gz
usdx-65ba06b73c91c92a99f2ed88432e05a1b694531d.tar.xz
usdx-65ba06b73c91c92a99f2ed88432e05a1b694531d.zip
Fixed some warnings ("missing result-values", "0 instead of nil", "comparison is always true", "range check errors")
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@946 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/TextGL.pas2
-rw-r--r--Game/Code/Classes/UCore.pas22
-rw-r--r--Game/Code/Classes/UDataBase.pas33
-rw-r--r--Game/Code/Classes/USong.pas2
4 files changed, 34 insertions, 25 deletions
diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas
index c29648c3..314d31de 100644
--- a/Game/Code/Classes/TextGL.pas
+++ b/Game/Code/Classes/TextGL.pas
@@ -434,7 +434,7 @@ intermediary := SDL_CreateRGBSurface(0, w, h, 32,
SDL_SetAlpha(intermediary, 0, 255);
SDL_SetAlpha(sText, 0, 255);
- SDL_BlitSurface(sText, 0, intermediary, 0);
+ SDL_BlitSurface(sText, nil, intermediary, nil);
glGenTextures(1, @texture);
diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas
index cb176e29..7f05289b 100644
--- a/Game/Code/Classes/UCore.pas
+++ b/Game/Code/Classes/UCore.pas
@@ -174,15 +174,15 @@ begin
If noError then
begin
//Call Translate Hook
- noError := (Hooks.CallEventChain(hTranslate, 0, 0) = 0);
+ noError := (Hooks.CallEventChain(hTranslate, 0, nil) = 0);
If noError then
begin //Calls LoadTextures Hook
- noError := (Hooks.CallEventChain(hLoadTextures, 0, 0) = 0);
+ noError := (Hooks.CallEventChain(hLoadTextures, 0, nil) = 0);
if noError then
begin //Calls Loading Finished Hook
- noError := (Hooks.CallEventChain(hLoadingFinished, 0, 0) = 0);
+ noError := (Hooks.CallEventChain(hLoadingFinished, 0, nil) = 0);
If noError then
begin
@@ -263,17 +263,18 @@ var
I: Integer;
begin
Result := False;
- try
- For I := 0 to high(Modules) do
- begin
+ for I := 0 to high(Modules) do
+ begin
+ try
Modules[I].NeedsDeInit := False;
Modules[I].Module := CORE_MODULES_TO_LOAD[I].Create;
Modules[I].Module.Info(@Modules[I].Info);
+ except
+ ReportError(Integer(PChar('Can''t get module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), PChar('Core'));
+ Exit;
end;
- Result := True;
- except
- ReportError(Integer(PChar('Can''t get module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), PChar('Core'));
end;
+ Result := True;
end;
//-------------
@@ -350,6 +351,8 @@ begin
GoTo Continue;
DeInitCore;
+
+ Result := true;
end;
//-------------
@@ -397,6 +400,7 @@ begin
// to-do : write TService-/HookManager.Free and call it here
+ Result := true;
end;
//-------------
diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas
index 27d3f6bf..ef3c28fe 100644
--- a/Game/Code/Classes/UDataBase.pas
+++ b/Game/Code/Classes/UDataBase.pas
@@ -123,7 +123,7 @@ end;
procedure TDataBaseSystem.ReadScore(var Song: TSong);
var
TableData: TSqliteTable;
- Dif: Byte;
+ Difficulty: Integer;
begin
if not assigned( ScoreDB ) then
exit;
@@ -140,29 +140,31 @@ begin
SetLength (Song.Score[1], 0);
SetLength (Song.Score[2], 0);
- while not TableData.Eof do//Go through all Entrys
- begin//Add one Entry to Array
- Dif := StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Difficulty']));
- if (Dif>=0) AND (Dif<=2) then
+ while not TableData.Eof do //Go through all Entrys
+ begin //Add one Entry to Array
+ Difficulty := StrToIntDef(TableData.FieldAsString(TableData.FieldIndex['Difficulty']), -1);
+ if (Difficulty >= 0) AND (Difficulty <= 2) then
begin
- SetLength(Song.Score[Dif], Length(Song.Score[Dif]) + 1);
+ SetLength(Song.Score[Difficulty], Length(Song.Score[Difficulty]) + 1);
- Song.Score[Dif, high(Song.Score[Dif])].Name := TableData.FieldAsString(TableData.FieldIndex['Player']);
- Song.Score[Dif, high(Song.Score[Dif])].Score := StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Score']));
+ Song.Score[Difficulty, high(Song.Score[Difficulty])].Name :=
+ TableData.FieldAsString(TableData.FieldIndex['Player']);
+ Song.Score[Difficulty, high(Song.Score[Difficulty])].Score :=
+ StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Score']));
end;
TableData.Next;
end; // While not TableData.EOF
- except //In case of error (LOL? isn't this obvious)
- for Dif := 0 to 2 do
+ except
+ for Difficulty := 0 to 2 do
begin
- SetLength(Song.Score[Dif], 1);
- Song.Score[Dif, 1].Name := 'Error Reading ScoreDB';
+ SetLength(Song.Score[Difficulty], 1);
+ Song.Score[Difficulty, 1].Name := 'Error Reading ScoreDB';
end;
end;
- finally // Try Finally
+ finally
//ScoreDb.Free;
end;
end;
@@ -322,8 +324,11 @@ end;
Function TDataBaseSystem.GetTotalEntrys(const Typ: Byte): Cardinal;
var Query: String;
begin
+ Result := 0;
+
if not assigned( ScoreDB ) then
exit;
+
try
//Create Query
Case Typ of
@@ -355,7 +360,7 @@ begin
on E:ESQLiteException DO // used to handle : Could not retrieve data "SELECT COUNT(`ID`) FROM `US_Songs`;" : SQL logic error or missing database
// however, we should pre-empt this error... and make sure the database DOES exist.
begin
- result := 0;
+ exit;
end;
end;
diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas
index 65bd215a..940f2779 100644
--- a/Game/Code/Classes/USong.pas
+++ b/Game/Code/Classes/USong.pas
@@ -672,7 +672,7 @@ begin
{$IFDEF FPC}
setlength( BPM, 0 );
{$ELSE}
- BPM := 0;
+ BPM := nil;
{$ENDIF}
GAP := 0;