diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-11-12 18:46:19 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-11-12 18:46:19 +0000 |
commit | aebc91a64ea8241a37785914fd62c4998bfd4927 (patch) | |
tree | afd612188ac4f7c66e56c0df45f978cc1af8010f /Game/Code | |
parent | 5d84a6888c22a959934afff5f8f80d97ffeb7d21 (diff) | |
download | usdx-aebc91a64ea8241a37785914fd62c4998bfd4927.tar.gz usdx-aebc91a64ea8241a37785914fd62c4998bfd4927.tar.xz usdx-aebc91a64ea8241a37785914fd62c4998bfd4927.zip |
Fixed a typo and a some programming errors in UIni that lead to memory abuses
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1@606 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/UIni.pas | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 3a77bda4..61f48c6a 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -1,4 +1,4 @@ -gunit UIni;
+unit UIni;
interface
uses IniFiles, ULog, SysUtils;
@@ -251,20 +251,32 @@ begin // Resolution
SetLength(IResolution, 0);
Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available
- while Assigned(Modes) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07)
- begin - SetLength(IResolution, Length(IResolution) + 1);
- IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h);
- Inc(Modes);
- end;
-
- // if no modes were set, then failback to 800x600
+
+ //this should solve the biggest wine problem | THANKS Linnex (11.11.07)
+ // if no modes were set, then fallback to 800x600
// as per http://sourceforge.net/forum/message.php?msg_id=4544965
// THANKS : linnex at users.sourceforge.net
- if Length(IResolution) < 1 then
+
+ if (modes = PPSDL_Rect( 0 ) ) then
+ begin //NO modes available => Fallback to 800x600
+ SetLength(IResolution, 1);
+ IResolution[High(IResolution)] := '800x600';
+ end
+ {Else If (modes = PPSDL_Rect(-1)) then
begin
- SetLength(IResolution, Length(IResolution) + 1);
- IResolution[High(IResolution)] := IntToStr(800) + 'x' + IntToStr(600);
+ //All Resolutions are Available
+ //This may be handled, too
+ // to-do : for future Version
+ end}
+ Else //Add all valid Modes
+ begin
+ I := 0;
+ Repeat
+ SetLength(IResolution, I + 1);
+ IResolution[I] := IntToStr((modes^)^.w) + 'x' + IntToStr((modes^)^.h);
+ Inc(I);
+ Inc(modes)
+ Until (modes^)=nil;
end;
// reverse order
|