Changeset 447 for trunk/Protocol.pas


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/Protocol.pas

    r420 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),
     
    15631563  TGetCityData = record
    15641564    Owner: Integer;
    1565     c: TCity;
     1565    C: TCity;
    15661566  end;
    15671567
     
    16441644  TCreateUnitData = record
    16451645    Loc: Integer;
    1646     p: Integer;
     1646    P: Integer;
    16471647    mix: Integer;
    16481648  end;
     
    16531653  TOwnerList = array [0 .. INFIN] of ShortInt;
    16541654  TByteList = array [0 .. INFIN] of Byte;
    1655   TIntList = array [0 .. INFIN] of integer;
     1655  TIntList = array [0 .. INFIN] of Integer;
    16561656  TCityList = array [0 .. INFIN] of TCity;
    16571657  TUnList = array [0 .. INFIN] of TUn;
     
    18151815    0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)));
    18161816
    1817   SpecialModelPreq: array [0 .. nSpecialModel - 1] of integer = (preNone,
     1817  SpecialModelPreq: array [0 .. nSpecialModel - 1] of Integer = (preNone,
    18181818    adExplosives, preNone, preNone, (* adWri, *) adIntelligence, adTrade,
    18191819    (* adTheCorporation,adHorsebackRiding,adAutomobile,adNavigation,
     
    18241824  DelphiRandSeed: Integer;
    18251825
    1826 procedure MakeUnitInfo(p: Integer; const u: TUn; var ui: TUnitInfo);
    1827 procedure MakeModelInfo(p, mix: Integer; const m: TModel; var mi: TModelInfo);
     1826procedure MakeUnitInfo(P: Integer; const U: TUn; var ui: TUnitInfo);
     1827procedure MakeModelInfo(P, mix: Integer; const M: TModel; var mi: TModelInfo);
    18281828function IsSameModel(const mi1, mi2: TModelInfo): Boolean;
    18291829function SpecialTile(Loc, TerrType, lx: Integer): Integer;
     
    18361836implementation
    18371837
    1838 procedure MakeUnitInfo(p: Integer; const u: TUn; var ui: TUnitInfo);
     1838procedure MakeUnitInfo(P: Integer; const U: TUn; var ui: TUnitInfo);
    18391839begin
    1840   ui.Owner := p;
    1841   ui.Loc := u.Loc;
    1842   ui.Health := u.Health;
    1843   ui.Fuel := u.Fuel;
    1844   ui.Job := u.Job;
    1845   ui.Exp := u.Exp;
    1846   ui.Load := u.TroopLoad + u.AirLoad;
    1847   ui.mix := u.mix;
    1848   ui.Flags := u.Flags;
     1840  ui.Owner := P;
     1841  ui.Loc := U.Loc;
     1842  ui.Health := U.Health;
     1843  ui.Fuel := U.Fuel;
     1844  ui.Job := U.Job;
     1845  ui.Exp := U.Exp;
     1846  ui.Load := U.TroopLoad + U.AirLoad;
     1847  ui.mix := U.mix;
     1848  ui.Flags := U.Flags;
    18491849end;
    18501850
    1851 procedure MakeModelInfo(p, mix: Integer; const m: TModel; var mi: TModelInfo);
     1851procedure MakeModelInfo(P, mix: Integer; const M: TModel; var mi: TModelInfo);
    18521852var
    1853   i: Integer;
     1853  I: Integer;
    18541854begin
    1855   mi.Owner := p;
     1855  mi.Owner := P;
    18561856  mi.mix := mix;
    1857   mi.ID := m.ID;
    1858   mi.Domain := m.Domain;
    1859   if m.Kind = mkEnemyDeveloped then
     1857  mi.ID := M.ID;
     1858  mi.Domain := M.Domain;
     1859  if M.Kind = mkEnemyDeveloped then
    18601860    mi.Kind := mkSelfDeveloped // important for IsSameModel()
    18611861  else
    1862     mi.Kind := m.Kind;
    1863   mi.Attack := m.Attack;
    1864   mi.Defense := m.Defense;
    1865   mi.Speed := m.Speed;
    1866   mi.Cost := m.Cost;
     1862    mi.Kind := M.Kind;
     1863  mi.Attack := M.Attack;
     1864  mi.Defense := M.Defense;
     1865  mi.Speed := M.Speed;
     1866  mi.Cost := M.Cost;
    18671867  if mi.Domain = dAir then
    18681868  begin
    1869     mi.TTrans := m.Cap[mcAirTrans] * m.MTrans;
    1870     mi.ATrans_Fuel := m.Cap[mcFuel];
     1869    mi.TTrans := M.Cap[mcAirTrans] * M.MTrans;
     1870    mi.ATrans_Fuel := M.Cap[mcFuel];
    18711871  end
    18721872  else
    18731873  begin
    1874     mi.TTrans := m.Cap[mcSeaTrans] * m.MTrans;
    1875     mi.ATrans_Fuel := m.Cap[mcCarrier] * m.MTrans;
    1876   end;
    1877   mi.Bombs := m.Cap[mcBombs] * m.MStrength * 2;
     1874    mi.TTrans := M.Cap[mcSeaTrans] * M.MTrans;
     1875    mi.ATrans_Fuel := M.Cap[mcCarrier] * M.MTrans;
     1876  end;
     1877  mi.Bombs := M.Cap[mcBombs] * M.MStrength * 2;
    18781878  mi.Cap := 0;
    1879   for i := mcFirstNonCap to nFeature - 1 do
    1880     if m.Cap[i] > 0 then
    1881       mi.Cap := mi.Cap or (1 shl (i - mcFirstNonCap));
     1879  for I := mcFirstNonCap to nFeature - 1 do
     1880    if M.Cap[I] > 0 then
     1881      mi.Cap := mi.Cap or (1 shl (I - mcFirstNonCap));
    18821882  mi.MaxUpgrade := 0;
    1883   for i := 1 to nUpgrade - 1 do
    1884     if m.Upgrades and (1 shl i) <> 0 then
    1885       mi.MaxUpgrade := i;
    1886   mi.Weight := m.Weight;
     1883  for I := 1 to nUpgrade - 1 do
     1884    if M.Upgrades and (1 shl I) <> 0 then
     1885      mi.MaxUpgrade := I;
     1886  mi.Weight := M.Weight;
    18871887  mi.Lost := 0;
    18881888end;
     
    18961896  Compare1 := @mi1;
    18971897  Compare2 := @mi2;
    1898   result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and
     1898  Result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and
    18991899    (Compare1[2] = Compare2[2]) and (Compare1[3] = Compare2[3]) and
    19001900    (Compare1[4] = Compare2[4]) and (Compare1[5] = Compare2[5])
     
    19031903function SpecialTile(Loc, TerrType, lx: Integer): Integer;
    19041904var
    1905   x, y, qx, qy, a: Integer;
     1905  X, Y, qx, qy, A: Integer;
    19061906begin
    19071907  if TerrType = fOcean then
    1908     result := 0
     1908    Result := 0
    19091909  else
    19101910  begin
    1911     y := Loc div lx;
    1912     x := Loc - y * lx;
     1911    Y := Loc div lx;
     1912    X := Loc - Y * lx;
    19131913    if TerrType = fGrass then { formula for productive grassland }
    1914       if Odd((lymax + x - y shr 1) shr 1 + x + (y + 1) shr 1) then
    1915         result := 1
     1914      if Odd((lymax + X - Y shr 1) shr 1 + X + (Y + 1) shr 1) then
     1915        Result := 1
    19161916      else
    1917         result := 0
     1917        Result := 0
    19181918    else { formula for special resources }
    19191919    begin
    1920       a := 4 * x - y + 9980;
    1921       qx := a div 10;
    1922       if (qx * 10 = a) and (qx and 3 <> 0) then
     1920      A := 4 * X - Y + 9980;
     1921      qx := A div 10;
     1922      if (qx * 10 = A) and (qx and 3 <> 0) then
    19231923      begin
    1924         qy := (y + x) div 5;
     1924        qy := (Y + X) div 5;
    19251925        if qy and 3 <> qx shr 2 and 1 * 2 then
    19261926          if (TerrType = fArctic) or (TerrType = fSwamp) then
    1927             result := 1
     1927            Result := 1
    19281928          else if TerrType = fShore then
    19291929          begin
    19301930            if (qx + qy) and 1 = 0 then
    19311931              if qx and 3 = 2 then
    1932                 result := 2
     1932                Result := 2
    19331933              else
    1934                 result := 1
     1934                Result := 1
    19351935            else
    1936               result := 0
     1936              Result := 0
    19371937          end
    19381938          else
    1939             result := (qx + qy) and 1 + 1
     1939            Result := (qx + qy) and 1 + 1
    19401940        else
    1941           result := 0;
     1941          Result := 0;
    19421942      end
    19431943      else
    1944         result := 0;
     1944        Result := 0;
    19451945    end;
    19461946  end;
Note: See TracChangeset for help on using the changeset viewer.