From dc72a49b4c680fe6698b831a203a9b00e476d562 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 1 Jun 2007 17:23:59 +0000 Subject: Fixed a Memory Bug in UMenuSelectSlide that causes memory that is not in use anymore is not freeed when the Attributes of a SelectSlide are Updated git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@240 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuSelectSlide.pas | 43 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas index 0149ea2b..f18b45cd 100644 --- a/Game/Code/Menu/UMenuSelectSlide.pas +++ b/Game/Code/Menu/UMenuSelectSlide.pas @@ -308,33 +308,34 @@ begin if (Lines <= 0) then Lines := 1; + //Free old Space used by Texts + For I := low(TextOpt) to high(TextOpt) do + TextOpt[I].Free; + setLength (TextOpt, Lines); for I := low(TextOpt) to high(TextOpt) do begin + TextOpt[I] := TText.Create; + TextOpt[I].Size := Text.Size; + //TextOpt[I].Align := 1; + TextOpt[I].Align := 0; + TextOpt[I].Visible := True; - //TextOpt[I] := TextOpt[0]; - TextOpt[I] := TText.Create; - TextOpt[I].Size := Text.Size; - //TextOpt[I].Align := 1; - TextOpt[I].Align := 0; - TextOpt[I].Visible := True; - - TextOpt[I].ColR := STDColR; - TextOpt[I].ColG := STDColG; - TextOpt[I].ColB := STDColB; - TextOpt[I].Int := STDInt; - - //Generate Positions - //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); - TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I; - TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H / 2) - 1.5 * Text.Size{20}; - - //Better Look with 2 Options - if (Lines=2) AND (Length(TextOptT)= 2) then - TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(PChar(TextOptT[1]))) * I; + TextOpt[I].ColR := STDColR; + TextOpt[I].ColG := STDColG; + TextOpt[I].ColB := STDColB; + TextOpt[I].Int := STDInt; + + //Generate Positions + //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I; + TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H / 2) - 1.5 * Text.Size{20}; + + //Better Look with 2 Options + if (Lines=2) AND (Length(TextOptT)= 2) then + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(PChar(TextOptT[1]))) * I; end; - //TextOpt[I] := TextOpt[0]; end; end. -- cgit v1.2.3