Ignore:
Timestamp:
Mar 25, 2021, 3:02:29 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Use nWonder constant as number of wonders instead of numeric value.
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r327 r328  
    458458    EnhancementJobs: TEnhancementJobs;
    459459    ImpOrder: array [0 .. nCityType - 1] of TImpOrder;
    460     ToldWonders: array [0 .. 27] of TWonderInfo;
     460    ToldWonders: array [0 .. nWonder - 1] of TWonderInfo;
    461461    ToldTech: array [0 .. nAdv - 1] of ShortInt;
    462462  end;
     
    469469    DeliveredPrices: TPriceSet;
    470470    ReceivedPrices: TPriceSet;
     471  end;
     472
     473  TCurrentMoveInfo = record
     474    AfterMovePaintRadius: Integer;
     475    AfterAttackExpeller: Integer;
     476    DoShow: Boolean;
     477    IsAlly: Boolean;
    471478  end;
    472479
     
    568575
    569576var
    570   Jump: array [0 .. nPl - 1] of integer;
    571   pTurn, pLogo, UnStartLoc, ToldSlavery: integer;
    572   SmallScreen, GameOK, MapValid, skipped, idle: boolean;
    573 
    574   SaveOption: array of integer;
    575   MiniColors: array [0..11, 0..1] of TColor;
     577  Jump: array [0 .. nPl - 1] of Integer;
     578  pTurn: Integer;
     579  pLogo: Integer;
     580  UnStartLoc: Integer;
     581  ToldSlavery: Integer;
     582  SmallScreen: Boolean;
     583  GameOK: Boolean;
     584  MapValid: Boolean;
     585  Skipped: Boolean;
     586  Idle: Boolean;
     587
     588  SaveOption: array of Integer;
    576589  MainMap: TIsoMap;
    577   CurrentMoveInfo: record AfterMovePaintRadius, AfterAttackExpeller: integer;
    578   DoShow, IsAlly: boolean;
    579 end;
     590  CurrentMoveInfo: TCurrentMoveInfo;
    580591
    581592function CityEventName(i: integer): string;
     
    10701081      begin
    10711082        result := false;
    1072         exit
     1083        exit;
    10731084      end;
    10741085      ChosenResearch := ModalSelectDlg.result;
     
    13961407  begin
    13971408    need := false;
    1398     for i := 0 to 27 do
     1409    for i := 0 to nWonder - 1 do
    13991410      if MyRO.Wonder[i].CityID <> WonderNotBuiltYet then
    14001411        need := true;
     
    14921503          $FF - Tribe[i].Color and $FF) * 2;
    14931504        if TestColorDistance < ColorDistance then
    1494           ColorDistance := TestColorDistance
     1505          ColorDistance := TestColorDistance;
    14951506      end;
    14961507    if ColorDistance > BestColorDistance then
    14971508    begin
    14981509      CountBest := 0;
    1499       BestColorDistance := ColorDistance
     1510      BestColorDistance := ColorDistance;
    15001511    end;
    15011512    if ColorDistance = BestColorDistance then
     
    15031514      inc(CountBest);
    15041515      if DelphiRandom(CountBest) = 0 then
    1505         result := j
     1516        result := j;
    15061517    end;
    15071518  end;
     
    15741585        begin
    15751586          MostCost := TestCost;
    1576           IconIndex := imShipComp + i
     1587          IconIndex := imShipComp + i;
    15771588        end;
    15781589      end;
     
    15861597procedure TMainScreen.InitModule;
    15871598var
    1588   x, y, i, j, Domain: integer;
     1599  i, j, Domain: integer;
    15891600begin
    15901601  { search icons for advances: }
     
    16101621              else
    16111622                AdvIcon[i] := 86 + Domain;
    1612       for j := 28 to nImp - 1 do
     1623      for j := nWonder to nImp - 1 do
    16131624        if Imp[j].Preq = i then
    16141625          AdvIcon[i] := j;
    1615       for j := 28 to nImp - 1 do
     1626      for j := nWonder to nImp - 1 do
    16161627        if (Imp[j].Preq = i) and (Imp[j].Kind <> ikCommon) then
    16171628          AdvIcon[i] := j;
     
    16191630        if i = JobPreq[j] then
    16201631          AdvIcon[i] := 84;
    1621       for j := 0 to 27 do
     1632      for j := 0 to nWonder - 1 do
    16221633        if Imp[j].Preq = i then
    16231634          AdvIcon[i] := j;
     
    16371648  TribeNames := tstringlist.Create;
    16381649
    1639   for x := 0 to 11 do
    1640     for y := 0 to 1 do
    1641       MiniColors[x, y] := HGrSystem.Data.Canvas.Pixels[66 + x, 67 + y];
    16421650  IsoEngine.Init(InitEnemyModel);
    16431651  if not IsoEngine.ApplyTileSize(TileSize) and (TileSize <> tsMedium) then
     
    20492057    end;
    20502058
    2051     for i := 0 to 27 do
     2059    for i := 0 to nWonder - 1 do
    20522060    begin
    20532061      OwnWonder := false;
     
    22212229          if (MyRO.Turn > 0) and (Loc >= 0) and (Flags and chCaptured = 0) and
    22222230            (WondersOnly = (Flags and chProduction <> 0) and
    2223             (Project0 and cpImp <> 0) and (Project0 and cpIndex < 28)) then
     2231            (Project0 and cpImp <> 0) and (Project0 and cpIndex < nWonder)) then
    22242232          begin
    22252233            if WondersOnly then
     
    26022610                  inc(ToldAlive, 1 shl i);
    26032611              PeaceEvaHappened := 0;
    2604               for i := 0 to 27 do
     2612              for i := 0 to nWonder - 1 do
    26052613                with ToldWonders[i] do
    26062614                begin
     
    58525860    if CityCaptured and (MyMap[ToLoc] and fCity = 0) then
    58535861    begin // city destroyed
    5854       for i := 0 to 27 do { tell about destroyed wonders }
     5862      for i := 0 to nWonder - 1 do { tell about destroyed wonders }
    58555863        if (MyRO.Wonder[i].CityID = WonderDestroyed) and (MyData.ToldWonders[i].CityID <> WonderDestroyed)
    58565864        then
     
    58745882    begin // city captured
    58755883      ListDlg.AddCity;
    5876       for i := 0 to 27 do { tell about capture of wonders }
     5884      for i := 0 to nWonder - 1 do { tell about capture of wonders }
    58775885        if MyRO.City[MyRO.nCity - 1].Built[i] > 0 then
    58785886          with MessgExDlg do
     
    71837191      // check if city types already usefull:
    71847192      if MyRO.nCity > 0 then
    7185         for i := 28 to nImp - 1 do
     7193        for i := nWonder to nImp - 1 do
    71867194          if (i <> imTrGoods) and (Imp[i].Kind = ikCommon) and
    71877195            (Imp[i].Preq <> preNA) and
     
    72627270    mEUnitStat.Enabled := MyRO.nEnemyModel > 0;
    72637271    { mWonders.Enabled:= false;
    7264       for i:=0 to 27 do if MyRO.Wonder[i].CityID <> WonderNotBuiltYet then
     7272      for i:=0 to nWonder - 1 do if MyRO.Wonder[i].CityID <> WonderNotBuiltYet then
    72657273      mWonders.Enabled:=true; }
    72667274    mDiagram.Enabled := MyRO.Turn >= 2;
Note: See TracChangeset for help on using the changeset viewer.