Changeset 425


Ignore:
Timestamp:
Apr 26, 2022, 7:34:12 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/CityProcessing.pas

    r328 r425  
    3434procedure ReleaseGame;
    3535
     36
    3637implementation
    3738
    3839type
    3940  TTradeProcessing = record
    40     TaxBonus, LuxBonus, ScienceBonus, FutResBonus, ScienceDoubling,
    41       HappyBase: integer;
    42     RelCorr: single;
    43     FlexibleLuxury: boolean;
     41    TaxBonus: Integer;
     42    LuxBonus: Integer;
     43    ScienceBonus: Integer;
     44    FutResBonus: Integer;
     45    ScienceDoubling: Integer;
     46    HappyBase: Integer;
     47    RelCorr: Single;
     48    FlexibleLuxury: Boolean;
    4449  end;
    4550
    4651  TProdProcessing = record
    47     ProdBonus, PollBonus, FutProdBonus, PollThreshold: integer;
     52    ProdBonus: Integer;
     53    PollBonus: Integer;
     54    FutProdBonus: Integer;
     55    PollThreshold: Integer;
    4856  end;
    4957
     
    5159
    5260  TCityReportEx = record
    53     BaseHappiness, BaseControl, Material: integer;
     61    BaseHappiness: Integer;
     62    BaseControl: Integer;
     63    Material: Integer;
    5464    ProdProcessing: TProdProcessing;
    5565    TradeProcessing: TTradeProcessing;
     
    5969  MaxDist: integer;
    6070
    61   {
    62     Reporting
    63     ____________________________________________________________________
    64   }
     71{
     72  Reporting
     73  ____________________________________________________________________
     74}
    6575procedure GetCityAreaInfo(p, Loc: integer; var CityAreaInfo: TCityAreaInfo);
    6676var
     
    8898          Available[V21] := faNotAvailable
    8999        else
    90           Available[V21] := faAvailable
    91       end
    92     end;
    93   end
     100          Available[V21] := faAvailable;
     101      end;
     102    end;
     103  end;
    94104end;
    95105
     
    224234      RelCorr := 1.0;
    225235    HappyBase := Size + HappinessBeforeLux;
    226   end
     236  end;
    227237end;
    228238
     
    280290        result := result - 3 * i;
    281291        if result <= 0 then
    282           result := i
     292          result := i;
    283293      end
    284294      else if RW[p].Model[Project and cpIndex].Cap[mcLine] > 0 then
     
    287297          result := result shr 1
    288298        else
    289           result := result * 2
     299          result := result * 2;
    290300    end
    291301    else
     
    297307    end;
    298308    result := result * BuildCostMod[Difficulty[p]] div 12;
    299   end
     309  end;
    300310end;
    301311
     
    330340      begin
    331341        Happy := Size;
    332         Control := Size
     342        Control := Size;
    333343      end // !!! old bug, kept for compatibility
    334344      else
    335345      begin
    336346        Happy := 0;
    337         Control := 0
     347        Control := 0;
    338348      end;
    339349
     
    374384        begin
    375385          inc(Happy);
    376           inc(BaseHappiness, 2)
     386          inc(BaseHappiness, 2);
    377387        end;
    378388      if Built[imTemple] = 1 then
    379389      begin
    380390        inc(Happy);
    381         inc(BaseHappiness, 2)
     391        inc(BaseHappiness, 2);
    382392      end;
    383393      if Built[imCathedral] = 1 then
     
    388398        begin
    389399          inc(Happy);
    390           inc(BaseHappiness, 2)
     400          inc(BaseHappiness, 2);
    391401        end;
    392402      end;
     
    394404      begin
    395405        inc(Happy, 2);
    396         inc(BaseHappiness, 4)
     406        inc(BaseHappiness, 4);
    397407      end;
    398408
     
    433443            begin
    434444              inc(Happy);
    435               inc(Control, 2)
     445              inc(Control, 2);
    436446            end;
    437447        gFundamentalism:
     
    439449            BaseHappiness := 0; // done by control
    440450            Happy := Size;
    441             Control := Size
     451            Control := Size;
    442452          end;
    443453      end;
     
    463473          begin
    464474            result := eInvalid;
    465             exit
     475            exit;
    466476          end;
    467477          GetTileInfo(p, cix, Loc1, TileInfo);
     
    472482            (RW[p].Tech[adMassProduction] >= tsApplicable) then
    473483            inc(RareOK[RealMap[Loc1] shr 25 and 3]);
    474           inc(Working)
     484          inc(Working);
    475485        end;
    476486      if Built[imAlgae] = 1 then
     
    501511  end;
    502512  result := eOk;
    503 end; { GetSmallCityReport }
     513end;
    504514
    505515function GetCityReport(p, cix: integer; var CityReport: TCityReport): integer;
     
    582592            SelectedLoc := Loc1;
    583593            SelectedV21 := V21;
    584             Most := Resources
    585           end
    586         end
    587       end
     594            Most := Resources;
     595          end;
     596        end;
     597      end;
    588598    end;
    589599  end;
     
    617627            SelectedLoc := Loc1;
    618628            SelectedV21 := V21;
    619             Least := Resources
    620           end
    621         end;
    622       end
    623   end
     629            Least := Resources;
     630          end;
     631        end;
     632      end;
     633  end;
    624634end;
    625635
     
    680690      assert(1 shl V21 and Tiles = 0);
    681691      Tiles := Tiles or (1 shl V21);
    682       UsedByCity[TileLoc] := Loc
    683     end
     692      UsedByCity[TileLoc] := Loc;
     693    end;
    684694end;
    685695
     
    704714        assert(1 shl V21 and Tiles = 0);
    705715        Tiles := Tiles or (1 shl V21);
    706         UsedByCity[TileLoc] := Loc
    707       end
    708     end;
    709   end
     716        UsedByCity[TileLoc] := Loc;
     717      end;
     718    end;
     719  end;
    710720end;
    711721
     
    729739      assert(1 shl V21 and Tiles <> 0);
    730740      Tiles := Tiles and not(1 shl V21);
    731       UsedByCity[TileLoc] := -1
     741      UsedByCity[TileLoc] := -1;
    732742    end
    733743    else { test whether exploitation of tile would lead to disorder }
     
    742752        assert(1 shl V21 and Tiles <> 0);
    743753        Tiles := Tiles and not(1 shl V21);
    744         UsedByCity[TileLoc] := -1
    745       end
    746     end;
    747   end
     754        UsedByCity[TileLoc] := -1;
     755      end;
     756    end;
     757  end;
    748758end;
    749759
     
    760770      inc(Flags, chPollution);
    761771      RealMap[PollutionLoc] := RealMap[PollutionLoc] or fPoll;
    762     end
     772    end;
    763773  end;
    764774end;
     
    790800              GrWallContinent[p] := -1;
    791801          end;
    792           inc(Flags, chImprovementLost)
    793         end
     802          inc(Flags, chImprovementLost);
     803        end;
    794804      end;
    795805end;
     
    846856      begin
    847857        inc(Money, Prod - CityProjectCost);
    848         Prod := CityProjectCost
     858        Prod := CityProjectCost;
    849859      end;
    850860      if Production < 0 then
     
    888898    begin
    889899      if CanCityGrow(p, cix) then
    890         inc(SizeMod)
     900        inc(SizeMod);
    891901    end
    892902    else if CheckGrow and (Food >= CityStorage) then { normal growth }
     
    898908        else
    899909          dec(Food, CityStorage);
    900         inc(SizeMod)
    901       end
     910        inc(SizeMod);
     911      end;
    902912    end
    903913    else if Food < 0 then { famine }
     
    924934      begin
    925935        dec(SizeMod);
    926         inc(Flags, chPopDecrease)
     936        inc(Flags, chPopDecrease);
    927937      end
    928938    end;
     
    954964              begin
    955965                uix := i;
    956                 Det := TestDet
     966                Det := TestDet;
    957967              end;
    958968            end;
     
    961971          RemoveUnit_UpdateMap(p, uix);
    962972          inc(Flags, chUnitLost);
    963         end
    964       end
     973        end;
     974      end;
    965975    end;
    966976
     
    10081018              Exp := ExpCost * 2; { vet }
    10091019            if Project and cpConscripts <> 0 then
    1010               Flags := Flags or unConscripts
     1020              Flags := Flags or unConscripts;
    10111021          end;
    10121022          PlaceUnit(p, nUn - 1);
     
    10651075                      if (City[cix2].Loc >= 0) and (City[cix2].Built[i] = 1)
    10661076                      then
    1067                         GWonder[i].EffectiveOwner := p
     1077                        GWonder[i].EffectiveOwner := p;
    10681078              end;
    10691079            woLighthouse:
     
    10851095                      IntroduceEnemy(p, p1);
    10861096                    GiveCivilReport(p, p1);
    1087                     GiveMilReport(p, p1)
     1097                    GiveMilReport(p, p1);
    10881098                  end;
    1089               end
     1099              end;
    10901100          end;
    10911101        end;
     
    11131123      end;
    11141124      Prod0 := Prod;
    1115       inc(Flags, chProduction)
     1125      inc(Flags, chProduction);
    11161126    end
    11171127    else
     
    11331143      begin
    11341144        CityShrink(p, cix);
    1135         inc(SizeMod)
    1136       end;
    1137   end
    1138 end; // CityTurn
     1145        inc(SizeMod);
     1146      end;
     1147  end;
     1148end;
    11391149
    11401150{
     
    11791189            begin
    11801190              result := eTileNotAvailable;
    1181               exit
     1191              exit;
    11821192            end;
    11831193        // not more tiles than inhabitants
     
    11891199        begin
    11901200          result := eNoWorkerAvailable;
    1191           exit
     1201          exit;
    11921202        end;
    11931203      end;
     
    12081218            // should only happen during loading, because of wrong sSetCityTiles command order
    12091219          else
    1210             UsedByCity[Loc1] := -1 // unemploy tile
    1211         end;
    1212       Tiles := NewTiles
    1213     end
     1220            UsedByCity[Loc1] := -1; // unemploy tile
     1221        end;
     1222      Tiles := NewTiles;
     1223    end;
    12141224  end;
    12151225end;
     
    12231233type
    12241234  TTileData = record
    1225     Food, Prod, Trade, SubValue, V21: integer;
     1235    Food: Integer;
     1236    Prod: Integer;
     1237    Trade: Integer;
     1238    SubValue: Integer;
     1239    V21: Integer;
    12261240  end;
    12271241var
     
    13641378          (RealMap[Loc1] and fModern = cardinal(NeedRare)) then
    13651379          RareTiles := RareTiles or (1 shl V21);
    1366       end
     1380      end;
    13671381    end;
    13681382
     
    16541668                  TestReport.Lux shr 1;
    16551669                Advice.CityReport := TestReport;
    1656               end
    1657             end // if (SuperPlus>0) or (ValuePlus>=0.0)
    1658           end // if SuperPlus>=0
    1659         end
     1670              end;
     1671            end; // if (SuperPlus>0) or (ValuePlus>=0.0)
     1672          end; // if SuperPlus>=0
     1673        end;
    16601674      end;
    16611675
     
    16911705  Advice.Tiles := BestTiles;
    16921706  Advice.CityReport.HypoTiles := BestTiles;
    1693 end; // GetCityTileAdvice
     1707end;
    16941708
    16951709{
  • trunk/GameServer.pas

    r424 r425  
    815815        begin
    816816          Data := nil;
    817           SavedData[p] := nil
     817          SavedData[p] := nil;
    818818        end;
    819819        nBattleHistory := 0;
     
    836836          RW[p].DefaultDebugMap := nil;
    837837
    838         { !!!for i:=0 to nShipPart-1 do GShip[p].Parts[i]:=Delphirandom((3-i)*2);{ }
     838        { !!!for i:=0 to nShipPart-1 do GShip[p].Parts[i]:=Delphirandom((3-i)*2); }
    839839      end;
    840840
  • trunk/LocalPlayer/MessgEx.pas

    r358 r425  
    1313    mikPureIcon, mikMyArmy, mikEnemyArmy, mikFullControl, mikShip, mikBigIcon,
    1414    mikEnemyShipComplete);
     15
     16  { TMessgExDlg }
    1517
    1618  TMessgExDlg = class(TBaseMessgDlg)
     
    5759  ContextKind, ContextNo: integer);
    5860
     61
    5962implementation
    6063
     
    220223  wScrewed = 43;
    221224  hScrewed = 27;
     225type
     226  TScrewed = array [0 .. wScrewed - 1, 0 .. hScrewed - 1, 0 .. 3] of Single;
    222227var
    223228  ix, iy, xDst, yDst, dx, dy, xIcon, yIcon: integer;
    224229  BookRect: TRect;
    225230  x1, xR, yR, share: single;
    226   Screwed: array [0 .. wScrewed - 1, 0 .. hScrewed - 1, 0 .. 3] of single;
     231  Screwed: TScrewed;
    227232  SrcPtr: TPixelPointer;
    228233  Width: Integer;
     
    235240    yIcon := (IconIndex + SystemIconLines * 7) div 7 * ySizeBig;
    236241    // prepare screwed icon
    237     FillChar(Screwed, sizeof(Screwed), 0);
     242    Screwed := Default(TScrewed);
    238243    BigImp.BeginUpdate;
    239244    SrcPtr := PixelPointer(BigImp, ScaleToNative(xIcon), ScaleToNative(yIcon));
  • trunk/LocalPlayer/Term.pas

    r423 r425  
    383383    procedure PaintZoomedTile(dst: TBitmap; x, y, Loc: integer);
    384384  public
    385     UsedOffscreenWidth, UsedOffscreenHeight: integer;
     385    UsedOffscreenWidth: Integer;
     386    UsedOffscreenHeight: Integer;
    386387    Offscreen: TBitmap;
    387388    OffscreenUser: TForm;
     
    28432844                ClientHeight - PanelHeight, 64, 64, AILogo[pLogo].Canvas,
    28442845                0, 0);
    2845           end
    2846         end
     2846          end;
     2847        end;
    28472848      end;
    28482849
     
    77017702procedure TMainScreen.Toggle(Sender: TObject);
    77027703begin
    7703   TMenuItem(Sender).Checked := not TMenuItem(Sender).Checked
     7704  TMenuItem(Sender).Checked := not TMenuItem(Sender).Checked;
    77047705end;
    77057706
Note: See TracChangeset for help on using the changeset viewer.