- Timestamp:
- Apr 21, 2024, 8:55:53 PM (7 months ago)
- Location:
- trunk/AI/StdAI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AI/StdAI/AI.pas
r548 r549 1788 1788 DistrictNeed, DistrictNeed0: array[0..maxCOD - 1] of Integer; 1789 1789 ModelOrder: array[0..nMmax - 1] of Integer; 1790 complete, Fortified: Boolean;1790 Complete, Fortified: Boolean; 1791 1791 1792 1792 function IsBombarded(cix: Integer): Boolean; … … 1953 1953 end; 1954 1954 1955 complete := Loop >= FirstSurplusLoop[Cat];1955 Complete := Loop >= FirstSurplusLoop[Cat]; 1956 1956 for I := nModelOrder - 1 downto 0 do 1957 1957 begin … … 1967 1967 Dec(DistrictNeed[District[Loc]]); 1968 1968 Destination[uix] := Loc; 1969 complete := False;1969 Complete := False; 1970 1970 end; 1971 1971 … … 1980 1980 FindDestination(uix); 1981 1981 if Destination[uix] >= 0 then 1982 complete := False;1982 Complete := False; 1983 1983 end; 1984 1984 end; 1985 1985 Inc(Loop) 1986 until complete;1986 until Complete; 1987 1987 end; 1988 1988 … … 2005 2005 DistrictNeed0 := DistrictNeed; 2006 2006 2007 complete := True;2007 Complete := True; 2008 2008 for uix := 0 to RO.nUn - 1 do 2009 2009 with MyUnit[uix] do … … 2015 2015 begin 2016 2016 if DistrictNeed0[District[Loc]] > 0 then 2017 complete := False;2017 Complete := False; 2018 2018 end 2019 2019 else … … 2021 2021 FindDestination(uix); 2022 2022 // if (Destination[uix]<0) and (RO.Territory[Loc]=me) then 2023 // complete:=false; // causes hangup when unit can't move due to zoc2023 // Complete:=false; // causes hangup when unit can't move due to zoc 2024 2024 end; 2025 until complete;2025 until Complete; 2026 2026 2027 2027 for uix := 0 to RO.nUn - 1 do … … 2044 2044 case ModelCat[mix] of 2045 2045 mctGroundDefender, mctGroundAttacker: 2046 Dec(UnitLack[District[Loc], ModelCat[mix]]) 2046 Dec(UnitLack[District[Loc], ModelCat[mix]]); 2047 2047 end; 2048 2048 end; … … 2351 2351 F := Formation[AdjacentLoc]; 2352 2352 if (F >= 0) and (F < maxCOD) and (OceanPresence[F] and 2353 not (1 shl Me) <> 0) then 2354 Result := True; 2353 not (1 shl Me) <> 0) then begin 2354 Result := True; 2355 Exit; 2356 end; 2355 2357 end; 2356 2358 end; -
trunk/AI/StdAI/Barbarina.pas
r531 r549 218 218 Result := True; 219 219 for cix := 0 to RO.nCity - 1 do 220 with MyCity[cix] do 220 with MyCity[cix] do begin 221 221 if Loc >= 0 then 222 222 begin // search for modern resource … … 225 225 begin 226 226 Loc1 := Radius[V21]; 227 if (Loc1 >= 0) and (RO.Map[Loc1] and fModern <> 0) then 227 if (Loc1 >= 0) and (RO.Map[Loc1] and fModern <> 0) then begin 228 228 Result := False; 229 end; 230 end; 229 Break; 230 end; 231 end; 232 end; 233 if not Result then Break; 234 end; 231 235 end 232 236 else if IsResearched(adGunPowder) then … … 892 896 for F := 0 to maxCOD - 1 do 893 897 if (F < nContinent) and (ContinentPresence[F] and not 894 (1 shl Me or PresenceUnknown) <> 0) then 895 Go := True; // any enemy island known? 898 (1 shl Me or PresenceUnknown) <> 0) then begin 899 Go := True; // any enemy island known? 900 Break; 901 end; 896 902 if not Go then 897 903 Exit; … … 922 928 (TroopLoad = 0) and (Health = 100) then 923 929 begin 924 go := True;930 Go := True; 925 931 SeaTransport_AddTransport(uix); 926 932 end; … … 1170 1176 if MyUnit[uix].Loc >= 0 then 1171 1177 RateAttack(uix); 1172 end 1173 until BackToStart 1178 end; 1179 until BackToStart; 1174 1180 until not BackToStart; 1175 1181 … … 1214 1220 function LowPriority(cix: Integer): Boolean; 1215 1221 var 1216 part, cixHighPriority, TestDistance: Integer;1222 Part, cixHighPriority, TestDistance: Integer; 1217 1223 begin 1218 1224 Result := False; 1219 for part := 0 to nShipPart - 1 do1225 for Part := 0 to nShipPart - 1 do 1220 1226 begin 1221 cixHighPriority := ColonyShipPlan[ part].cixProducing;1227 cixHighPriority := ColonyShipPlan[Part].cixProducing; 1222 1228 if (cixHighPriority >= 0) and (cixHighPriority <> cix) then 1223 1229 begin … … 1375 1381 for cix := 0 to RO.nCity - 1 do 1376 1382 with MyCity[cix] do 1377 if (Loc >= 0) and (Project and (cpImp + cpIndex) = cpImp + imAlgae) then 1383 if (Loc >= 0) and (Project and (cpImp + cpIndex) = cpImp + imAlgae) then begin 1378 1384 AlgaeAvailable := False; 1385 Break; 1386 end; 1379 1387 1380 1388 for cix := 0 to RO.nCity - 1 do … … 1494 1502 with MyUnit[uix] do 1495 1503 if (Loc >= 0) and (Home = cix) and 1496 (MyModel[mix].Kind = mkSettler) then 1497 HasSettler := True; 1504 (MyModel[mix].Kind = mkSettler) then begin 1505 HasSettler := True; 1506 Break; 1507 end; 1498 1508 if ((RO.Government <> gDespotism) or (RO.nUn >= RO.nCity * 4)) and 1499 1509 not IsResearched(adMassProduction) and (Built[imPalace] > 0) and … … 1552 1562 ImportantCity := WillProduceColonyShip or (Built[imPalace] > 0); 1553 1563 for iix := 0 to nWonder - 1 do 1554 if Built[iix] > 0 then 1564 if Built[iix] > 0 then begin 1555 1565 ImportantCity := True; 1566 Break; 1567 end; 1556 1568 City_GetReportNew(cix, Report); 1557 1569 if (Report.Corruption >= 6) and (RO.nUn >= RO.nCity * 4) and … … 1697 1709 for I := 0 to nFeature - 1 do 1698 1710 if (Cap[I] > 0) and (Feature[I].Preq <> preNone) and 1699 ((Feature[I].Preq < 0) or not IsResearched(Feature[I].Preq)) then 1700 Ready := False; 1711 ((Feature[I].Preq < 0) or not IsResearched(Feature[I].Preq)) then begin 1712 Ready := False; 1713 Break; 1714 end; 1701 1715 if Ready then 1702 1716 begin 1703 1717 for I := 0 to nUpgrade - 1 do 1704 1718 if (Upgrades and (1 shl I) <> 0) and not 1705 IsResearched(Upgrade[Domain, I].Preq) then 1706 Ready := False; 1719 IsResearched(Upgrade[Domain, I].Preq) then begin 1720 Ready := False; 1721 Break; 1722 end; 1707 1723 end; 1708 1724 if Ready then … … 1911 1927 for Part := 0 to nShipPart - 1 do 1912 1928 if (RO.Ship[Me].Parts[Part] < ShipNeed[Part]) // not enough of this kind already 1913 and (ColonyShipPlan[Part].cixProducing < 0) then // no city to produce 1914 Check := True; 1929 and (ColonyShipPlan[Part].cixProducing < 0) then begin // no city to produce 1930 Check := True; 1931 Break; 1932 end; 1915 1933 if Check then 1916 1934 begin
Note:
See TracChangeset
for help on using the changeset viewer.