Ignore:
Timestamp:
Jan 7, 2017, 11:32:14 AM (8 years ago)
Author:
chronos
Message:
  • Modified: Formated all project source files using Delphi formatter as original indentation and other formatting was really bad.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/CityType.pas

    r2 r6  
    11{$INCLUDE switches}
    2 
    32unit CityType;
    43
     
    65
    76uses
    8   Protocol,ClientTools,Term,ScreenTools,BaseWin,
     7  Protocol, ClientTools, Term, ScreenTools, BaseWin,
    98
    109  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
     
    2625    procedure DeleteBtnClick(Sender: TObject);
    2726  public
    28     procedure ShowNewContent(NewMode: integer); 
     27    procedure ShowNewContent(NewMode: integer);
    2928  protected
    3029    procedure OffscreenPaint; override;
    3130  private
    32     nPool,dragiix,ctype: integer;
    33     Pooliix: array[0..nImp-1] of integer;
    34     listed: Set of 0..nImp;
     31    nPool, dragiix, ctype: integer;
     32    Pooliix: array [0 .. nImp - 1] of integer;
     33    listed: Set of 0 .. nImp;
    3534    Changed: boolean;
    3635    procedure LoadType(NewType: integer);
     
    4847
    4948const
    50 xList=7; yList=0;
    51 nListRow=4; nListCol=10;
    52 xPool=7; yPool=220;
    53 nPoolRow=4; nPoolCol=10;
    54 xSwitch=7; ySwitch=150;
    55 xView=226; yView=130;
    56 
    57 procedure TCityTypeDlg.FormCreate(Sender:TObject);
    58 begin
    59 inherited;
    60 CaptionRight:=CloseBtn.Left;
    61 InitButtons();
    62 HelpContext:='MACRO';
    63 Caption:=Phrases.Lookup('TITLE_CITYTYPES');
    64 DeleteBtn.Hint:=Phrases.Lookup('BTN_DELETE');
    65 end;
    66 
    67 procedure TCityTypeDlg.CloseBtnClick(Sender:TObject);
    68 begin
    69 Close
    70 end;
    71 
    72 procedure TCityTypeDlg.FormPaint(Sender:TObject);
    73 begin
    74 inherited;
    75 BtnFrame(Canvas,DeleteBtn.BoundsRect,MainTexture);
     49  xList = 7;
     50  yList = 0;
     51  nListRow = 4;
     52  nListCol = 10;
     53  xPool = 7;
     54  yPool = 220;
     55  nPoolRow = 4;
     56  nPoolCol = 10;
     57  xSwitch = 7;
     58  ySwitch = 150;
     59  xView = 226;
     60  yView = 130;
     61
     62procedure TCityTypeDlg.FormCreate(Sender: TObject);
     63begin
     64  inherited;
     65  CaptionRight := CloseBtn.Left;
     66  InitButtons();
     67  HelpContext := 'MACRO';
     68  Caption := Phrases.Lookup('TITLE_CITYTYPES');
     69  DeleteBtn.Hint := Phrases.Lookup('BTN_DELETE');
     70end;
     71
     72procedure TCityTypeDlg.CloseBtnClick(Sender: TObject);
     73begin
     74  Close
     75end;
     76
     77procedure TCityTypeDlg.FormPaint(Sender: TObject);
     78begin
     79  inherited;
     80  BtnFrame(Canvas, DeleteBtn.BoundsRect, MainTexture);
    7681end;
    7782
    7883procedure TCityTypeDlg.OffscreenPaint;
    7984var
    80 i,iix: integer;
    81 s: string;
    82 begin
    83 inherited;
    84 offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
    85 FillOffscreen(xList-7,yList,42*nListCol+14,32*nListRow);
    86 FillOffscreen(xPool-7,yPool,42*nPoolCol+14,32*nPoolRow);
    87 FillOffscreen(0,yList+32*nListRow,42*nPoolCol+14,yPool-yList-32*nListRow);
    88 
    89 Frame(offscreen.Canvas,0,yList+32*nListRow,InnerWidth-255,yPool-23,
    90   MainTexture.clBevelLight,MainTexture.clBevelShade);
    91 Frame(offscreen.Canvas,InnerWidth-254,yList+32*nListRow,InnerWidth-89,yPool-23,
    92   MainTexture.clBevelLight,MainTexture.clBevelShade);
    93 Frame(offscreen.Canvas,InnerWidth-88,yList+32*nListRow,InnerWidth-1,yPool-23,
    94   MainTexture.clBevelLight,MainTexture.clBevelShade);
    95 Frame(offscreen.Canvas,0,yPool-22,InnerWidth-1,yPool-1,
    96   MainTexture.clBevelLight,MainTexture.clBevelShade);
    97 for i:=0 to nCityType-1 do
    98   begin
    99   RFrame(offscreen.Canvas,xSwitch+i*42,ySwitch,xSwitch+39+i*42,ySwitch+23,
    100     MainTexture.clBevelShade,MainTexture.clBevelLight);
    101   if i=ctype then
    102     Frame(offscreen.Canvas,xSwitch+1+i*42,ySwitch+1,xSwitch+38+i*42,ySwitch+22,
    103       MainTexture.clBevelShade,MainTexture.clBevelLight)
    104   else Frame(offscreen.Canvas,xSwitch+1+i*42,ySwitch+1,xSwitch+38+i*42,ySwitch+22,
    105     MainTexture.clBevelLight,MainTexture.clBevelShade);
    106   BitBlt(offscreen.Canvas.Handle,xSwitch+2+i*42,ySwitch+2,xSizeSmall,
    107     ySizeSmall,SmallImp.Canvas.Handle,(i+3)*xSizeSmall,0,SRCCOPY)
    108   end;
    109 RisedTextOut(offscreen.Canvas,8,yList+32*nListRow+2,Phrases.Lookup('BUILDORDER'));
    110 RisedTextOut(offscreen.Canvas,8,ySwitch+26,Phrases.Lookup('CITYTYPE',ctype));
    111 s:=Phrases.Lookup('BUILDREST');
    112 RisedTextOut(offscreen.Canvas,(InnerWidth-BiColorTextWidth(Offscreen.Canvas,s)) div 2,
    113   yList+72+32*nListRow,s);
    114 
    115 with offscreen.Canvas do
    116   begin
    117   for i:=1 to nListRow-1 do
    118     DLine(offscreen.Canvas,xList-5,xList+4+42*nListCol,yList-1+32*i,
    119       MainTexture.clBevelLight,MainTexture.clBevelShade);
    120   for i:=0 to nListCol*nListRow-1 do
    121     begin
    122     s:=IntToStr(i+1);
    123     Font.Color:=MainTexture.clTextLight;
    124     Textout(xList+20+i mod nListCol *42-TextWidth(s) div 2,
    125       yList+15+i div nListCol *32-TextHeight(s) div 2,s);
     85  i, iix: integer;
     86  s: string;
     87begin
     88  inherited;
     89  offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
     90  FillOffscreen(xList - 7, yList, 42 * nListCol + 14, 32 * nListRow);
     91  FillOffscreen(xPool - 7, yPool, 42 * nPoolCol + 14, 32 * nPoolRow);
     92  FillOffscreen(0, yList + 32 * nListRow, 42 * nPoolCol + 14,
     93    yPool - yList - 32 * nListRow);
     94
     95  Frame(offscreen.Canvas, 0, yList + 32 * nListRow, InnerWidth - 255,
     96    yPool - 23, MainTexture.clBevelLight, MainTexture.clBevelShade);
     97  Frame(offscreen.Canvas, InnerWidth - 254, yList + 32 * nListRow,
     98    InnerWidth - 89, yPool - 23, MainTexture.clBevelLight,
     99    MainTexture.clBevelShade);
     100  Frame(offscreen.Canvas, InnerWidth - 88, yList + 32 * nListRow,
     101    InnerWidth - 1, yPool - 23, MainTexture.clBevelLight,
     102    MainTexture.clBevelShade);
     103  Frame(offscreen.Canvas, 0, yPool - 22, InnerWidth - 1, yPool - 1,
     104    MainTexture.clBevelLight, MainTexture.clBevelShade);
     105  for i := 0 to nCityType - 1 do
     106  begin
     107    RFrame(offscreen.Canvas, xSwitch + i * 42, ySwitch, xSwitch + 39 + i * 42,
     108      ySwitch + 23, MainTexture.clBevelShade, MainTexture.clBevelLight);
     109    if i = ctype then
     110      Frame(offscreen.Canvas, xSwitch + 1 + i * 42, ySwitch + 1,
     111        xSwitch + 38 + i * 42, ySwitch + 22, MainTexture.clBevelShade,
     112        MainTexture.clBevelLight)
     113    else
     114      Frame(offscreen.Canvas, xSwitch + 1 + i * 42, ySwitch + 1,
     115        xSwitch + 38 + i * 42, ySwitch + 22, MainTexture.clBevelLight,
     116        MainTexture.clBevelShade);
     117    BitBlt(offscreen.Canvas.Handle, xSwitch + 2 + i * 42, ySwitch + 2,
     118      xSizeSmall, ySizeSmall, SmallImp.Canvas.Handle, (i + 3) * xSizeSmall,
     119      0, SRCCOPY)
     120  end;
     121  RisedTextOut(offscreen.Canvas, 8, yList + 32 * nListRow + 2,
     122    Phrases.Lookup('BUILDORDER'));
     123  RisedTextOut(offscreen.Canvas, 8, ySwitch + 26,
     124    Phrases.Lookup('CITYTYPE', ctype));
     125  s := Phrases.Lookup('BUILDREST');
     126  RisedTextOut(offscreen.Canvas,
     127    (InnerWidth - BiColorTextWidth(offscreen.Canvas, s)) div 2,
     128    yList + 72 + 32 * nListRow, s);
     129
     130  with offscreen.Canvas do
     131  begin
     132    for i := 1 to nListRow - 1 do
     133      DLine(offscreen.Canvas, xList - 5, xList + 4 + 42 * nListCol,
     134        yList - 1 + 32 * i, MainTexture.clBevelLight, MainTexture.clBevelShade);
     135    for i := 0 to nListCol * nListRow - 1 do
     136    begin
     137      s := IntToStr(i + 1);
     138      Font.Color := MainTexture.clTextLight;
     139      Textout(xList + 20 + i mod nListCol * 42 - TextWidth(s) div 2,
     140        yList + 15 + i div nListCol * 32 - TextHeight(s) div 2, s);
    126141    end
    127142  end;
    128143
    129 i:=0;
    130 while MyData.ImpOrder[ctype,i]>=0 do
    131   begin
    132   RFrame(offscreen.Canvas,
    133     xList+20-xSizeSmall div 2 + i mod nListCol *42,
    134     yList+15-ySizeSmall div 2 + i div nListCol *32,
    135     xList+21+xSizeSmall div 2 + i mod nListCol *42,
    136     yList+16+ySizeSmall div 2 + i div nListCol *32,
    137     MainTexture.clBevelLight,MainTexture.clBevelShade);
    138   BitBlt(offscreen.Canvas.Handle,
    139     xList+21-xSizeSmall div 2 + i mod nListCol *42,
    140     yList+16-ySizeSmall div 2 + i div nListCol *32,
    141     xSizeSmall,ySizeSmall,SmallImp.Canvas.Handle,
    142     MyData.ImpOrder[ctype,i] mod 7*xSizeSmall,
    143     (MyData.ImpOrder[ctype,i]+SystemIconLines*7) div 7*ySizeSmall,SRCCOPY);
    144   inc(i);
    145   end;
    146 
    147 nPool:=0;
    148 for iix:=28 to nImp-1 do
    149   if not (iix in listed) and (Imp[iix].Kind=ikCommon) and (iix<>imTrGoods)
    150     and (Imp[iix].Preq<>preNA)
    151     and ((Imp[iix].Preq=preNone) or (MyRO.Tech[Imp[iix].Preq]>=tsApplicable)) then
    152     begin
    153     Pooliix[nPool]:=iix;
    154     RFrame(offscreen.Canvas,
    155       xPool+20-xSizeSmall div 2 + nPool mod nPoolCol *42,
    156       yPool+15-ySizeSmall div 2 + nPool div nPoolCol *32,
    157       xPool+21+xSizeSmall div 2 + nPool mod nPoolCol *42,
    158       yPool+16+ySizeSmall div 2 + nPool div nPoolCol *32,
     144  i := 0;
     145  while MyData.ImpOrder[ctype, i] >= 0 do
     146  begin
     147    RFrame(offscreen.Canvas, xList + 20 - xSizeSmall div 2 + i mod nListCol *
     148      42, yList + 15 - ySizeSmall div 2 + i div nListCol * 32,
     149      xList + 21 + xSizeSmall div 2 + i mod nListCol * 42,
     150      yList + 16 + ySizeSmall div 2 + i div nListCol * 32,
    159151      MainTexture.clBevelLight, MainTexture.clBevelShade);
    160     BitBlt(offscreen.Canvas.Handle,
    161       xPool+21-xSizeSmall div 2 + nPool mod nPoolCol *42,
    162       yPool+16-ySizeSmall div 2 + nPool div nPoolCol *32,
    163       xSizeSmall,ySizeSmall,SmallImp.Canvas.Handle,
    164       iix mod 7*xSizeSmall,(iix+SystemIconLines*7) div 7*ySizeSmall,SRCCOPY);
    165     inc(nPool)
     152    BitBlt(offscreen.Canvas.Handle, xList + 21 - xSizeSmall div 2 +
     153      i mod nListCol * 42, yList + 16 - ySizeSmall div 2 + i div nListCol * 32,
     154      xSizeSmall, ySizeSmall, SmallImp.Canvas.Handle,
     155      MyData.ImpOrder[ctype, i] mod 7 * xSizeSmall,
     156      (MyData.ImpOrder[ctype, i] + SystemIconLines * 7) div 7 *
     157      ySizeSmall, SRCCOPY);
     158    inc(i);
     159  end;
     160
     161  nPool := 0;
     162  for iix := 28 to nImp - 1 do
     163    if not(iix in listed) and (Imp[iix].Kind = ikCommon) and (iix <> imTrGoods)
     164      and (Imp[iix].Preq <> preNA) and
     165      ((Imp[iix].Preq = preNone) or (MyRO.Tech[Imp[iix].Preq] >= tsApplicable))
     166    then
     167    begin
     168      Pooliix[nPool] := iix;
     169      RFrame(offscreen.Canvas, xPool + 20 - xSizeSmall div 2 +
     170        nPool mod nPoolCol * 42, yPool + 15 - ySizeSmall div 2 +
     171        nPool div nPoolCol * 32, xPool + 21 + xSizeSmall div 2 +
     172        nPool mod nPoolCol * 42, yPool + 16 + ySizeSmall div 2 +
     173        nPool div nPoolCol * 32, MainTexture.clBevelLight,
     174        MainTexture.clBevelShade);
     175      BitBlt(offscreen.Canvas.Handle, xPool + 21 - xSizeSmall div 2 +
     176        nPool mod nPoolCol * 42, yPool + 16 - ySizeSmall div 2 +
     177        nPool div nPoolCol * 32, xSizeSmall, ySizeSmall, SmallImp.Canvas.Handle,
     178        iix mod 7 * xSizeSmall, (iix + SystemIconLines * 7) div 7 *
     179        ySizeSmall, SRCCOPY);
     180      inc(nPool)
    166181    end;
    167 DeleteBtn.Visible:= MyData.ImpOrder[ctype,0]>=0;
    168 
    169 if dragiix>=0 then
    170   begin
    171   ImpImage(offscreen.Canvas,xView+9,yView+5,dragiix);
    172   s:=Phrases.Lookup('IMPROVEMENTS',dragiix);
    173   RisedTextOut(offscreen.Canvas,xView+36-BiColorTextWidth(Offscreen.Canvas,s) div 2,
    174     ySwitch+26,s);
    175   end;
    176 MarkUsedOffscreen(InnerWidth,InnerHeight);
    177 end; {MainPaint}
     182  DeleteBtn.Visible := MyData.ImpOrder[ctype, 0] >= 0;
     183
     184  if dragiix >= 0 then
     185  begin
     186    ImpImage(offscreen.Canvas, xView + 9, yView + 5, dragiix);
     187    s := Phrases.Lookup('IMPROVEMENTS', dragiix);
     188    RisedTextOut(offscreen.Canvas,
     189      xView + 36 - BiColorTextWidth(offscreen.Canvas, s) div 2,
     190      ySwitch + 26, s);
     191  end;
     192  MarkUsedOffscreen(InnerWidth, InnerHeight);
     193end; { MainPaint }
    178194
    179195procedure TCityTypeDlg.LoadType(NewType: integer);
    180196var
    181 i: integer;
    182 begin
    183 ctype:=NewType;
    184 listed:=[];
    185 i:=0;
    186 while MyData.ImpOrder[ctype,i]>=0 do
    187   begin include(listed,MyData.ImpOrder[ctype,i]); inc(i) end;
    188 Changed:=false
     197  i: integer;
     198begin
     199  ctype := NewType;
     200  listed := [];
     201  i := 0;
     202  while MyData.ImpOrder[ctype, i] >= 0 do
     203  begin
     204    include(listed, MyData.ImpOrder[ctype, i]);
     205    inc(i)
     206  end;
     207  Changed := false
    189208end;
    190209
    191210procedure TCityTypeDlg.SaveType;
    192211var
    193 cix: integer;
    194 begin
    195 if Changed then
    196   begin
    197   for cix:=0 to MyRO.nCity-1 do
    198     if (MyCity[cix].Loc>=0) and (MyCity[cix].Status and 7=ctype+1) then
    199       AutoBuild(cix, MyData.ImpOrder[ctype]);
    200   Changed:=false
     212  cix: integer;
     213begin
     214  if Changed then
     215  begin
     216    for cix := 0 to MyRO.nCity - 1 do
     217      if (MyCity[cix].Loc >= 0) and (MyCity[cix].Status and 7 = ctype + 1) then
     218        AutoBuild(cix, MyData.ImpOrder[ctype]);
     219    Changed := false
    201220  end;
    202221end;
     
    204223procedure TCityTypeDlg.FormShow(Sender: TObject);
    205224begin
    206 LoadType(0);
    207 dragiix:=-1;
    208 OffscreenPaint;
     225  LoadType(0);
     226  dragiix := -1;
     227  OffscreenPaint;
    209228end;
    210229
    211230procedure TCityTypeDlg.ShowNewContent(NewMode: integer);
    212231begin
    213 inherited ShowNewContent(NewMode);
    214 end;
    215 
    216 procedure TCityTypeDlg.PaintBox1MouseDown(Sender: TObject;
    217   Button: TMouseButton; Shift: TShiftState; x, y: integer);
    218 var
    219 i: integer;
    220 begin
    221 x:=x-SideFrame; y:=y-WideFrame;
    222 i:=(x-xList) div 42+(y-yList) div 32 *nListCol;
    223 if (i<nImp) and (MyData.ImpOrder[ctype,i]>=0)
    224   and (x>xList+2+ i mod nListCol *42) and (y>yList+5+ i div nListCol *32)
    225   and (x<xList+3+36+ i mod nListCol *42) and (y<yList+6+20+ i div nListCol *32) then
    226   begin
    227   if ssShift in Shift then
    228     HelpDlg.ShowNewContent(FWindowMode or wmPersistent, hkImp, MyData.ImpOrder[ctype,i])
    229   else
    230     begin
    231     dragiix:=MyData.ImpOrder[ctype,i];
    232     Screen.Cursor:=crImpDrag;
     232  inherited ShowNewContent(NewMode);
     233end;
     234
     235procedure TCityTypeDlg.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
     236  Shift: TShiftState; x, y: integer);
     237var
     238  i: integer;
     239begin
     240  x := x - SideFrame;
     241  y := y - WideFrame;
     242  i := (x - xList) div 42 + (y - yList) div 32 * nListCol;
     243  if (i < nImp) and (MyData.ImpOrder[ctype, i] >= 0) and
     244    (x > xList + 2 + i mod nListCol * 42) and
     245    (y > yList + 5 + i div nListCol * 32) and
     246    (x < xList + 3 + 36 + i mod nListCol * 42) and
     247    (y < yList + 6 + 20 + i div nListCol * 32) then
     248  begin
     249    if ssShift in Shift then
     250      HelpDlg.ShowNewContent(FWindowMode or wmPersistent, hkImp,
     251        MyData.ImpOrder[ctype, i])
     252    else
     253    begin
     254      dragiix := MyData.ImpOrder[ctype, i];
     255      Screen.Cursor := crImpDrag;
     256      SmartUpdateContent
     257    end;
     258    exit;
     259  end;
     260  i := (x - xPool) div 42 + (y - yPool) div 32 * nPoolCol;
     261  if (i < nPool) and (x > xPool + 2 + i mod nPoolCol * 42) and
     262    (y > yPool + 5 + i div nPoolCol * 32) and
     263    (x < xPool + 3 + 36 + i mod nPoolCol * 42) and
     264    (y < yPool + 6 + 20 + i div nPoolCol * 32) then
     265  begin
     266    if ssShift in Shift then
     267      HelpDlg.ShowNewContent(FWindowMode or wmPersistent, hkImp, Pooliix[i])
     268    else
     269    begin
     270      dragiix := Pooliix[i];
     271      Screen.Cursor := crImpDrag;
     272      SmartUpdateContent
     273    end;
     274    exit;
     275  end;
     276  i := (x - xSwitch) div 42;
     277  if (i < nCityType) and (x > xSwitch + 2 + i * 42) and
     278    (x < xSwitch + 3 + 36 + i * 42) and (y >= ySwitch + 2) and (y < ySwitch + 22)
     279  then
     280  begin
     281    SaveType;
     282    LoadType(i);
    233283    SmartUpdateContent
    234     end;
    235   exit;
    236   end;
    237 i:=(x-xPool) div 42+(y-yPool) div 32 *nPoolCol;
    238 if (i<nPool) and (x>xPool+2+ i mod nPoolCol *42)
    239   and (y>yPool+5+ i div nPoolCol *32) and (x<xPool+3+36+ i mod nPoolCol *42)
    240   and (y<yPool+6+20+ i div nPoolCol *32) then
    241   begin
    242   if ssShift in Shift then
    243     HelpDlg.ShowNewContent(FWindowMode or wmPersistent, hkImp, Pooliix[i])
    244   else
    245     begin
    246     dragiix:=Pooliix[i];
    247     Screen.Cursor:=crImpDrag;
    248     SmartUpdateContent
    249     end;
    250   exit;
    251   end;
    252 i:=(x-xSwitch) div 42;
    253 if (i<nCityType) and (x>xSwitch+2+ i*42) and (x<xSwitch+3+36+i*42)
    254   and (y>=ySwitch+2) and (y<ySwitch+22) then
    255   begin
    256   SaveType;
    257   LoadType(i);
    258   SmartUpdateContent
    259284  end
    260285end;
     
    265290  procedure UnList(iix: integer);
    266291  var
     292    i: integer;
     293  begin
     294    i := 0;
     295    while (MyData.ImpOrder[ctype, i] >= 0) and
     296      (MyData.ImpOrder[ctype, i] <> iix) do
     297      inc(i);
     298    assert(MyData.ImpOrder[ctype, i] = iix);
     299    move(MyData.ImpOrder[ctype, i + 1], MyData.ImpOrder[ctype, i], nImp - i);
     300    Exclude(listed, iix);
     301  end;
     302
     303var
    267304  i: integer;
    268   begin
    269   i:=0;
    270   while (MyData.ImpOrder[ctype,i]>=0) and (MyData.ImpOrder[ctype,i]<>iix) do
    271     inc(i);
    272   assert(MyData.ImpOrder[ctype,i]=iix);
    273   move(MyData.ImpOrder[ctype,i+1],MyData.ImpOrder[ctype,i],nImp-i);
    274   Exclude(listed,iix);
    275   end;
    276 
    277 var
    278 i: integer;
    279 begin
    280 x:=x-SideFrame; y:=y-WideFrame;
    281 if dragiix>=0 then
    282   begin
    283   if (x>=xList) and (x<xList+nListCol*42)
    284     and (y>=yList) and (y<yList+nListRow*32) then
    285     begin
    286     if dragiix in listed then UnList(dragiix);
    287     i:=(x-xList) div 42+(y-yList) div 32 *nListCol;
    288     while (i>0) and (MyData.ImpOrder[ctype,i-1]<0) do dec(i);
    289     move(MyData.ImpOrder[ctype,i],MyData.ImpOrder[ctype,i+1],nImp-i-1);
    290     MyData.ImpOrder[ctype,i]:=dragiix;
    291     include(listed,dragiix);
    292     Changed:=true
     305begin
     306  x := x - SideFrame;
     307  y := y - WideFrame;
     308  if dragiix >= 0 then
     309  begin
     310    if (x >= xList) and (x < xList + nListCol * 42) and (y >= yList) and
     311      (y < yList + nListRow * 32) then
     312    begin
     313      if dragiix in listed then
     314        UnList(dragiix);
     315      i := (x - xList) div 42 + (y - yList) div 32 * nListCol;
     316      while (i > 0) and (MyData.ImpOrder[ctype, i - 1] < 0) do
     317        dec(i);
     318      move(MyData.ImpOrder[ctype, i], MyData.ImpOrder[ctype, i + 1],
     319        nImp - i - 1);
     320      MyData.ImpOrder[ctype, i] := dragiix;
     321      include(listed, dragiix);
     322      Changed := true
    293323    end
    294   else if (dragiix in listed) and (x>=xPool) and (x<xPool+nPoolCol*42)
    295     and (y>=yPool) and (y<yPool+nPoolRow*32) then
    296     begin
    297     UnList(dragiix);
    298     Changed:=true
     324    else if (dragiix in listed) and (x >= xPool) and (x < xPool + nPoolCol * 42)
     325      and (y >= yPool) and (y < yPool + nPoolRow * 32) then
     326    begin
     327      UnList(dragiix);
     328      Changed := true
    299329    end;
    300   dragiix:=-1;
     330    dragiix := -1;
     331    SmartUpdateContent
     332  end;
     333  Screen.Cursor := crDefault
     334end;
     335
     336procedure TCityTypeDlg.FormClose(Sender: TObject; var Action: TCloseAction);
     337begin
     338  SaveType;
     339  inherited;
     340end;
     341
     342procedure TCityTypeDlg.DeleteBtnClick(Sender: TObject);
     343begin
     344  fillchar(MyData.ImpOrder[ctype], sizeof(MyData.ImpOrder[ctype]), -1);
     345  listed := [];
     346  Changed := true;
    301347  SmartUpdateContent
    302   end;
    303 Screen.Cursor:=crDefault
    304 end;
    305 
    306 procedure TCityTypeDlg.FormClose(Sender: TObject; var Action: TCloseAction);
    307 begin
    308 SaveType;
    309 inherited;
    310 end;
    311 
    312 procedure TCityTypeDlg.DeleteBtnClick(Sender: TObject);
    313 begin
    314 fillchar(MyData.ImpOrder[ctype],sizeof(MyData.ImpOrder[ctype]),-1);
    315 listed:=[];
    316 Changed:=true;
    317 SmartUpdateContent
    318348end;
    319349
    320350end.
    321 
Note: See TracChangeset for help on using the changeset viewer.