Ignore:
Timestamp:
Mar 25, 2021, 3:02:29 PM (4 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/AI/StdAI/Barbarina.pas

    r319 r328  
    12421242      WonderAvailable := WonderAvailable and PrimeWonder; // alway prefer prime wonders
    12431243    Count := 0;
    1244     for iix := 0 to 27 do
     1244    for iix := 0 to nWonder - 1 do
    12451245    begin
    12461246      if (1 shl iix) and WonderAvailable <> 0 then
     
    12541254    end;
    12551255    Count := Random(Count);
    1256     for iix := 0 to 27 do
     1256    for iix := 0 to nWonder - 1 do
    12571257    begin
    12581258      if (1 shl iix) and WonderAvailable <> 0 then
     
    13261326  WonderAvailable := 0;
    13271327  WonderInWork := 0;
    1328   for iix := 0 to 27 do
     1328  for iix := 0 to nWonder - 1 do
    13291329    if (Imp[iix].Preq <> preNA) and ((Imp[iix].Preq = preNone) or
    13301330      IsResearched(Imp[iix].Preq)) and (RO.Wonder[iix].CityID = WonderNotBuiltYet) then
     
    13341334    begin
    13351335      iix := City_CurrentImprovementProject(cix);
    1336       if (iix >= 0) and (iix < 28) then
     1336      if (iix >= 0) and (iix < nWonder) then
    13371337        Inc(WonderInWork, 1 shl iix)
    13381338      else if iix = imPalace then
     
    14281428
    14291429          iix := City_CurrentImprovementProject(cix);
    1430           if (iix >= 0) and (iix < 28) or (iix = imPalace) or
     1430          if (iix >= 0) and (iix < nWonder) or (iix = imPalace) or
    14311431            (iix = imShipComp) or (iix = imShipPow) or (iix = imShipHab) then
    14321432            City_OptimizeTiles(cix, rwMaxProd)
     
    14471447          if cix = cixNewCapital then
    14481448            City_StartImprovement(cix, imPalace)
    1449           else if (iix >= 0) and (iix < 28) and ((1 shl iix) and
     1449          else if (iix >= 0) and (iix < nWonder) and ((1 shl iix) and
    14501450            WonderAvailable <> 0) then
    14511451          // complete wonder production first
     
    15031503                City_StartImprovement(cix, woZeus)
    15041504              else if (City_CurrentImprovementProject(cix) >= 0) and
    1505                 (City_CurrentImprovementProject(cix) < 28) then
     1505                (City_CurrentImprovementProject(cix) < nWonder) then
    15061506              begin// wonder already built, try to switch to different one
    15071507                if (WonderAvailable and not WonderInWork > 0) and
     
    15531553              begin // low prio projects
    15541554                ImportantCity := WillProduceColonyShip or (Built[imPalace] > 0);
    1555                 for iix := 0 to 27 do
     1555                for iix := 0 to nWonder - 1 do
    15561556                  if Built[iix] > 0 then
    15571557                    ImportantCity := True;
     
    16051605            City_RebuildImprovement(cix, imTownHall)
    16061606          else if (RO.Government = gFundamentalism) and not WillProduceColonyShip then
    1607             for iix := 28 to nImp - 1 do
     1607            for iix := nWonder to nImp - 1 do
    16081608              if (Built[iix] > 0) and
    16091609                ((iix in [imTemple, imTheater, imCathedral, imColosseum,
Note: See TracChangeset for help on using the changeset viewer.