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/Rates.pas

    r442 r447  
    4646procedure TRatesDlg.OffscreenPaint;
    4747var
    48   p, x, y, current, max, i: integer;
    49   s, s1: string;
     48  P, X, Y, current, Max, I: Integer;
     49  S, s1: string;
    5050begin
    5151  if (OffscreenUser <> nil) and (OffscreenUser <> self) then
     
    6464  BtnFrame(Offscreen.Canvas, CloseBtn.BoundsRect, MainTexture);
    6565  Offscreen.Canvas.Font.Assign(UniFont[ftCaption]);
    66   s := Phrases.Lookup('TITLE_RATES');
     66  S := Phrases.Lookup('TITLE_RATES');
    6767  RisedTextOut(Offscreen.Canvas,
    68     (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s)) div 2 - 1, 7, s);
    69 
    70   if MyRO.Wonder[woLiberty].EffectiveOwner = me then
    71     s := Phrases.Lookup('NORATES')
    72   else
    73     s := Phrases.Lookup('RATES');
     68    (ClientWidth - BiColorTextWidth(Offscreen.Canvas, S)) div 2 - 1, 7, S);
     69
     70  if MyRO.Wonder[woLiberty].EffectiveOwner = Me then
     71    S := Phrases.Lookup('NORATES')
     72  else
     73    S := Phrases.Lookup('RATES');
    7474  Offscreen.Canvas.Font.Assign(UniFont[ftNormal]);
    75   p := pos('\', s);
    76   if p = 0 then
    77     RisedTextOut(Offscreen.Canvas, (ClientWidth - BiColorTextWidth(Canvas, s))
    78       div 2, 114, s)
    79   else
    80   begin
    81     s1 := copy(s, 1, p - 1);
     75  P := Pos('\', S);
     76  if P = 0 then
     77    RisedTextOut(Offscreen.Canvas, (ClientWidth - BiColorTextWidth(Canvas, S))
     78      div 2, 114, S)
     79  else
     80  begin
     81    s1 := Copy(S, 1, P - 1);
    8282    RisedTextOut(Offscreen.Canvas,
    8383      (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s1)) div 2,
    8484      114 - MessageLineSpacing div 2, s1);
    85     s1 := copy(s, p + 1, 255);
     85    s1 := Copy(S, P + 1, 255);
    8686    RisedTextOut(Offscreen.Canvas,
    8787      (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s1)) div 2,
     
    9090  Offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
    9191
    92   if MyRO.Wonder[woLiberty].EffectiveOwner = me then
     92  if MyRO.Wonder[woLiberty].EffectiveOwner = Me then
    9393  begin
    9494    GlowFrame(Offscreen, ClientWidth div 2 - xSizeBig div 2, 52, xSizeBig,
    95       ySizeBig, Tribe[me].Color);
     95      ySizeBig, Tribe[Me].Color);
    9696    BitBltCanvas(Offscreen.Canvas, ClientWidth div 2 - xSizeBig div 2, 52,
    9797      xSizeBig, ySizeBig, BigImp.Canvas, (woLiberty mod 7) * xSizeBig,
     
    102102    // ImageOp_CBC(Offscreen,Templates,260,40,145,112,36,36,$404000,$8B8BEB);
    103103
    104     s := Phrases.Lookup('SCIENCE');
    105     RisedTextOut(Offscreen.Canvas,
    106       16 + 120 - BiColorTextWidth(Offscreen.Canvas, s), 44, s);
    107     s := Format('%d%%', [100 - MyRO.TaxRate - MyRO.LuxRate]);
    108     RisedTextOut(Offscreen.Canvas,
    109       16 + 120 - BiColorTextWidth(Offscreen.Canvas, s), 60, s);
     104    S := Phrases.Lookup('SCIENCE');
     105    RisedTextOut(Offscreen.Canvas,
     106      16 + 120 - BiColorTextWidth(Offscreen.Canvas, S), 44, S);
     107    S := Format('%d%%', [100 - MyRO.TaxRate - MyRO.LuxRate]);
     108    RisedTextOut(Offscreen.Canvas,
     109      16 + 120 - BiColorTextWidth(Offscreen.Canvas, S), 60, S);
    110110    // PaintProgressBar(Offscreen.Canvas,2,16,81,(100-MyRO.LuxRate-MyRO.TaxRate)*120 div 100,0,120,MainTexture);
    111111
    112112    // reverse progress bar for science
    113     x := 16;
    114     y := 81;
     113    X := 16;
     114    Y := 81;
    115115    current := (100 - MyRO.LuxRate - MyRO.TaxRate) * 120 div 100;
    116     max := 120;
    117     Frame(Offscreen.Canvas, x - 1, y - 1, x + max, y + 7, $000000, $000000);
    118     RFrame(Offscreen.Canvas, x - 2, y - 2, x + max + 1, y + 8,
     116    Max := 120;
     117    Frame(Offscreen.Canvas, X - 1, Y - 1, X + Max, Y + 7, $000000, $000000);
     118    RFrame(Offscreen.Canvas, X - 2, Y - 2, X + Max + 1, Y + 8,
    119119      MainTexture.ColorBevelShade, MainTexture.ColorBevelLight);
    120120    with Offscreen.Canvas do
    121121    begin
    122       for i := 0 to current div 8 - 1 do
    123         BitBltCanvas(Offscreen.Canvas, x + max - 8 - i * 8, y, 8, 7,
     122      for I := 0 to current div 8 - 1 do
     123        BitBltCanvas(Offscreen.Canvas, X + Max - 8 - I * 8, Y, 8, 7,
    124124          HGrSystem.Data.Canvas, 104, 9 + 8 * 2);
    125       BitBltCanvas(Offscreen.Canvas, x + max - current, y, current - 8 * (current div 8), 7,
     125      BitBltCanvas(Offscreen.Canvas, X + Max - current, Y, current - 8 * (current div 8), 7,
    126126        HGrSystem.Data.Canvas, 104, 9 + 8 * 2);
    127127      Brush.Color := $000000;
    128       FillRect(Rect(x, y, x + max - current, y + 7));
     128      FillRect(Rect(X, Y, X + Max - current, Y + 7));
    129129      Brush.Style := bsClear;
    130130    end;
    131131
    132132    RisedTextOut(Offscreen.Canvas, 16 + 160, 44, Phrases.Lookup('LUX'));
    133     s := Format('%d%%', [MyRO.LuxRate]);
    134     RisedTextOut(Offscreen.Canvas,
    135       16 + 160 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 60, s);
     133    S := Format('%d%%', [MyRO.LuxRate]);
     134    RisedTextOut(Offscreen.Canvas,
     135      16 + 160 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 60, S);
    136136    PaintProgressBar(Offscreen.Canvas, 5, 16 + 160, 81,
    137137      MyRO.LuxRate * 120 div 100, 0, 120, MainTexture);
     
    144144    MainTexture.ColorBevelLight);
    145145  RisedTextOut(Offscreen.Canvas, 16 + 80, 164, Phrases.Lookup('TAXRATE'));
    146   s := Format('%d%%', [MyRO.TaxRate]);
     146  S := Format('%d%%', [MyRO.TaxRate]);
    147147  RisedTextOut(Offscreen.Canvas,
    148     16 + 80 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 180, s);
     148    16 + 80 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 180, S);
    149149  PaintProgressBar(Offscreen.Canvas, 0, 16 + 80, 201,
    150150    MyRO.TaxRate * 120 div 100, 0, 120, MainTexture);
     
    164164begin
    165165  Caption := Phrases.Lookup('TITLE_RATES');
    166   if MyRO.Wonder[woLiberty].EffectiveOwner = me then
    167   begin
    168     ScienceBtn.Visible := false;
    169     LuxBtn.Visible := false;
     166  if MyRO.Wonder[woLiberty].EffectiveOwner = Me then
     167  begin
     168    ScienceBtn.Visible := False;
     169    LuxBtn.Visible := False;
    170170  end
    171171  else
    172172  begin
    173     ScienceBtn.Visible := true;
    174     LuxBtn.Visible := true;
     173    ScienceBtn.Visible := True;
     174    LuxBtn.Visible := True;
    175175  end;
    176176  OffscreenPaint;
     
    184184procedure TRatesDlg.TaxLuxBtnClick(Sender: TObject);
    185185var
    186   NewTax, NewLux: integer;
     186  NewTax, NewLux: Integer;
    187187begin
    188188  NewTax := MyRO.TaxRate div 10;
     
    191191  begin
    192192    if NewTax < 10 then
    193       inc(NewTax);
     193      Inc(NewTax);
    194194    if NewTax + NewLux > 10 then
    195       dec(NewLux);
     195      Dec(NewLux);
    196196  end
    197197  else if (Sender = TaxDownBtn) and (NewTax > 0) then
    198     dec(NewTax)
     198    Dec(NewTax)
    199199  else if (Sender = ScienceBtn) and (NewLux > 0) then
    200     dec(NewLux)
     200    Dec(NewLux)
    201201  else if (Sender = LuxBtn) and (NewLux + NewTax < 100) then
    202     inc(NewLux);
    203   if Server(sSetRates, me, NewTax + NewLux shl 4, nil^) <> eNotChanged then
     202    Inc(NewLux);
     203  if Server(sSetRates, Me, NewTax + NewLux shl 4, nil^) <> eNotChanged then
    204204  begin
    205205    CityOptimizer_BeginOfTurn;
    206206    SmartUpdateContent;
    207     MainScreen.UpdateViews(true);
     207    MainScreen.UpdateViews(True);
    208208  end;
    209209end;
Note: See TracChangeset for help on using the changeset viewer.