Changeset 447 for trunk/Protocol.pas
- Timestamp:
- May 19, 2022, 10:39:34 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Protocol.pas
r420 r447 916 916 Cost: Integer; 917 917 Maint: Integer; 918 Expiration: integer;918 Expiration: Integer; 919 919 end 920 920 = ((Kind: ikWonder; Preq: adMathematics; Cost: 400; Maint: 0; … … 1120 1120 Strength: Integer; 1121 1121 Trans: Integer; 1122 Cost: integer;1122 Cost: Integer; 1123 1123 end 1124 1124 = (((Preq: adWarriorCode; Strength: 4; Trans: 0; Cost: 3), … … 1563 1563 TGetCityData = record 1564 1564 Owner: Integer; 1565 c: TCity;1565 C: TCity; 1566 1566 end; 1567 1567 … … 1644 1644 TCreateUnitData = record 1645 1645 Loc: Integer; 1646 p: Integer;1646 P: Integer; 1647 1647 mix: Integer; 1648 1648 end; … … 1653 1653 TOwnerList = array [0 .. INFIN] of ShortInt; 1654 1654 TByteList = array [0 .. INFIN] of Byte; 1655 TIntList = array [0 .. INFIN] of integer;1655 TIntList = array [0 .. INFIN] of Integer; 1656 1656 TCityList = array [0 .. INFIN] of TCity; 1657 1657 TUnList = array [0 .. INFIN] of TUn; … … 1815 1815 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); 1816 1816 1817 SpecialModelPreq: array [0 .. nSpecialModel - 1] of integer = (preNone,1817 SpecialModelPreq: array [0 .. nSpecialModel - 1] of Integer = (preNone, 1818 1818 adExplosives, preNone, preNone, (* adWri, *) adIntelligence, adTrade, 1819 1819 (* adTheCorporation,adHorsebackRiding,adAutomobile,adNavigation, … … 1824 1824 DelphiRandSeed: Integer; 1825 1825 1826 procedure MakeUnitInfo( p: Integer; const u: TUn; var ui: TUnitInfo);1827 procedure MakeModelInfo( p, mix: Integer; const m: TModel; var mi: TModelInfo);1826 procedure MakeUnitInfo(P: Integer; const U: TUn; var ui: TUnitInfo); 1827 procedure MakeModelInfo(P, mix: Integer; const M: TModel; var mi: TModelInfo); 1828 1828 function IsSameModel(const mi1, mi2: TModelInfo): Boolean; 1829 1829 function SpecialTile(Loc, TerrType, lx: Integer): Integer; … … 1836 1836 implementation 1837 1837 1838 procedure MakeUnitInfo( p: Integer; const u: TUn; var ui: TUnitInfo);1838 procedure MakeUnitInfo(P: Integer; const U: TUn; var ui: TUnitInfo); 1839 1839 begin 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; 1849 1849 end; 1850 1850 1851 procedure MakeModelInfo( p, mix: Integer; const m: TModel; var mi: TModelInfo);1851 procedure MakeModelInfo(P, mix: Integer; const M: TModel; var mi: TModelInfo); 1852 1852 var 1853 i: Integer;1853 I: Integer; 1854 1854 begin 1855 mi.Owner := p;1855 mi.Owner := P; 1856 1856 mi.mix := mix; 1857 mi.ID := m.ID;1858 mi.Domain := m.Domain;1859 if m.Kind = mkEnemyDeveloped then1857 mi.ID := M.ID; 1858 mi.Domain := M.Domain; 1859 if M.Kind = mkEnemyDeveloped then 1860 1860 mi.Kind := mkSelfDeveloped // important for IsSameModel() 1861 1861 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; 1867 1867 if mi.Domain = dAir then 1868 1868 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]; 1871 1871 end 1872 1872 else 1873 1873 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; 1878 1878 mi.Cap := 0; 1879 for i:= mcFirstNonCap to nFeature - 1 do1880 if m.Cap[i] > 0 then1881 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)); 1882 1882 mi.MaxUpgrade := 0; 1883 for i:= 1 to nUpgrade - 1 do1884 if m.Upgrades and (1 shl i) <> 0 then1885 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; 1887 1887 mi.Lost := 0; 1888 1888 end; … … 1896 1896 Compare1 := @mi1; 1897 1897 Compare2 := @mi2; 1898 result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and1898 Result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and 1899 1899 (Compare1[2] = Compare2[2]) and (Compare1[3] = Compare2[3]) and 1900 1900 (Compare1[4] = Compare2[4]) and (Compare1[5] = Compare2[5]) … … 1903 1903 function SpecialTile(Loc, TerrType, lx: Integer): Integer; 1904 1904 var 1905 x, y, qx, qy, a: Integer;1905 X, Y, qx, qy, A: Integer; 1906 1906 begin 1907 1907 if TerrType = fOcean then 1908 result := 01908 Result := 0 1909 1909 else 1910 1910 begin 1911 y:= Loc div lx;1912 x := Loc - y* lx;1911 Y := Loc div lx; 1912 X := Loc - Y * lx; 1913 1913 if TerrType = fGrass then { formula for productive grassland } 1914 if Odd((lymax + x - y shr 1) shr 1 + x + (y+ 1) shr 1) then1915 result := 11914 if Odd((lymax + X - Y shr 1) shr 1 + X + (Y + 1) shr 1) then 1915 Result := 1 1916 1916 else 1917 result := 01917 Result := 0 1918 1918 else { formula for special resources } 1919 1919 begin 1920 a := 4 * x - y+ 9980;1921 qx := adiv 10;1922 if (qx * 10 = a) and (qx and 3 <> 0) then1920 A := 4 * X - Y + 9980; 1921 qx := A div 10; 1922 if (qx * 10 = A) and (qx and 3 <> 0) then 1923 1923 begin 1924 qy := ( y + x) div 5;1924 qy := (Y + X) div 5; 1925 1925 if qy and 3 <> qx shr 2 and 1 * 2 then 1926 1926 if (TerrType = fArctic) or (TerrType = fSwamp) then 1927 result := 11927 Result := 1 1928 1928 else if TerrType = fShore then 1929 1929 begin 1930 1930 if (qx + qy) and 1 = 0 then 1931 1931 if qx and 3 = 2 then 1932 result := 21932 Result := 2 1933 1933 else 1934 result := 11934 Result := 1 1935 1935 else 1936 result := 01936 Result := 0 1937 1937 end 1938 1938 else 1939 result := (qx + qy) and 1 + 11939 Result := (qx + qy) and 1 + 1 1940 1940 else 1941 result := 0;1941 Result := 0; 1942 1942 end 1943 1943 else 1944 result := 0;1944 Result := 0; 1945 1945 end; 1946 1946 end;
Note:
See TracChangeset
for help on using the changeset viewer.