diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-05-08 18:31:08 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-05-08 18:31:08 +0000 |
commit | 2a708a74d0a2e9a26caeb6bacf9f252102c89326 (patch) | |
tree | ef5ae378fdf4430297e25f052f29fc862f02b9e0 /Game/Code/Classes | |
parent | 9aa48684216b0dca926fa7e68a1b843dc1a872ce (diff) | |
download | usdx-2a708a74d0a2e9a26caeb6bacf9f252102c89326.tar.gz usdx-2a708a74d0a2e9a26caeb6bacf9f252102c89326.tar.xz usdx-2a708a74d0a2e9a26caeb6bacf9f252102c89326.zip |
added "inherited ..." to all constructors to assure that the base-class constructor is called.
Different to C or Java, the constructor or destructor of the base class (except that of TObject) is not called by default if "inherited ..." is not given (very strange). This is no problem with classes inherited directly from TObject, because the TObject constructor is always called (and sets the values of the fields to 0-values) but i added inherited to these constructors too because the base class may change from TObject to something different and the "inherited" will probably not added in this case and causing problems.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1070 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes')
31 files changed, 130 insertions, 97 deletions
diff --git a/Game/Code/Classes/UCatCovers.pas b/Game/Code/Classes/UCatCovers.pas index 516544be..d8cebffa 100644 --- a/Game/Code/Classes/UCatCovers.pas +++ b/Game/Code/Classes/UCatCovers.pas @@ -24,18 +24,21 @@ type end;
var
-CatCovers: TCatCovers;
+ CatCovers: TCatCovers;
implementation
-uses IniFiles,
- SysUtils,
- Classes,
- // UFiles,
- UMain,
- ULog;
+
+uses
+ IniFiles,
+ SysUtils,
+ Classes,
+ // UFiles,
+ UMain,
+ ULog;
constructor TCatCovers.Create;
begin
+ inherited;
Load;
end;
@@ -48,104 +51,100 @@ var I, J: Integer;
Name, Filename, Temp: string;
begin
-try
- Ini := TMemIniFile.Create(CoversPath + 'covers.ini');
- List := TStringlist.Create;
-
- //Add every Cover in Covers Ini for Every Sorting option
- for I := low(ISorting) to high(ISorting) do
- begin
- Ini.ReadSection(ISorting[I], List);
-
- for J := 0 to List.Count - 1 do
- Add(I, List.Strings[J], CoversPath + Ini.ReadString(ISorting[I], List.Strings[J], 'NoCover.jpg'));
+ try
+ Ini := TMemIniFile.Create(CoversPath + 'covers.ini');
+ List := TStringlist.Create;
+
+ //Add every Cover in Covers Ini for Every Sorting option
+ for I := low(ISorting) to high(ISorting) do
+ begin
+ Ini.ReadSection(ISorting[I], List);
+
+ for J := 0 to List.Count - 1 do
+ Add(I, List.Strings[J], CoversPath + Ini.ReadString(ISorting[I], List.Strings[J], 'NoCover.jpg'));
+ end;
+ finally
+ Ini.Free;
+ List.Free;
end;
-finally
- Ini.Free;
- List.Free;
-end;
-
-try
- //Add Covers from Folder
- if (FindFirst (CoversPath + '*.jpg', faAnyFile, SR) = 0) then
- repeat
- //Add Cover if it doesn't exist for every Section
- Name := SR.Name;
- Filename := CoversPath + Name;
- Delete (Name, length(Name) - 3, 4);
-
- for I := low(ISorting) to high(ISorting) do
- begin
- Temp := Name;
- if ((I = sTitle) or (I = sTitle2)) and (Pos ('Title', Temp) <> 0) then
- Delete (Temp, Pos ('Title', Temp), 5)
- else if (I = sArtist) or (I = sArtist2) and (Pos ('Artist', Temp) <> 0) then
- Delete (Temp, Pos ('Artist', Temp), 6);
-
- if not CoverExists(I, Temp) then
- Add (I, Temp, Filename);
- end;
- until FindNext (SR) <> 0;
-
-finally
- FindClose (SR);
-end;
-
+ try
+ //Add Covers from Folder
+ if (FindFirst (CoversPath + '*.jpg', faAnyFile, SR) = 0) then
+ repeat
+ //Add Cover if it doesn't exist for every Section
+ Name := SR.Name;
+ Filename := CoversPath + Name;
+ Delete (Name, length(Name) - 3, 4);
+
+ for I := low(ISorting) to high(ISorting) do
+ begin
+ Temp := Name;
+ if ((I = sTitle) or (I = sTitle2)) and (Pos ('Title', Temp) <> 0) then
+ Delete (Temp, Pos ('Title', Temp), 5)
+ else if (I = sArtist) or (I = sArtist2) and (Pos ('Artist', Temp) <> 0) then
+ Delete (Temp, Pos ('Artist', Temp), 6);
+
+ if not CoverExists(I, Temp) then
+ Add (I, Temp, Filename);
+ end;
+ until FindNext (SR) <> 0;
+ finally
+ FindClose (SR);
+ end;
end;
//Add a Cover
procedure TCatCovers.Add(Sorting: integer; Name, Filename: string);
begin
-if FileExists (Filename) then //If Exists -> Add
-begin
-SetLength (CNames[Sorting], Length(CNames[Sorting]) + 1);
-SetLength (CFiles[Sorting], Length(CNames[Sorting]) + 1);
+ if FileExists (Filename) then //If Exists -> Add
+ begin
+ SetLength (CNames[Sorting], Length(CNames[Sorting]) + 1);
+ SetLength (CFiles[Sorting], Length(CNames[Sorting]) + 1);
-CNames[Sorting][high(cNames[Sorting])] := Uppercase(Name);
-CFiles[Sorting][high(cNames[Sorting])] := FileName;
-end;
+ CNames[Sorting][high(cNames[Sorting])] := Uppercase(Name);
+ CFiles[Sorting][high(cNames[Sorting])] := FileName;
+ end;
end;
//Returns True when a cover with the given Name exists
function TCatCovers.CoverExists(Sorting: integer; Name: string): boolean;
var
-I: Integer;
+ I: Integer;
begin
-Result := False;
-Name := Uppercase(Name); //Case Insensitiv
+ Result := False;
+ Name := Uppercase(Name); //Case Insensitiv
-for I := low(cNames[Sorting]) to high(cNames[Sorting]) do
-begin
- if (cNames[Sorting][I] = Name) then //Found Name
+ for I := low(cNames[Sorting]) to high(cNames[Sorting]) do
begin
- Result := true;
- break; //Break For Loop
+ if (cNames[Sorting][I] = Name) then //Found Name
+ begin
+ Result := true;
+ break; //Break For Loop
+ end;
end;
end;
-end;
//Returns the Filename of a Cover
function TCatCovers.GetCover(Sorting: integer; Name: string): string;
var
I: Integer;
begin
-Result := '';
-Name := Uppercase(Name);
+ Result := '';
+ Name := Uppercase(Name);
-for I := low(cNames[Sorting]) to high(cNames[Sorting]) do
-begin
- if cNames[Sorting][I] = Name then
+ for I := low(cNames[Sorting]) to high(cNames[Sorting]) do
begin
- Result := cFiles[Sorting][I];
- Break;
+ if cNames[Sorting][I] = Name then
+ begin
+ Result := cFiles[Sorting][I];
+ Break;
+ end;
end;
-end;
-
-//No Cover
-if (Result = '') AND (FileExists(CoversPath + 'NoCover.jpg')) then
- Result := CoversPath + 'NoCover.jpg';
+ //No Cover
+ if (Result = '') AND (FileExists(CoversPath + 'NoCover.jpg')) then
+ Result := CoversPath + 'NoCover.jpg';
end;
end.
diff --git a/Game/Code/Classes/UCommandLine.pas b/Game/Code/Classes/UCommandLine.pas index e7398b50..03e5c9d3 100644 --- a/Game/Code/Classes/UCommandLine.pas +++ b/Game/Code/Classes/UCommandLine.pas @@ -72,7 +72,8 @@ uses SysUtils, //------------- Constructor TCMDParams.Create; begin - + inherited; + if FindCmdLineSwitch( cHelp ) or FindCmdLineSwitch( 'h' ) then showhelp(); diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index 2c73db25..026c2850 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -692,8 +692,8 @@ end; * output-list. If we only had In- and OutList parameters we had to merge into
* InList after the recursive calls and copy the data to the OutList afterwards.
*)
-function _MergeSort(InList, TempList, OutList: TList; StartPos, BlockSize: integer;
- CompareFunc: TListSortCompare): TList;
+procedure _MergeSort(InList, TempList, OutList: TList; StartPos, BlockSize: integer;
+ CompareFunc: TListSortCompare);
var
LeftSize, RightSize: integer; // number of elements in left/right block
LeftEnd, RightEnd: integer; // Index after last element in left/right block
diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index f28b54f2..ac29e727 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -128,6 +128,8 @@ uses {$IFDEF win32} //-------------
Constructor TCore.Create(const cName: String; const cVersion: LongWord);
begin
+ inherited Create;
+
Name := cName;
Version := cVersion;
iLastExecuted := 0;
diff --git a/Game/Code/Classes/UCoreModule.pas b/Game/Code/Classes/UCoreModule.pas index a7ad3b4e..031fb04e 100644 --- a/Game/Code/Classes/UCoreModule.pas +++ b/Game/Code/Classes/UCoreModule.pas @@ -59,6 +59,7 @@ implementation Constructor TCoreModule.Create; begin //Dummy maaaan ;) + inherited; end; //------------- @@ -121,6 +122,7 @@ end; Destructor TCoreModule.Destroy; begin //Dummy ftw!! + inherited; end; end. diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index 9cd7af10..3a5b4f50 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -57,6 +57,7 @@ uses UMain, constructor TCovers.Create; begin + inherited; W := 128; H := 128; Size := W*H*3; diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas index cbe79c3c..3d32a72a 100644 --- a/Game/Code/Classes/UDLLManager.pas +++ b/Game/Code/Classes/UDLLManager.pas @@ -68,6 +68,7 @@ uses {$IFDEF MSWINDOWS} constructor TDLLMan.Create; begin + inherited; SetLength(Plugins, 0); SetLength(PluginPaths, Length(Plugins)); GetPluginList; diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index f7f39634..8f5ebf50 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -118,9 +118,9 @@ end; //-------------------- Destructor TDataBaseSystem.Destroy; begin - debugWriteln( 'TDataBaseSystem.Free' ); - + Log.LogInfo('TDataBaseSystem.Free', 'TDataBaseSystem.Destroy'); freeandnil( ScoreDB ); + inherited; end; //-------------------- diff --git a/Game/Code/Classes/UHooks.pas b/Game/Code/Classes/UHooks.pas index 9c9e7dca..f0ba3276 100644 --- a/Game/Code/Classes/UHooks.pas +++ b/Game/Code/Classes/UHooks.pas @@ -76,6 +76,8 @@ uses constructor THookManager.Create(const SpacetoAllocate: Word); var I: Integer; begin + inherited Create(); + //Get the Space and "Zero" it SetLength (Events, SpacetoAllocate); For I := 0 to SpacetoAllocate-1 do diff --git a/Game/Code/Classes/UJoystick.pas b/Game/Code/Classes/UJoystick.pas index cd7171d6..59a1221b 100644 --- a/Game/Code/Classes/UJoystick.pas +++ b/Game/Code/Classes/UJoystick.pas @@ -48,6 +48,8 @@ constructor TJoy.Create; var
B, N: integer;
begin
+ inherited;
+
//Old Corvus5 Method
{// joystick support
SDL_JoystickEventState(SDL_IGNORE);
diff --git a/Game/Code/Classes/ULCD.pas b/Game/Code/Classes/ULCD.pas index 13736729..4bbddf46 100644 --- a/Game/Code/Classes/ULCD.pas +++ b/Game/Code/Classes/ULCD.pas @@ -119,7 +119,7 @@ end; constructor TLCD.Create;
begin
-//
+ inherited;
end;
procedure TLCD.Enable;
diff --git a/Game/Code/Classes/ULanguage.pas b/Game/Code/Classes/ULanguage.pas index dc07c298..d534b4e1 100644 --- a/Game/Code/Classes/ULanguage.pas +++ b/Game/Code/Classes/ULanguage.pas @@ -61,6 +61,8 @@ constructor TLanguage.Create; var I, J: Integer; begin + inherited; + LoadList; //Set Implode Glues for Backward Compatibility diff --git a/Game/Code/Classes/ULight.pas b/Game/Code/Classes/ULight.pas index b0ff9d6b..f91d614c 100644 --- a/Game/Code/Classes/ULight.pas +++ b/Game/Code/Classes/ULight.pas @@ -82,6 +82,7 @@ uses constructor TLight.Create; begin + inherited; Enabled := false; end; diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 1d710387..9cfddcfc 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -128,6 +128,7 @@ end; constructor TLog.Create;
begin
+ inherited;
LogLevel := LOG_LEVEL_DEFAULT;
LogFileLevel := LOG_FILE_LEVEL_DEFAULT;
FileOutputEnabled := true;
@@ -141,6 +142,7 @@ begin // CloseFile(AnalyzeFile);
if LogFileOpened then
CloseFile(LogFile);
+ inherited;
end;
procedure TLog.BenchmarkStart(Number: integer);
diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index b542b5f6..05d7682e 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -157,6 +157,8 @@ end; //---------------
Constructor TLyricEngine.Create;
begin
+ inherited;
+
BPM := 0;
Resolution := 0;
LCounter := 0;
@@ -194,7 +196,7 @@ end; //---------------
Destructor TLyricEngine.Destroy;
begin
-
+ inherited;
end;
//---------------
diff --git a/Game/Code/Classes/ULyrics_bak.pas b/Game/Code/Classes/ULyrics_bak.pas index c99b846f..06361911 100644 --- a/Game/Code/Classes/ULyrics_bak.pas +++ b/Game/Code/Classes/ULyrics_bak.pas @@ -116,6 +116,7 @@ Constructor TLyric.Create; var I: Integer; begin + inherited; //Only 2 Players for now For I := 0 to 1 do begin diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index f576400d..dcdcd710 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -91,6 +91,7 @@ end; constructor Tmedia_dummy.create();
begin
+ inherited;
end;
procedure Tmedia_dummy.init();
diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 93dd15de..4e0291cf 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -319,6 +319,7 @@ var constructor TAudioFormatInfo.Create(Channels: byte; SampleRate: double; Format: TAudioSampleFormat); begin + inherited Create(); Self.Channels := Channels; Self.SampleRate := SampleRate; Self.Format := Format; @@ -484,12 +485,14 @@ end; constructor TSoundLibrary.Create(); begin + inherited; LoadSounds(); end; destructor TSoundLibrary.Destroy(); begin UnloadSounds(); + inherited; end; procedure TSoundLibrary.LoadSounds(); diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index b7670c67..9fdcf7a6 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -102,6 +102,7 @@ end; //-------------
Constructor TPartySession.Create;
begin
+ inherited;
//UnSet PartyMode
bPartyMode := False;
end;
@@ -151,6 +152,7 @@ Destructor TPartySession.Destroy; begin
//Just save some Memory if it wasn't done now..
SetLength(Modis, 0);
+ inherited;
end;
//-------------
diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 4f181d73..a08f33ec 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -83,6 +83,7 @@ uses USongs, //---------- constructor TPlayListManager.Create; begin + inherited; LoadPlayLists; end; diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index 2f62f441..6faac2b6 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -368,6 +368,7 @@ constructor TAudioInputProcessor.Create; var i: integer; begin + inherited; SetLength(Sound, 6 {max players});//Ini.Players+1); for i := 0 to High(Sound) do begin diff --git a/Game/Code/Classes/UServices.pas b/Game/Code/Classes/UServices.pas index cb03248e..6a73521d 100644 --- a/Game/Code/Classes/UServices.pas +++ b/Game/Code/Classes/UServices.pas @@ -78,6 +78,8 @@ uses //------------
Constructor TServiceManager.Create;
begin
+ inherited;
+
FirstService := nil;
LastService := nil;
@@ -233,11 +235,9 @@ begin If (Service.isClass) then
//Use Proc of Class
- // FIXME: "function ... of object" does not fit into an integer (2x pointers: object + function-code -> 8byte on x86)
Result := Service.ProcOfClass(wParam, lParam)
Else
//Use normal Proc
- // FIXME: will not work with x64 CPUs, pointers will be 64bit there
Result := Service.Proc(wParam, lParam);
//Restore CurExecuted
diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas index 07ef2e40..dd326356 100644 --- a/Game/Code/Classes/USingScores.pas +++ b/Game/Code/Classes/USingScores.pas @@ -199,6 +199,8 @@ uses SDL, //----------- Constructor TSingScores.Create; begin + inherited; + //Clear PopupList Pointers FirstPopUp := nil; LastPopUp := nil; diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index 76a64de0..8d4ef706 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -51,6 +51,7 @@ uses IniFiles, constructor TSkin.Create; begin + inherited; LoadList; // LoadSkin('Lisek'); // SkinColor := Color; diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas index 3c365720..66e6f680 100644 --- a/Game/Code/Classes/USong.pas +++ b/Game/Code/Classes/USong.pas @@ -124,10 +124,13 @@ uses constructor TSong.Create(); begin + inherited; end; constructor TSong.Create( const aFileName : WideString ); begin + inherited Create(); + Mult := 1; MultBPM := 4; fFileName := aFileName; diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index ebc42efe..dfe79c97 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -164,6 +164,7 @@ end; destructor TSongs.destroy(); begin freeandnil( SongList ); + inherited; end; procedure TSongs.DoDirChanged(Sender: TObject); diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index f38871a9..805bf51a 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -65,7 +65,7 @@ type Align: integer;
Text: string;
//Reflection
- Reflection: boolean; + Reflection: boolean;
ReflectionSpacing: Real;
end;
AThemeText = array of TThemeText;
@@ -767,6 +767,8 @@ end; constructor TTheme.Create(FileName: string; Color: integer);
begin
+ inherited Create();
+
Loading := TThemeLoading.Create;
Main := TThemeMain.Create;
Name := TThemeName.Create;
@@ -1467,7 +1469,7 @@ begin ThemeText.Color := ThemeIni.ReadString(Name, 'Color', '');
//Reflection
- ThemeText.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0)) = 1; + ThemeText.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0)) = 1;
ThemeText.Reflectionspacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15);
C := ColorExists(ThemeText.Color);
diff --git a/Game/Code/Classes/UTime.pas b/Game/Code/Classes/UTime.pas index 2bc77a9c..bd03754d 100644 --- a/Game/Code/Classes/UTime.pas +++ b/Game/Code/Classes/UTime.pas @@ -48,6 +48,7 @@ http://www.gamedev.net/community/forums/topic.asp?topic_id=466145&whichpage=1%EE constructor TTime.Create; begin + inherited; CountSkipTimeSet; end; diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index f0f710a2..185a693d 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -407,6 +407,8 @@ end; constructor TVideoPlayback_ffmpeg.create();
begin
+ inherited;
+
av_register_all;
fVideoOpened := False;
diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index de117f20..d778eff7 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -91,7 +91,6 @@ type procedure RestoreOpenGLState(); public - constructor Create(); procedure Init(); function GetName: String; @@ -110,12 +109,6 @@ type end; -constructor TVideoPlayback_ProjectM.Create(); -begin - inherited; -end; - - procedure TVideoPlayback_ProjectM.Init(); begin // FIXME: dirty fix needed because the init method is not @@ -393,6 +386,4 @@ initialization finalization AudioManager.Remove( singleton_VideoProjectM ); - - end. diff --git a/Game/Code/Classes/uPluginLoader.pas b/Game/Code/Classes/uPluginLoader.pas index cec9d77d..7191678e 100644 --- a/Game/Code/Classes/uPluginLoader.pas +++ b/Game/Code/Classes/uPluginLoader.pas @@ -130,6 +130,8 @@ end; //-------------
Constructor TPluginLoader.Create;
begin
+ inherited;
+
//Init PluginInterface
//Using Methods from UPluginInterface
PluginInterface.CreateHookableEvent := CreateHookableEvent;
@@ -207,6 +209,7 @@ Destructor TPluginLoader.Destroy; begin
//Just save some Memory if it wasn't done now..
SetLength(Plugins, 0);
+ inherited;
end;
//--------------
@@ -634,6 +637,7 @@ end; //-------------
Constructor TtehPlugins.Create;
begin
+ inherited;
PluginLoader := nil;
end;
|