Changeset 328 for trunk/LocalPlayer


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.
Location:
trunk/LocalPlayer
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/CityScreen.pas

    r325 r328  
    325325    for i := 0 to 29 do
    326326    begin
    327       for iix := 28 to nImp - 1 do
     327      for iix := nWonder to nImp - 1 do
    328328        if (ImpPosition[iix] = i) and (c.Built[iix] > 0) then
    329329        begin
     
    336336    i := 30;
    337337    for iix := 0 to nImp do
    338       if (c.Built[iix] > 0) and ((iix < 28) or (ImpPosition[iix] < 0)) then
     338      if (c.Built[iix] > 0) and ((iix < nWonder) or (ImpPosition[iix] < 0)) then
    339339      begin
    340340        FillRect(Rect(5 + 16 * (i mod 3) + 48 * (i div 18),
     
    350350      if iix <> imTrGoods then
    351351      begin
    352         if (iix >= 28) and (ImpPosition[iix] >= 0) then
     352        if (iix >= nWonder) and (ImpPosition[iix] >= 0) then
    353353          i := ImpPosition[iix];
    354354        if i < 36 then
     
    827827      Cnt := 0;
    828828      for iix := 0 to nImp - 1 do
    829         if ((iix < 28) or (ImpPosition[iix] < 0)) and (c.Built[iix] > 0) then
     829        if ((iix < nWonder) or (ImpPosition[iix] < 0)) and (c.Built[iix] > 0) then
    830830        begin
    831831          i := Cnt - Page * 6;
     
    838838    else
    839839    begin
    840       for iix := 28 to nImp - 1 do
     840      for iix := nWonder to nImp - 1 do
    841841      begin
    842842        i := ImpPosition[iix] - 6 * ZoomArea;
  • trunk/LocalPlayer/CityType.pas

    r188 r328  
    158158
    159159  nPool := 0;
    160   for iix := 28 to nImp - 1 do
     160  for iix := nWonder to nImp - 1 do
    161161    if not(iix in listed) and (Imp[iix].Kind = ikCommon) and (iix <> imTrGoods)
    162162      and (Imp[iix].Preq <> preNA) and
  • trunk/LocalPlayer/ClientTools.pas

    r327 r328  
    261261      Inc(Result, CityReport.FoodSurplus);
    262262  end;
    263   for i := 28 to nImp - 1 do
     263  for i := nWonder to nImp - 1 do
    264264    if MyCity[cix].Built[i] > 0 then
    265265      Dec(Result, Imp[i].Maint);
  • trunk/LocalPlayer/Help.pas

    r318 r328  
    14841484                hkMisc + hkCrossLink, miscGovList);
    14851485          NextSection('BUILDALLOW');
    1486           for i := 0 to 27 do
     1486          for i := 0 to nWonder - 1 do
    14871487            if Imp[i].Preq = no then
    14881488              AddImprovement(i);
    1489           for i := 28 to nImp - 1 do
     1489          for i := nWonder to nImp - 1 do
    14901490            if (Imp[i].Preq = no) and (Imp[i].Kind <> ikCommon) then
    14911491              AddImprovement(i);
    1492           for i := 28 to nImp - 1 do
     1492          for i := nWonder to nImp - 1 do
    14931493            if (Imp[i].Preq = no) and (Imp[i].Kind = ikCommon) then
    14941494              AddImprovement(i);
     
    15271527              end;
    15281528          NextSection('EXPIRATION');
    1529           for i := 0 to 27 do
     1529          for i := 0 to nWonder - 1 do
    15301530            if (Imp[i].Preq <> preNA) and (Imp[i].Expiration = no) then
    15311531              AddImprovement(i);
     
    15451545          List := THyperText.Create;
    15461546          List.OwnsObjects := True;
    1547           for i := 28 to nImp - 1 do
     1547          for i := nWonder to nImp - 1 do
    15481548            if (i <> imTrGoods) and (Imp[i].Preq <> preNA) and
    15491549              (Imp[i].Kind = ikCommon) then
     
    15581558          Caption := HelpText.Lookup('HELPTITLE_UNIQUELIST');
    15591559          // AddLine(HelpText.Lookup('HELPTITLE_UNIQUELIST'),pkSection);
    1560           for i := 28 to nImp - 1 do
     1560          for i := nWonder to nImp - 1 do
    15611561            if (Imp[i].Preq <> preNA) and
    15621562              ((Imp[i].Kind = ikNatLocal) or (Imp[i].Kind = ikNatGlobal)) then
     
    15661566            LineFeed;
    15671567            AddLine(HelpText.Lookup('HELPTITLE_SHIPPARTLIST'),pkSection);
    1568             for i:=28 to nImp-1 do
     1568            for i:= nWonder to nImp-1 do
    15691569            if (Imp[i].Preq<>preNA) and (Imp[i].Kind=ikShipPart) then
    15701570            AddLine(Phrases.Lookup('IMPROVEMENTS',i),pkSmallIcon,i,hkImp,i); }
     
    15741574          Caption := HelpText.Lookup('HELPTITLE_WONDERLIST');
    15751575          // AddLine(HelpText.Lookup('HELPTITLE_WONDERLIST'),pkSection);
    1576           for i := 0 to 27 do
     1576          for i := 0 to nWonder - 1 do
    15771577            if Imp[i].Preq <> preNA then
    15781578              AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon, i,
     
    16001600            AddFeature(mcAcademy);
    16011601          end;
    1602           if (no < 28) and not Phrases2FallenBackToEnglish then
     1602          if (no < nWonder) and not Phrases2FallenBackToEnglish then
    16031603          begin
    16041604            LineFeed;
     
    16461646              [Phrases.Lookup('TERRAIN', 3 * 12 + i)]), pkTer, 3 * 12 + i);
    16471647          end;
    1648           if (no < 28) and (Imp[no].Expiration >= 0) then
     1648          if (no < nWonder) and (Imp[no].Expiration >= 0) then
    16491649          begin
    16501650            NextSection('EXPIRATION');
     
    16561656          end;
    16571657          NextSection('SEEALSO');
    1658           if (no < 28) and (Imp[no].Expiration >= 0) then
     1658          if (no < nWonder) and (Imp[no].Expiration >= 0) then
    16591659            AddImprovement(woEiffel);
    16601660          for i := 0 to nImpReplacement - 1 do
  • trunk/LocalPlayer/Select.pas

    r318 r328  
    10681068        code[0, 0] := cpImp + imTrGoods;
    10691069        Lines[0] := 1;
    1070         for i := 28 to nImp - 1 do
     1070        for i := nWonder to nImp - 1 do
    10711071          if Imp[i].Kind = ikCommon then
    10721072            TryAddImpLine(0, i + cpImp);
    1073         for i := 28 to nImp - 1 do
     1073        for i := nWonder to nImp - 1 do
    10741074          if not(Imp[i].Kind in [ikCommon, ikTrGoods]) and
    10751075            ((MyRO.NatBuilt[i] = 0) or (Imp[i].Kind = ikNatLocal)) then
     
    10831083
    10841084        // wonders
    1085         for i := 0 to 27 do
     1085        for i := 0 to nWonder - 1 do
    10861086          TryAddImpLine(1, i + cpImp);
    10871087
  • 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.