Changeset 486


Ignore:
Timestamp:
Dec 8, 2023, 8:25:31 PM (11 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/AI/StdAI/AI.pas

    r447 r486  
    25662566      if (Loc >= 0) and (Flags and chCaptured = 0) and (District[Loc] >= 0) then
    25672567      begin
    2568         if size < 4 then
     2568        if Size < 4 then
    25692569          City_OptimizeTiles(cix, rwMaxGrowth)
    25702570        else
  • trunk/AI/StdAI/Barbarina.pas

    r447 r486  
    14311431            (iix = imShipComp) or (iix = imShipPow) or (iix = imShipHab) then
    14321432            City_OptimizeTiles(cix, rwMaxProd)
    1433           else if size < 8 then
     1433          else if Size < 8 then
    14341434            City_OptimizeTiles(cix, rwMaxGrowth)
    14351435          else
  • trunk/AI/StdAI/Pile.pas

    r447 r486  
    4343  if (N <> 0) or (Size > CurrentSize) then
    4444  begin
    45     FillChar(Ix, Size * sizeOf(Integer), 255);
     45    FillChar(Ix, Size * SizeOf(Integer), 255);
    4646    N := 0;
    4747  end;
    4848  CurrentSize := Size;
    49         {$IFDEF DEBUG}
     49{$IFDEF DEBUG}
    5050  InUse := True;
    5151{$ENDIF}
     
    5454procedure Free;
    5555begin
    56         {$IFDEF DEBUG}
     56{$IFDEF DEBUG}
    5757  Assert(InUse);
    5858  InUse := False;
     
    6464  if N <> 0 then
    6565  begin
    66     FillChar(Ix, CurrentSize * sizeOf(Integer), 255);
     66    FillChar(Ix, CurrentSize * SizeOf(Integer), 255);
    6767    N := 0;
    6868  end;
    6969end;
    7070
    71 //Parent(i) = (i-1)/2.
    72 function Put(Item, Value: Integer): Boolean; //O(lg(n))
     71// Parent(i) = (i-1)/2.
     72function Put(Item, Value: Integer): Boolean; // O(lg(n))
    7373var
    7474  I, J: Integer;
     
    9292  while I > 0 do
    9393  begin
    94     J := (I - 1) shr 1;  //Parent(i) = (i-1)/2
     94    J := (I - 1) shr 1;  // Parent(i) = (i-1)/2
    9595    if Value >= bh[J].Value then
    9696      Break;
     
    9999    I := J;
    100100  end;
    101   //  Insert the new Item at the insertion point found.
     101  // Insert the new Item at the insertion point found.
    102102  bh[I].Value := Value;
    103103  bh[I].Item := Item;
  • trunk/LocalPlayer/ClientTools.pas

    r447 r486  
    5757function IsMilReportNew(Enemy: Integer): Boolean;
    5858function CutCityFoodSurplus(FoodSurplus: Integer; IsCityAlive: Boolean;
    59   gov, size: Integer): Integer;
     59  gov, Size: Integer): Integer;
    6060function CityTaxBalance(cix: Integer; const CityReport: TCityReportNew): Integer;
    6161procedure SumCities(var TaxSum, ScienceSum: Integer);
     
    233233
    234234function CutCityFoodSurplus(FoodSurplus: Integer; IsCityAlive: Boolean;
    235   gov, size: Integer): Integer;
     235  gov, Size: Integer): Integer;
    236236begin
    237237  Result := FoodSurplus;
    238238  if not IsCityAlive or (Result > 0) and ((gov = gFuture) or
    239     (size >= NeedAqueductSize) and (Result < 2)) then
     239    (Size >= NeedAqueductSize) and (Result < 2)) then
    240240    Result := 0; { no growth }
    241241end;
     
    253253      (CityReport.Production > 0) then
    254254      Inc(Result, CityReport.Production);
    255     if ((MyRO.Government = gFuture) or (MyCity[cix].size >=
     255    if ((MyRO.Government = gFuture) or (MyCity[cix].Size >=
    256256      NeedAqueductSize) and (CityReport.FoodSurplus < 2)) and
    257257      (CityReport.FoodSurplus > 0) then
     
    330330      Owner := Me;
    331331      ID := MyCity[cix].ID;
    332       size := MyCity[cix].size;
     332      Size := MyCity[cix].Size;
    333333      Flags := 0;
    334334      if MyCity[cix].Built[imPalace] > 0 then
  • trunk/LocalPlayer/IsoEngine.pas

    r469 r486  
    193193begin
    194194  // prepare age 2+3 cities
    195   for age := 2 to 3 do
    196     for size := 0 to 3 do
     195  for Age := 2 to 3 do
     196    for Size := 0 to 3 do
    197197      with Pictures[Age, Size] do
    198198        FindPosition(HGrCities, Size * (xxt * 2 + 1), (Age - 2) * (yyt * 3 + 1),
     
    738738begin
    739739  Age := GetAge(CityInfo.Owner);
    740   if CityInfo.size < 5 then
     740  if CityInfo.Size < 5 then
    741741    xGr := 0
    742   else if CityInfo.size < 9 then
     742  else if CityInfo.Size < 9 then
    743743    xGr := 1
    744   else if CityInfo.size < 13 then
     744  else if CityInfo.Size < 13 then
    745745    xGr := 2
    746746  else
     
    793793      yShield := Y - 2 * yyt + cpic.yShield;
    794794    end;
    795     S := IntToStr(CityInfo.size);
     795    S := IntToStr(CityInfo.Size);
    796796    LabelLength := FOutput.Canvas.TextWidth(S);
    797797    FillRect(xShield, yShield, LabelLength + 4, 16, $000000);
  • trunk/LocalPlayer/Select.pas

    r474 r486  
    238238
    239239var
    240   icon, ofs, X, Y, y0, lix, I, J, TextColor, Available, first, Test,
    241     FutureCount, growth, TrueFood, TrueProd: Integer;
     240  icon, ofs, X, Y, y0, lix, I, J, TextColor, Available, First, Test,
     241    FutureCount, Growth, TrueFood, TrueProd: Integer;
    242242  CityReport: TCityReportNew;
    243243  mox: ^TModelInfo;
     
    253253
    254254  if Kind in [kCities, kCityEvents] then
    255     with MyCity[lix] do
     255    with TCity(MyCity[lix]) do
    256256    begin
    257257      X := 104 - 76;
     
    281281          Font.Color := $000000;
    282282          S := IntToStr(MyCity[lix].Size);
    283           TextOut(X - 4 - textwidth(S) div 2, Y, S);
     283          TextOut(X - 4 - TextWidth(S) div 2, Y, S);
    284284        end;
    285285
     
    402402            ((Size < NeedAqueductSize) or (Built[imAqueduct] = 1) and
    403403            (Size < NeedSewerSize) or (Built[imSewer] = 1));
     404          Growth := CutCityFoodSurplus(CityReport.FoodSurplus,
     405            (MyRO.Government <> gAnarchy) and (Flags and chCaptured = 0),
     406            MyRO.Government, Size);
    404407          PaintRelativeProgressBar(Offscreen.Canvas, 1, X + 15 + CityNameSpace +
    405             4, Y + 7, 68, TrueFood, CutCityFoodSurplus(CityReport.FoodSurplus,
    406             (MyRO.Government <> gAnarchy) and (Flags and chCaptured = 0),
    407             MyRO.Government, Size), CityReport.Storage, CanGrow, MainTexture);
     408            4, Y + 7, 68, TrueFood, Growth, CityReport.Storage, CanGrow, MainTexture);
    408409
    409410          if Project <> cpImp + imTrGoods then
     
    413414
    414415            // production progress
    415             growth := CityReport.Production;
    416             if (growth < 0) or (MyRO.Government = gAnarchy) or
     416            Growth := CityReport.Production;
     417            if (Growth < 0) or (MyRO.Government = gAnarchy) or
    417418              (Flags and chCaptured <> 0) then
    418               growth := 0;
     419              Growth := 0;
    419420            PaintRelativeProgressBar(Offscreen.Canvas, 4,
    420               X + CityNameSpace + 4 + 304 - 60 + 9, Y + 7, 68, TrueProd, growth,
     421              X + CityNameSpace + 4 + 304 - 60 + 9, Y + 7, 68, TrueProd, Growth,
    421422              CityReport.ProjectCost, True, MainTexture);
    422423          end;
  • trunk/LocalPlayer/Term.pas

    r485 r486  
    765765
    766766procedure ChooseModelPicture(P, mix, Code, Hash, Turn: Integer;
    767   ForceNew, final: Boolean);
     767  ForceNew, Final: Boolean);
    768768var
    769769  I: Integer;
     
    796796    IsNew := Tribe[P].ChooseModelPicture(Picture, Code, Turn, ForceNew);
    797797  end;
    798   if final then
     798  if Final then
    799799    if not TribeOriginal[P] then
    800800      Tribe[P].SetModelPicture(Picture, IsNew)
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r477 r486  
    9292  T: TTexture);
    9393procedure PaintRelativeProgressBar(Canvas: TCanvas;
    94   Kind, X, Y, size, Pos, Growth, Max: Integer; IndicateComplete: Boolean;
     94  Kind, X, Y, Size, Pos, Growth, Max: Integer; IndicateComplete: Boolean;
    9595  T: TTexture);
    9696procedure PaintLogo(Canvas: TCanvas; X, Y, LightColor, ShadeColor: Integer);
     
    15341534    end;
    15351535    Brush.Color := $000000;
    1536     FillRect(Rect(X + Pos + abs(Growth), Y, X + Max, Y + 7));
     1536    FillRect(Rect(X + Pos + Abs(Growth), Y, X + Max, Y + 7));
    15371537    Brush.Style := TBrushStyle.bsClear;
    15381538  end;
     
    15411541// pos and growth are relative to max, set size independent
    15421542procedure PaintRelativeProgressBar(Canvas: TCanvas;
    1543   Kind, X, Y, size, Pos, Growth, Max: Integer; IndicateComplete: Boolean;
     1543  Kind, X, Y, Size, Pos, Growth, Max: Integer; IndicateComplete: Boolean;
    15441544  T: TTexture);
    15451545begin
    15461546  if Growth > 0 then
    1547     PaintProgressBar(Canvas, Kind, X, Y, Pos * size div Max,
    1548       (Growth * size + Max div 2) div Max, size, T)
     1547    PaintProgressBar(Canvas, Kind, X, Y, Pos * Size div Max,
     1548      (Growth * Size + Max div 2) div Max, Size, T)
    15491549  else
    1550     PaintProgressBar(Canvas, Kind, X, Y, Pos * size div Max,
    1551       (Growth * size - Max div 2) div Max, size, T);
     1550    PaintProgressBar(Canvas, Kind, X, Y, Pos * Size div Max,
     1551      (Growth * Size - Max div 2) div Max, Size, T);
    15521552  if IndicateComplete and (Pos + Growth >= Max) then
    1553     Sprite(Canvas, HGrSystem, X + size - 10, Y - 7, 23, 16, 1, 129);
     1553    Sprite(Canvas, HGrSystem, X + Size - 10, Y - 7, 23, 16, 1, 129);
    15541554end;
    15551555
Note: See TracChangeset for help on using the changeset viewer.