Changeset 465 for branches/highdpi/AI/StdAI/Protocol.pas
- Timestamp:
- Nov 30, 2023, 10:16:14 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/AI/StdAI/Protocol.pas
r349 r465 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), … … 1510 1510 TGetCityData = record 1511 1511 Owner: Integer; 1512 c: TCity;1512 C: TCity; 1513 1513 end; 1514 1514 … … 1591 1591 TCreateUnitData = record 1592 1592 Loc: Integer; 1593 p: Integer;1593 P: Integer; 1594 1594 mix: Integer; 1595 1595 end; … … 1600 1600 TOwnerList = array [0 .. INFIN] of ShortInt; 1601 1601 TByteList = array [0 .. INFIN] of Byte; 1602 TIntList = array [0 .. INFIN] of integer;1602 TIntList = array [0 .. INFIN] of Integer; 1603 1603 TCityList = array [0 .. INFIN] of TCity; 1604 1604 TUnList = array [0 .. INFIN] of TUn; … … 1761 1761 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); 1762 1762 1763 SpecialModelPreq: array [0 .. nSpecialModel - 1] of integer = (preNone,1763 SpecialModelPreq: array [0 .. nSpecialModel - 1] of Integer = (preNone, 1764 1764 adExplosives, preNone, preNone, (* adWri, *) adIntelligence, adTrade, 1765 1765 (* adTheCorporation,adHorsebackRiding,adAutomobile,adNavigation, … … 1770 1770 DelphiRandSeed: Integer; 1771 1771 1772 procedure MakeUnitInfo( p: Integer; const u: TUn; var ui: TUnitInfo);1773 procedure MakeModelInfo( p, mix: Integer; const m: TModel; var mi: TModelInfo);1772 procedure MakeUnitInfo(P: Integer; const U: TUn; var ui: TUnitInfo); 1773 procedure MakeModelInfo(P, mix: Integer; const M: TModel; var mi: TModelInfo); 1774 1774 function IsSameModel(const mi1, mi2: TModelInfo): Boolean; 1775 1775 function SpecialTile(Loc, TerrType, lx: Integer): Integer; … … 1781 1781 implementation 1782 1782 1783 procedure MakeUnitInfo( p: Integer; const u: TUn; var ui: TUnitInfo);1783 procedure MakeUnitInfo(P: Integer; const U: TUn; var ui: TUnitInfo); 1784 1784 begin 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; 1794 1794 end; 1795 1795 1796 procedure MakeModelInfo( p, mix: Integer; const m: TModel; var mi: TModelInfo);1796 procedure MakeModelInfo(P, mix: Integer; const M: TModel; var mi: TModelInfo); 1797 1797 var 1798 i: Integer;1798 I: Integer; 1799 1799 begin 1800 mi.Owner := p;1800 mi.Owner := P; 1801 1801 mi.mix := mix; 1802 mi.ID := m.ID;1803 mi.Domain := m.Domain;1804 if m.Kind = mkEnemyDeveloped then1802 mi.ID := M.ID; 1803 mi.Domain := M.Domain; 1804 if M.Kind = mkEnemyDeveloped then 1805 1805 mi.Kind := mkSelfDeveloped // important for IsSameModel() 1806 1806 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; 1812 1812 if mi.Domain = dAir then 1813 1813 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]; 1816 1816 end 1817 1817 else 1818 1818 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; 1823 1823 mi.Cap := 0; 1824 for i:= mcFirstNonCap to nFeature - 1 do1825 if m.Cap[i] > 0 then1826 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)); 1827 1827 mi.MaxUpgrade := 0; 1828 for i:= 1 to nUpgrade - 1 do1829 if m.Upgrades and (1 shl i) <> 0 then1830 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; 1832 1832 mi.Lost := 0; 1833 1833 end; … … 1841 1841 Compare1 := @mi1; 1842 1842 Compare2 := @mi2; 1843 result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and1843 Result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and 1844 1844 (Compare1[2] = Compare2[2]) and (Compare1[3] = Compare2[3]) and 1845 1845 (Compare1[4] = Compare2[4]) and (Compare1[5] = Compare2[5]) … … 1848 1848 function SpecialTile(Loc, TerrType, lx: Integer): Integer; 1849 1849 var 1850 x, y, qx, qy, a: Integer;1850 X, Y, qx, qy, A: Integer; 1851 1851 begin 1852 1852 if TerrType = fOcean then 1853 result := 01853 Result := 0 1854 1854 else 1855 1855 begin 1856 y:= Loc div lx;1857 x := Loc - y* lx;1856 Y := Loc div lx; 1857 X := Loc - Y * lx; 1858 1858 if TerrType = fGrass then { formula for productive grassland } 1859 if Odd((lymax + x - y shr 1) shr 1 + x + (y+ 1) shr 1) then1860 result := 11859 if Odd((lymax + X - Y shr 1) shr 1 + X + (Y + 1) shr 1) then 1860 Result := 1 1861 1861 else 1862 result := 01862 Result := 0 1863 1863 else { formula for special resources } 1864 1864 begin 1865 a := 4 * x - y+ 9980;1866 qx := adiv 10;1867 if (qx * 10 = a) and (qx and 3 <> 0) then1865 A := 4 * X - Y + 9980; 1866 qx := A div 10; 1867 if (qx * 10 = A) and (qx and 3 <> 0) then 1868 1868 begin 1869 qy := ( y + x) div 5;1869 qy := (Y + X) div 5; 1870 1870 if qy and 3 <> qx shr 2 and 1 * 2 then 1871 1871 if (TerrType = fArctic) or (TerrType = fSwamp) then 1872 result := 11872 Result := 1 1873 1873 else if TerrType = fShore then 1874 1874 begin 1875 1875 if (qx + qy) and 1 = 0 then 1876 1876 if qx and 3 = 2 then 1877 result := 21877 Result := 2 1878 1878 else 1879 result := 11879 Result := 1 1880 1880 else 1881 result := 01881 Result := 0 1882 1882 end 1883 1883 else 1884 result := (qx + qy) and 1 + 11884 Result := (qx + qy) and 1 + 1 1885 1885 else 1886 result := 0;1886 Result := 0; 1887 1887 end 1888 1888 else 1889 result := 0;1889 Result := 0; 1890 1890 end 1891 1891 end;
Note:
See TracChangeset
for help on using the changeset viewer.