Changeset 12 for trunk/LocalPlayer


Ignore:
Timestamp:
Jan 7, 2017, 8:25:59 PM (8 years ago)
Author:
chronos
Message:
  • Fixed: Various memory leaks.
  • Fixed: Exceptions during browsing in help.
Location:
trunk/LocalPlayer
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/CityScreen.pas

    r9 r12  
    240240  SmallCityMap.Free;
    241241  ZoomCityMap.Free;
     242  SmallCityMapTemplate.Free;
    242243  CityMapTemplate.Free;
    243244  Template.Free;
  • trunk/LocalPlayer/Draft.pas

    r9 r12  
    9797procedure TDraftDlg.FormDestroy(Sender: TObject);
    9898begin
    99   Template.Free;
     99  FreeAndNil(Template);
     100  FreeAndNil(Back);
    100101end;
    101102
  • trunk/LocalPlayer/Help.pas

    r9 r12  
    3737
    3838type
     39
     40  { THyperText }
     41
    3942  THyperText = class(TStringList)
    4043    procedure AddLine(s: String = ''; Format: integer = 0; Picpix: integer = 0;
    4144      LinkCategory: integer = 0; LinkIndex: integer = 0);
     45    procedure AddText(Const S : String); override;
    4246    procedure LF;
     47    destructor Destroy; override;
    4348  end;
    4449
     
    122127end;
    123128
     129procedure THyperText.AddText(const S: String);
     130begin
     131  AddLine(S);
     132end;
     133
    124134procedure THyperText.LF;
    125135begin
    126136  AddLine;
     137end;
     138
     139destructor THyperText.Destroy;
     140begin
     141  inherited Destroy;
    127142end;
    128143
     
    189204  inc(ModalFrameIndent, 29);
    190205  MainText := THyperText.Create;
     206  MainText.OwnsObjects := True;
    191207  SearchResult := THyperText.Create;
     208  SearchResult.OwnsObjects := True;
    192209  CreatePVSB(sb, Handle, 36, 551, 36 + 432);
    193210
     
    226243procedure THelpDlg.FormDestroy(Sender: TObject);
    227244begin
    228   MainText.Free;
    229   SearchResult.Free;
    230   ExtPic.Free;
    231   TerrIcon.Free;
    232   HelpText.Free;
    233   // CaptionFont.Free;
     245  FreeAndNil(MainText);
     246  FreeAndNil(SearchResult);
     247  FreeAndNil(ExtPic);
     248  FreeAndNil(TerrIcon);
     249  FreeAndNil(HelpText);
     250  // FreeAndNil(CaptionFont);
    234251end;
    235252
  • trunk/LocalPlayer/Nego.pas

    r9 r12  
    1212const
    1313  MaxHistory = 62;
     14  scDipNoticeStart = scDipNotice - scDipStart;
     15  scDipBreakStart = scDipBreak - scDipStart;
    1416
    1517type
     
    1820    Text: array [0 .. MaxHistory - 1] of ansistring;
    1921  end;
     22
     23  TCommandAllowedEnum = scDipNoticeStart .. scDipBreakStart;
     24
     25  { TNegoDlg }
    2026
    2127  TNegoDlg = class(TBufferedDrawDlg)
     
    5359    CancelTreatyBtn: TButtonN;
    5460    procedure FormCreate(Sender: TObject);
     61    procedure FormDestroy(Sender: TObject);
    5562    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
    5663      Shift: TShiftState; X, Y: integer);
     
    7683    CurrentOffer: TOffer;
    7784    MyAllowed, OppoAllowed: TPriceSet;
    78     CommandAllowed: set of scDipNotice - scDipStart .. scDipBreak - scDipStart;
     85    CommandAllowed: set of TCommandAllowedEnum;
    7986    History: array [0 .. nPl - 1] of THistory;
    8087    RomanFont: TFont;
     
    167174end;
    168175
     176procedure TNegoDlg.FormDestroy(Sender: TObject);
     177begin
     178  FreeAndNil(RomanFont);
     179end;
     180
    169181procedure TNegoDlg.FormShow(Sender: TObject);
    170182begin
  • trunk/LocalPlayer/Term.lfm

    r9 r12  
    11object MainScreen: TMainScreen
    22  Left = 231
     3  Height = 480
    34  Top = 190
     5  Width = 800
    46  HorzScrollBar.Visible = False
    57  VertScrollBar.Visible = False
    68  Caption = 'C-evo'
    7   ClientHeight = 435
    8   ClientWidth = 782
     9  ClientHeight = 480
     10  ClientWidth = 800
    911  Color = clBtnFace
    1012  Constraints.MinHeight = 480
    1113  Constraints.MinWidth = 800
    12   Font.Charset = DEFAULT_CHARSET
    1314  Font.Color = clWindowText
    1415  Font.Height = -13
    1516  Font.Name = 'MS Sans Serif'
    16   Font.Style = []
    1717  KeyPreview = True
    18   Position = poDefault
    19   WindowState = wsMaximized
    2018  OnClose = FormClose
    2119  OnCloseQuery = FormCloseQuery
     
    3028  OnResize = FormResize
    3129  OnShow = FormShow
    32   PixelsPerInch = 96
     30  Position = poDefault
     31  LCLVersion = '1.6.2.0'
     32  WindowState = wsMaximized
    3333  object UnitBtn: TButtonB
    3434    Tag = 14
    3535    Left = 208
     36    Height = 25
    3637    Top = 384
    3738    Width = 25
    38     Height = 25
    3939    Visible = False
    4040    Down = False
     
    4646    Tag = 51
    4747    Left = 16
     48    Height = 12
    4849    Top = 304
    4950    Width = 12
    50     Height = 12
    5151    Visible = False
    5252    Down = False
     
    5858    Tag = 291
    5959    Left = 16
     60    Height = 12
    6061    Top = 320
    6162    Width = 12
    62     Height = 12
    6363    Visible = False
    6464    Down = False
     
    7070    Tag = 1028
    7171    Left = 16
     72    Height = 12
    7273    Top = 368
    7374    Width = 12
    74     Height = 12
    7575    Visible = False
    7676    Down = False
     
    8282    Tag = 1328
    8383    Left = 16
     84    Height = 12
    8485    Top = 384
    8586    Width = 12
    86     Height = 12
    8787    Visible = False
    8888    Down = False
     
    9494    Tag = 1541
    9595    Left = 16
     96    Height = 12
    9697    Top = 400
    9798    Width = 12
    98     Height = 12
    9999    Visible = False
    100100    Down = False
     
    106106    Tag = 28
    107107    Left = 240
     108    Height = 25
    108109    Top = 384
    109110    Width = 25
    110     Height = 25
    111111    Visible = False
    112112    Down = False
     
    118118    Tag = 15
    119119    Left = 176
     120    Height = 25
    120121    Top = 384
    121122    Width = 25
    122     Height = 25
    123123    Visible = False
    124124    Down = False
     
    129129  object EOT: TEOTButton
    130130    Left = 712
     131    Height = 48
    131132    Top = 368
    132133    Width = 48
    133     Height = 48
    134134    Visible = False
    135135    Down = False
     
    140140  object MenuArea: TArea
    141141    Left = 2
     142    Height = 36
    142143    Top = 1
    143144    Width = 36
    144     Height = 36
    145145  end
    146146  object TreasuryArea: TArea
    147147    Left = 208
     148    Height = 36
    148149    Top = 1
    149150    Width = 164
    150     Height = 36
    151151  end
    152152  object ResearchArea: TArea
    153153    Left = 384
     154    Height = 36
    154155    Top = 1
    155156    Width = 240
    156     Height = 36
    157157  end
    158158  object ManagementArea: TArea
    159159    Left = 704
     160    Height = 40
    160161    Top = 312
    161162    Width = 56
    162     Height = 40
    163163  end
    164164  object MovieSpeed1Btn: TButtonB
    165165    Tag = 256
    166166    Left = 384
     167    Height = 25
    167168    Top = 384
    168169    Width = 25
    169     Height = 25
    170170    Visible = False
    171171    Down = False
     
    177177    Tag = 512
    178178    Left = 416
     179    Height = 25
    179180    Top = 384
    180181    Width = 25
    181     Height = 25
    182182    Visible = False
    183183    Down = False
     
    189189    Tag = 768
    190190    Left = 448
     191    Height = 25
    191192    Top = 384
    192193    Width = 25
    193     Height = 25
    194194    Visible = False
    195195    Down = False
     
    201201    Tag = 1024
    202202    Left = 480
     203    Height = 25
    203204    Top = 384
    204205    Width = 25
    205     Height = 25
    206206    Visible = False
    207207    Down = False
     
    214214    Interval = 50
    215215    OnTimer = Timer1Timer
    216     Left = 8
    217     Top = 48
     216    left = 8
     217    top = 48
    218218  end
    219219  object GamePopup: TPopupMenu
    220220    AutoPopup = False
    221     Left = 40
    222     Top = 48
     221    left = 40
     222    top = 48
    223223    object mHelp: TMenuItem
    224224      Tag = 7
     
    249249        Tag = 30
    250250        GroupIndex = 1
     251        RadioItem = True
    251252        object mSlowMoves: TMenuItem
    252253          Tag = 75
     
    275276        Tag = 90
    276277        GroupIndex = 1
     278        RadioItem = True
    277279        object mAlSlowMoves: TMenuItem
    278280          Tag = 91
     
    301303        Tag = 74
    302304        GroupIndex = 1
     305        RadioItem = True
    303306        object mEnMoves: TMenuItem
    304307          Tag = 78
     
    327330        Caption = '-'
    328331        GroupIndex = 1
     332        RadioItem = True
    329333      end
    330334      object mRepList: TMenuItem
     
    575579  object UnitPopup: TPopupMenu
    576580    AutoPopup = False
    577     Left = 104
    578     Top = 48
     581    left = 104
     582    top = 48
    579583    object mdisband: TMenuItem
    580584      Tag = 72
     
    658662  object StatPopup: TPopupMenu
    659663    AutoPopup = False
    660     Left = 72
    661     Top = 48
     664    left = 72
     665    top = 48
    662666    object mUnitStat: TMenuItem
    663667      Tag = 9
     
    714718  end
    715719  object EditPopup: TPopupMenu
    716     Left = 168
    717     Top = 48
     720    left = 168
     721    top = 48
    718722    object mCreateUnit: TMenuItem
    719723      Tag = 47
     
    721725  end
    722726  object TerrainPopup: TPopupMenu
    723     Left = 136
    724     Top = 48
     727    left = 136
     728    top = 48
    725729    object mtrans: TMenuItem
    726730      Tag = 273
  • trunk/LocalPlayer/Term.pas

    r10 r12  
    35293529    i: integer;
    35303530  begin
    3531     Mini.free;
    3532     Buffer.free;
    3533     Panel.free;
     3531    TopBar.Free;
     3532    Mini.Free;
     3533    Buffer.Free;
     3534    Panel.Free;
    35343535    for i := 0 to nPl - 1 do
    35353536      if AILogo[i] <> nil then
    3536         AILogo[i].free;
     3537        AILogo[i].Free;
    35373538  end;
    35383539
Note: See TracChangeset for help on using the changeset viewer.