Changeset 328 for trunk/AI/StdAI


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.
Location:
trunk/AI/StdAI
Files:
4 edited

Legend:

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

    r319 r328  
    11221122            begin // settlers could be added to this city
    11231123              Happy := BasicHappy;
    1124               for i := 0 to 27 do
     1124              for i := 0 to nWonder - 1 do
    11251125                if Built[i] > 0 then
    11261126                  Inc(Happy);
  • 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,
  • trunk/AI/StdAI/Protocol.pas

    r319 r328  
    1111  nImp = 70; { number of improvements }
    1212  nPl = 15; { max number of players, don't change! }
     13  nWonder = 28; { max number of wonders }
    1314  nUmax = 4096; { max units/player, don't set above 4096 }
    1415  nCmax = 1024; { max cities/player, don't set above 4096 }
     
    12911292    Flags: Cardinal;
    12921293  end;
     1294  PUn = ^TUn;
    12931295
    12941296  { TCity }
     
    13141316    // array value =1 indicates built improvement
    13151317  end;
     1318  PCity = ^TCity;
    13161319
    13171320  TModel = packed record
     
    13521355    Flags: Word;
    13531356  end;
     1357  PUnitInfo = ^TUnitInfo;
    13541358
    13551359  TCityInfo = packed record
     
    13621366    Flags: Word;
    13631367  end;
     1368  PCityInfo = ^TCityInfo;
    13641369
    13651370  TModelInfo = packed record
     
    15911596
    15921597  TTileList = array [0 .. INFIN] of Cardinal;
     1598  PTileList = ^TTileList;
    15931599  TTileObservedLastList = array [0 .. INFIN] of SmallInt;
    15941600  TOwnerList = array [0 .. INFIN] of ShortInt;
     
    16451651    Tribute: array [0 .. nPl - 1] of Integer; // no longer in use
    16461652    TributePaid: array [0 .. nPl - 1] of Integer; // no longer in use
    1647     Wonder: array [0 .. 27] of TWonderInfo;
     1653    Wonder: array [0 .. nWonder - 1] of TWonderInfo;
    16481654    Ship: array [0 .. nPl - 1] of TShipInfo;
    1649     NatBuilt: array [28 .. (nImp + 3) div 4 * 4 - 1] of ShortInt;
     1655    NatBuilt: array [nWonder .. (nImp + 3) div 4 * 4 - 1] of ShortInt;
    16501656    nBattleHistory: Integer;
    16511657    BattleHistory: ^TBattleList; // complete list of all my battles in the whole game
  • trunk/AI/StdAI/ToolAI.pas

    r289 r328  
    234234      Inc(Result, CityReport.FoodRep - CityReport.Eaten);
    235235  end;
    236   for i := 28 to nImp - 1 do
     236  for i := nWonder to nImp - 1 do
    237237    if MyCity[cix].Built[i] > 0 then
    238238      Dec(Result, Imp[i].Maint);
Note: See TracChangeset for help on using the changeset viewer.