Ignore:
Timestamp:
May 19, 2022, 10:39:34 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Use first capital letter in identifiers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Enhance.pas

    r442 r447  
    3737    NoMap: TIsoMap;
    3838  public
    39     procedure ShowNewContent(NewMode: TWindowMode; TerrType: integer = -1);
     39    procedure ShowNewContent(NewMode: TWindowMode; TerrType: Integer = -1);
    4040  protected
    41     Page: integer;
     41    Page: Integer;
    4242    procedure OffscreenPaint; override;
    4343  end;
     
    5656procedure TEnhanceDlg.FormCreate(Sender: TObject);
    5757var
    58   TerrType: integer;
    59   m: TMenuItem;
     58  TerrType: Integer;
     59  M: TMenuItem;
    6060begin
    6161  inherited;
     
    7171    if TerrType <> fJungle then
    7272    begin
    73       m := TMenuItem.Create(Popup);
    74       m.RadioItem := true;
     73      M := TMenuItem.Create(Popup);
     74      M.RadioItem := True;
    7575      if TerrType = fGrass then
    76         m.Caption := Format(Phrases.Lookup('TWOTERRAINS'),
     76        M.Caption := Format(Phrases.Lookup('TWOTERRAINS'),
    7777          [Phrases.Lookup('TERRAIN', fGrass), Phrases.Lookup('TERRAIN',
    7878          fGrass + 12)])
    7979      else if TerrType = fForest then
    80         m.Caption := Format(Phrases.Lookup('TWOTERRAINS'),
     80        M.Caption := Format(Phrases.Lookup('TWOTERRAINS'),
    8181          [Phrases.Lookup('TERRAIN', fForest), Phrases.Lookup('TERRAIN',
    8282          fJungle)])
    8383      else
    84         m.Caption := Phrases.Lookup('TERRAIN', TerrType);
    85       m.Tag := TerrType;
    86       m.OnClick := TerrClick;
    87       Popup.Items.Add(m);
     84        M.Caption := Phrases.Lookup('TERRAIN', TerrType);
     85      M.Tag := TerrType;
     86      M.OnClick := TerrClick;
     87      Popup.Items.Add(M);
    8888    end;
    8989end;
     
    9696procedure TEnhanceDlg.FormPaint(Sender: TObject);
    9797var
    98   i: integer;
     98  I: Integer;
    9999begin
    100100  inherited;
     
    103103  BtnFrame(Canvas, Rect(job3.Left, job3.Top, job9.Left + job9.Width,
    104104    job3.Top + job3.Height), MainTexture);
    105   for i := 0 to ControlCount - 1 do
    106     if Controls[i] is TButtonC then
    107       BitBltCanvas(Canvas, Controls[i].Left + 2, Controls[i].Top - 11, 8, 8,
    108         HGrSystem.Data.Canvas, 121 + Controls[i].Tag mod 7 * 9,
    109         1 + Controls[i].Tag div 7 * 9);
     105  for I := 0 to ControlCount - 1 do
     106    if Controls[I] is TButtonC then
     107      BitBltCanvas(Canvas, Controls[I].Left + 2, Controls[I].Top - 11, 8, 8,
     108        HGrSystem.Data.Canvas, 121 + Controls[I].Tag mod 7 * 9,
     109        1 + Controls[I].Tag div 7 * 9);
    110110end;
    111111
     
    115115end;
    116116
    117 procedure TEnhanceDlg.ShowNewContent(NewMode: TWindowMode; TerrType: integer);
     117procedure TEnhanceDlg.ShowNewContent(NewMode: TWindowMode; TerrType: Integer);
    118118begin
    119119  if (TerrType < fGrass) or (TerrType > fMountains) then
     
    126126procedure TEnhanceDlg.OffscreenPaint;
    127127var
    128   i, stage, TerrType, TileImp, x, EndStage, Cost, LastJob: integer;
    129   s: string;
     128  I, stage, TerrType, TileImp, X, EndStage, Cost, LastJob: Integer;
     129  S: string;
    130130  Done: Set of jNone .. jTrans;
    131   TypeChanged: boolean;
     131  TypeChanged: Boolean;
    132132begin
    133133  OffscreenUser := self;
    134   offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
     134  Offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
    135135  FillOffscreen(0, 0, InnerWidth, InnerHeight);
    136136
    137137  EndStage := 0;
    138138  while (EndStage < 5) and (MyData.EnhancementJobs[Page, EndStage] <> jNone) do
    139     inc(EndStage);
     139    Inc(EndStage);
    140140  with NoMap do
    141     x := InnerWidth div 2 - xxt - (xxt + 3) * EndStage;
     141    X := InnerWidth div 2 - xxt - (xxt + 3) * EndStage;
    142142
    143143  TerrType := Page;
     
    149149    if stage > 0 then
    150150    begin
    151       Sprite(offscreen, HGrSystem, x - 10, 66, 14, 14, 80, 1);
     151      Sprite(Offscreen, HGrSystem, X - 10, 66, 14, 14, 80, 1);
    152152      case MyData.EnhancementJobs[Page, stage - 1] of
    153153        jRoad:
    154154          begin
    155             inc(Cost, Terrain[TerrType].MoveCost * RoadWork);
     155            Inc(Cost, Terrain[TerrType].MoveCost * RoadWork);
    156156            TileImp := TileImp or fRoad;
    157157          end;
    158158        jRR:
    159159          begin
    160             inc(Cost, Terrain[TerrType].MoveCost * RRWork);
     160            Inc(Cost, Terrain[TerrType].MoveCost * RRWork);
    161161            TileImp := TileImp or fRR;
    162162          end;
    163163        jIrr:
    164164          begin
    165             inc(Cost, Terrain[TerrType].IrrClearWork);
     165            Inc(Cost, Terrain[TerrType].IrrClearWork);
    166166            TileImp := TileImp and not fTerImp or tiIrrigation;
    167167          end;
    168168        jFarm:
    169169          begin
    170             inc(Cost, Terrain[TerrType].IrrClearWork * FarmWork);
     170            Inc(Cost, Terrain[TerrType].IrrClearWork * FarmWork);
    171171            TileImp := TileImp and not fTerImp or tiFarm;
    172172          end;
    173173        jMine:
    174174          begin
    175             inc(Cost, Terrain[TerrType].MineAfforestWork);
     175            Inc(Cost, Terrain[TerrType].MineAfforestWork);
    176176            TileImp := TileImp and not fTerImp or tiMine;
    177177          end;
    178178        jClear:
    179179          begin
    180             inc(Cost, Terrain[TerrType].IrrClearWork);
     180            Inc(Cost, Terrain[TerrType].IrrClearWork);
    181181            TerrType := Terrain[TerrType].ClearTerrain;
    182182          end;
    183183        jAfforest:
    184184          begin
    185             inc(Cost, Terrain[TerrType].MineAfforestWork);
     185            Inc(Cost, Terrain[TerrType].MineAfforestWork);
    186186            TerrType := Terrain[TerrType].AfforestTerrain;
    187187          end;
    188188        jTrans:
    189189          begin
    190             inc(Cost, Terrain[TerrType].TransWork);
     190            Inc(Cost, Terrain[TerrType].TransWork);
    191191            TerrType := Terrain[TerrType].TransTerrain;
    192192          end;
    193193      end;
    194       include(Done, MyData.EnhancementJobs[Page, stage - 1]);
     194      Include(Done, MyData.EnhancementJobs[Page, stage - 1]);
    195195    end;
    196196
    197197    with NoMap do begin
    198198      if TerrType < fForest then
    199         Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,
     199        Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2,
    200200          1 + TerrType * (xxt * 2 + 1), 1 + yyt)
    201201      else
    202202      begin
    203         Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,
     203        Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2,
    204204          1 + 2 * (xxt * 2 + 1), 1 + yyt + 2 * (yyt * 3 + 1));
    205         Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,
     205        Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2,
    206206          1 + 7 * (xxt * 2 + 1), 1 + yyt + 2 * (2 + TerrType - fForest) *
    207207          (yyt * 3 + 1));
    208208      end;
    209209      if TileImp and fTerImp = tiFarm then
    210         Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,
     210        Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2,
    211211          1 + (xxt * 2 + 1), 1 + yyt + 12 * (yyt * 3 + 1))
    212212      else if TileImp and fTerImp = tiIrrigation then
    213         Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1,
     213        Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2, 1,
    214214          1 + yyt + 12 * (yyt * 3 + 1));
    215215      if TileImp and fRR <> 0 then
    216216      begin
    217         Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,
     217        Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2,
    218218          1 + 6 * (xxt * 2 + 1), 1 + yyt + 10 * (yyt * 3 + 1));
    219         Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,
     219        Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2,
    220220          1 + 2 * (xxt * 2 + 1), 1 + yyt + 10 * (yyt * 3 + 1));
    221221      end
    222222      else if TileImp and fRoad <> 0 then
    223223      begin
    224         Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,
     224        Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2,
    225225          1 + 6 * (xxt * 2 + 1), 1 + yyt + 9 * (yyt * 3 + 1));
    226         Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,
     226        Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2,
    227227          1 + 2 * (xxt * 2 + 1), 1 + yyt + 9 * (yyt * 3 + 1));
    228228      end;
    229229      if TileImp and fTerImp = tiMine then
    230         Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,
     230        Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2,
    231231          1 + 2 * (xxt * 2 + 1), 1 + yyt + 12 * (yyt * 3 + 1));
    232       inc(x, xxt * 2 + 6);
    233     end;
    234   end;
    235 
    236   for i := 0 to Popup.Items.Count - 1 do
    237     if Popup.Items[i].Tag = Page then
    238       s := Popup.Items[i].Caption;
     232      Inc(X, xxt * 2 + 6);
     233    end;
     234  end;
     235
     236  for I := 0 to Popup.Items.Count - 1 do
     237    if Popup.Items[I].Tag = Page then
     238      S := Popup.Items[I].Caption;
    239239  if Cost > 0 then
    240     s := Format(Phrases.Lookup('ENHANCE'), [s, MovementToString(Cost)]);
    241   LoweredTextOut(offscreen.Canvas, -1, MainTexture,
    242     (InnerWidth - BiColorTextWidth(offscreen.Canvas, s)) div 2, 12, s);
     240    S := Format(Phrases.Lookup('ENHANCE'), [S, MovementToString(Cost)]);
     241  LoweredTextOut(Offscreen.Canvas, -1, MainTexture,
     242    (InnerWidth - BiColorTextWidth(Offscreen.Canvas, S)) div 2, 12, S);
    243243
    244244  if EndStage > 0 then
     
    289289    (Terrain[TerrType].MineEff > 0);
    290290  job3.Visible := not TypeChanged and (Terrain[TerrType].ClearTerrain >= 0) and
    291     ((TerrType <> fDesert) or (MyRO.Wonder[woGardens].EffectiveOwner = me)) or
     291    ((TerrType <> fDesert) or (MyRO.Wonder[woGardens].EffectiveOwner = Me)) or
    292292    (LastJob = jClear);
    293293  job6.Visible := not TypeChanged and (Terrain[TerrType].AfforestTerrain >= 0)
     
    306306procedure TEnhanceDlg.ToggleBtnClick(Sender: TObject);
    307307var
    308   i: integer;
    309 begin
    310   for i := 0 to Popup.Items.Count - 1 do
    311     Popup.Items[i].Checked := Popup.Items[i].Tag = Page;
     308  I: Integer;
     309begin
     310  for I := 0 to Popup.Items.Count - 1 do
     311    Popup.Items[I].Checked := Popup.Items[I].Tag = Page;
    312312  Popup.Popup(Left + ToggleBtn.Left, Top + ToggleBtn.Top + ToggleBtn.Height);
    313313end;
     
    321321procedure TEnhanceDlg.JobClick(Sender: TObject);
    322322var
    323   stage, NewJob: integer;
     323  stage, NewJob: Integer;
    324324  Done: Set of jNone .. jTrans;
    325325
    326   procedure RemoveJob(j: integer);
     326  procedure RemoveJob(J: Integer);
    327327  begin // remove job
    328328    stage := 0;
    329329    while (stage < 5) and (MyData.EnhancementJobs[Page, stage] <> jNone) do
    330330    begin
    331       if (MyData.EnhancementJobs[Page, stage] = j) or (j = jRoad) and
    332         (MyData.EnhancementJobs[Page, stage] = jRR) or (j = jIrr) and
     331      if (MyData.EnhancementJobs[Page, stage] = J) or (J = jRoad) and
     332        (MyData.EnhancementJobs[Page, stage] = jRR) or (J = jIrr) and
    333333        (MyData.EnhancementJobs[Page, stage] = jFarm) then
    334334      begin
    335335        if stage < 4 then
    336           move(MyData.EnhancementJobs[Page, stage + 1],
     336          Move(MyData.EnhancementJobs[Page, stage + 1],
    337337            MyData.EnhancementJobs[Page, stage], 4 - stage);
    338338        MyData.EnhancementJobs[Page, 4] := jNone;
    339339      end
    340340      else
    341         inc(stage);
     341        Inc(stage);
    342342    end;
    343343  end;
     
    349349  while (stage < 5) and (MyData.EnhancementJobs[Page, stage] <> jNone) do
    350350  begin
    351     include(Done, MyData.EnhancementJobs[Page, stage]);
    352     inc(stage);
     351    Include(Done, MyData.EnhancementJobs[Page, stage]);
     352    Inc(stage);
    353353  end;
    354354  if NewJob in Done then
     
    363363    begin
    364364      MyData.EnhancementJobs[Page, stage] := jRoad;
    365       inc(stage);
     365      Inc(stage);
    366366    end;
    367367    if (NewJob = jFarm) and not(jIrr in Done) then
    368368    begin
    369369      MyData.EnhancementJobs[Page, stage] := jIrr;
    370       inc(stage);
     370      Inc(stage);
    371371    end;
    372372    MyData.EnhancementJobs[Page, stage] := NewJob;
Note: See TracChangeset for help on using the changeset viewer.