Ignore:
Timestamp:
May 19, 2022, 10:39:34 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Use first capital letter in identifiers.
File:
1 edited

Legend:

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

    r328 r447  
    916916  Cost: Integer;
    917917  Maint: Integer;
    918   Expiration: integer;
     918  Expiration: Integer;
    919919end
    920920= ((Kind: ikWonder; Preq: adMathematics; Cost: 400; Maint: 0;
     
    11201120  Strength: Integer;
    11211121  Trans: Integer;
    1122   Cost: integer;
     1122  Cost: Integer;
    11231123end
    11241124= (((Preq: adWarriorCode; Strength: 4; Trans: 0; Cost: 3),
     
    15101510  TGetCityData = record
    15111511    Owner: Integer;
    1512     c: TCity;
     1512    C: TCity;
    15131513  end;
    15141514
     
    15911591  TCreateUnitData = record
    15921592    Loc: Integer;
    1593     p: Integer;
     1593    P: Integer;
    15941594    mix: Integer;
    15951595  end;
     
    16001600  TOwnerList = array [0 .. INFIN] of ShortInt;
    16011601  TByteList = array [0 .. INFIN] of Byte;
    1602   TIntList = array [0 .. INFIN] of integer;
     1602  TIntList = array [0 .. INFIN] of Integer;
    16031603  TCityList = array [0 .. INFIN] of TCity;
    16041604  TUnList = array [0 .. INFIN] of TUn;
     
    17611761    0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)));
    17621762
    1763   SpecialModelPreq: array [0 .. nSpecialModel - 1] of integer = (preNone,
     1763  SpecialModelPreq: array [0 .. nSpecialModel - 1] of Integer = (preNone,
    17641764    adExplosives, preNone, preNone, (* adWri, *) adIntelligence, adTrade,
    17651765    (* adTheCorporation,adHorsebackRiding,adAutomobile,adNavigation,
     
    17701770  DelphiRandSeed: Integer;
    17711771
    1772 procedure MakeUnitInfo(p: Integer; const u: TUn; var ui: TUnitInfo);
    1773 procedure MakeModelInfo(p, mix: Integer; const m: TModel; var mi: TModelInfo);
     1772procedure MakeUnitInfo(P: Integer; const U: TUn; var ui: TUnitInfo);
     1773procedure MakeModelInfo(P, mix: Integer; const M: TModel; var mi: TModelInfo);
    17741774function IsSameModel(const mi1, mi2: TModelInfo): Boolean;
    17751775function SpecialTile(Loc, TerrType, lx: Integer): Integer;
     
    17811781implementation
    17821782
    1783 procedure MakeUnitInfo(p: Integer; const u: TUn; var ui: TUnitInfo);
     1783procedure MakeUnitInfo(P: Integer; const U: TUn; var ui: TUnitInfo);
    17841784begin
    1785   ui.Owner := p;
    1786   ui.Loc := u.Loc;
    1787   ui.Health := u.Health;
    1788   ui.Fuel := u.Fuel;
    1789   ui.Job := u.Job;
    1790   ui.Exp := u.Exp;
    1791   ui.Load := u.TroopLoad + u.AirLoad;
    1792   ui.mix := u.mix;
    1793   ui.Flags := u.Flags;
     1785  ui.Owner := P;
     1786  ui.Loc := U.Loc;
     1787  ui.Health := U.Health;
     1788  ui.Fuel := U.Fuel;
     1789  ui.Job := U.Job;
     1790  ui.Exp := U.Exp;
     1791  ui.Load := U.TroopLoad + U.AirLoad;
     1792  ui.mix := U.mix;
     1793  ui.Flags := U.Flags;
    17941794end;
    17951795
    1796 procedure MakeModelInfo(p, mix: Integer; const m: TModel; var mi: TModelInfo);
     1796procedure MakeModelInfo(P, mix: Integer; const M: TModel; var mi: TModelInfo);
    17971797var
    1798   i: Integer;
     1798  I: Integer;
    17991799begin
    1800   mi.Owner := p;
     1800  mi.Owner := P;
    18011801  mi.mix := mix;
    1802   mi.ID := m.ID;
    1803   mi.Domain := m.Domain;
    1804   if m.Kind = mkEnemyDeveloped then
     1802  mi.ID := M.ID;
     1803  mi.Domain := M.Domain;
     1804  if M.Kind = mkEnemyDeveloped then
    18051805    mi.Kind := mkSelfDeveloped // important for IsSameModel()
    18061806  else
    1807     mi.Kind := m.Kind;
    1808   mi.Attack := m.Attack;
    1809   mi.Defense := m.Defense;
    1810   mi.Speed := m.Speed;
    1811   mi.Cost := m.Cost;
     1807    mi.Kind := M.Kind;
     1808  mi.Attack := M.Attack;
     1809  mi.Defense := M.Defense;
     1810  mi.Speed := M.Speed;
     1811  mi.Cost := M.Cost;
    18121812  if mi.Domain = dAir then
    18131813  begin
    1814     mi.TTrans := m.Cap[mcAirTrans] * m.MTrans;
    1815     mi.ATrans_Fuel := m.Cap[mcFuel];
     1814    mi.TTrans := M.Cap[mcAirTrans] * M.MTrans;
     1815    mi.ATrans_Fuel := M.Cap[mcFuel];
    18161816  end
    18171817  else
    18181818  begin
    1819     mi.TTrans := m.Cap[mcSeaTrans] * m.MTrans;
    1820     mi.ATrans_Fuel := m.Cap[mcCarrier] * m.MTrans;
    1821   end;
    1822   mi.Bombs := m.Cap[mcBombs] * m.MStrength * 2;
     1819    mi.TTrans := M.Cap[mcSeaTrans] * M.MTrans;
     1820    mi.ATrans_Fuel := M.Cap[mcCarrier] * M.MTrans;
     1821  end;
     1822  mi.Bombs := M.Cap[mcBombs] * M.MStrength * 2;
    18231823  mi.Cap := 0;
    1824   for i := mcFirstNonCap to nFeature - 1 do
    1825     if m.Cap[i] > 0 then
    1826       mi.Cap := mi.Cap or (1 shl (i - mcFirstNonCap));
     1824  for I := mcFirstNonCap to nFeature - 1 do
     1825    if M.Cap[I] > 0 then
     1826      mi.Cap := mi.Cap or (1 shl (I - mcFirstNonCap));
    18271827  mi.MaxUpgrade := 0;
    1828   for i := 1 to nUpgrade - 1 do
    1829     if m.Upgrades and (1 shl i) <> 0 then
    1830       mi.MaxUpgrade := i;
    1831   mi.Weight := m.Weight;
     1828  for I := 1 to nUpgrade - 1 do
     1829    if M.Upgrades and (1 shl I) <> 0 then
     1830      mi.MaxUpgrade := I;
     1831  mi.Weight := M.Weight;
    18321832  mi.Lost := 0;
    18331833end;
     
    18411841  Compare1 := @mi1;
    18421842  Compare2 := @mi2;
    1843   result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and
     1843  Result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and
    18441844    (Compare1[2] = Compare2[2]) and (Compare1[3] = Compare2[3]) and
    18451845    (Compare1[4] = Compare2[4]) and (Compare1[5] = Compare2[5])
     
    18481848function SpecialTile(Loc, TerrType, lx: Integer): Integer;
    18491849var
    1850   x, y, qx, qy, a: Integer;
     1850  X, Y, qx, qy, A: Integer;
    18511851begin
    18521852  if TerrType = fOcean then
    1853     result := 0
     1853    Result := 0
    18541854  else
    18551855  begin
    1856     y := Loc div lx;
    1857     x := Loc - y * lx;
     1856    Y := Loc div lx;
     1857    X := Loc - Y * lx;
    18581858    if TerrType = fGrass then { formula for productive grassland }
    1859       if Odd((lymax + x - y shr 1) shr 1 + x + (y + 1) shr 1) then
    1860         result := 1
     1859      if Odd((lymax + X - Y shr 1) shr 1 + X + (Y + 1) shr 1) then
     1860        Result := 1
    18611861      else
    1862         result := 0
     1862        Result := 0
    18631863    else { formula for special resources }
    18641864    begin
    1865       a := 4 * x - y + 9980;
    1866       qx := a div 10;
    1867       if (qx * 10 = a) and (qx and 3 <> 0) then
     1865      A := 4 * X - Y + 9980;
     1866      qx := A div 10;
     1867      if (qx * 10 = A) and (qx and 3 <> 0) then
    18681868      begin
    1869         qy := (y + x) div 5;
     1869        qy := (Y + X) div 5;
    18701870        if qy and 3 <> qx shr 2 and 1 * 2 then
    18711871          if (TerrType = fArctic) or (TerrType = fSwamp) then
    1872             result := 1
     1872            Result := 1
    18731873          else if TerrType = fShore then
    18741874          begin
    18751875            if (qx + qy) and 1 = 0 then
    18761876              if qx and 3 = 2 then
    1877                 result := 2
     1877                Result := 2
    18781878              else
    1879                 result := 1
     1879                Result := 1
    18801880            else
    1881               result := 0
     1881              Result := 0
    18821882          end
    18831883          else
    1884             result := (qx + qy) and 1 + 1
     1884            Result := (qx + qy) and 1 + 1
    18851885        else
    1886           result := 0;
     1886          Result := 0;
    18871887      end
    18881888      else
    1889         result := 0;
     1889        Result := 0;
    18901890    end
    18911891  end;
Note: See TracChangeset for help on using the changeset viewer.