Changeset 442
- Timestamp:
- May 18, 2022, 10:43:27 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AI/StdAI/AI.pas
r328 r442 176 176 LeaveOutValue: array[0..nAdv - 1] of integer; 177 177 178 179 178 constructor TAI.Create(Nation: integer); 180 179 begin … … 209 208 Result := Data.BehaviorFlags and bBarbarina <> 0; 210 209 end; 211 212 210 213 211 //------------------------------- … … 653 651 Result := ad; 654 652 end; 655 656 653 657 654 //------------------------------- … … 1145 1142 end; 1146 1143 end; 1147 end; // ProcessSettlers 1148 1144 end; 1149 1145 1150 1146 //------------------------------- … … 1350 1346 SetAdvanceValues; 1351 1347 1352 1353 1348 {$IFDEF DEBUG} 1354 1349 (*for p1:=0 to nPl-1 do … … 1380 1375 end; 1381 1376 end; 1382 1383 1377 {$ENDIF} 1384 1385 1378 1386 1379 procedure TAI.CheckGender; … … 1416 1409 end; 1417 1410 end; 1418 1419 1411 1420 1412 procedure TAI.SetAdvanceValues; … … 1785 1777 end; 1786 1778 1787 1788 1779 procedure TAI.MoveUnitsHome; 1789 1780 const … … 2055 2046 Dec(UnitLack[District[Loc], ModelCat[mix]]) 2056 2047 end; 2057 end; // MoveUnitsHome 2058 2048 end; 2059 2049 2060 2050 procedure TAI.CheckAttack(uix: integer); … … 2176 2166 until Exhausted; 2177 2167 end; 2178 end; // CheckAttack 2179 2168 end; 2180 2169 2181 2170 procedure TAI.Patrol(uix: integer); … … 2282 2271 until Exhausted; 2283 2272 end; 2284 end; // Patrol2273 end; 2285 2274 2286 2275 procedure TAI.AttackAndPatrol; … … 2342 2331 Patrol(uix); 2343 2332 end; 2344 end; // AttackAndPatrol 2345 2333 end; 2346 2334 2347 2335 function TAI.HavePort: boolean; … … 2369 2357 end; 2370 2358 end; 2371 2372 2359 2373 2360 procedure TAI.SetCityProduction; … … 2836 2823 2837 2824 ChangeHomeCities; 2838 end; // SetCityProduction 2839 2825 end; 2840 2826 2841 2827 function TAI.ChooseGovernment: integer; … … 2855 2841 Result := gDespotism; 2856 2842 end; 2857 2858 2843 2859 2844 //------------------------------- … … 2927 2912 end; 2928 2913 end; 2929 2930 2914 2931 2915 function TAI.WantNegotiation(Nation: integer; NegoTime: TNegoTime): boolean; … … 3153 3137 end; 3154 3138 end; 3155 end; // Negotiation 3156 3139 end; 3157 3140 3158 3141 procedure SetLeaveOutValue; -
trunk/AI/StdAI/Barbarina.pas
r328 r442 833 833 if Result then 834 834 Moved[uix] := True; 835 end; // ProcessMove835 end; 836 836 837 837 procedure TBarbarina.AttackAndPatrol; … … 1205 1205 end 1206 1206 until not BackToStart; 1207 end; // AttackAndPatrol1207 end; 1208 1208 1209 1209 procedure TBarbarina.Barbarina_SetCityProduction; -
trunk/AI/StdAI/ToolAI.pas
r328 r442 106 106 end; 107 107 108 109 108 const 110 109 // no-formations … … 132 131 mxAdjacent = $00000001; 133 132 134 135 133 var 136 134 nContinent, nOcean, nDistrict: integer; … … 145 143 // total number of prerequisites for each advance 146 144 147 148 145 implementation 149 146 … … 166 163 TurnsAfterLoad: array[0..lxmax * lymax - 1] of shortint; 167 164 168 169 165 procedure ReplaceD(Start, Stop: pinteger; Raider, Twix: integer); 170 166 begin … … 183 179 Result := Start; 184 180 end; 185 186 181 187 182 function TToolAI.CenterOfEmpire: integer; … … 263 258 end; 264 259 265 266 260 //------------------------------------------------------------------------------ 267 261 // City Tiles Processing … … 311 305 end; 312 306 end; 313 314 307 315 308 //------------------------------------------------------------------------------ … … 469 462 Unit_StartJob(uix, TileJob[JobLocOfSettler[uix]]); 470 463 end; 471 end; // JobAssignment_Go 472 464 end; 473 465 474 466 //------------------------------------------------------------------------------ … … 594 586 end; 595 587 end; 596 597 588 598 589 //------------------------------------------------------------------------------ … … 898 889 Result := csForbiddenTile; 899 890 end; 900 end; // CheckStep891 end; 901 892 902 893 (* … … 1020 1011 end; 1021 1012 1022 1023 1013 //------------------------------------------------------------------------------ 1024 1014 // Oversea Transport … … 1108 1098 Pile.Free; 1109 1099 end; 1110 1111 1100 1112 1101 function TToolAI.SeaTransport_MakeGroupPlan( … … 1472 1461 end; 1473 1462 1474 1475 1463 //------------------------------------------------------------------------------ 1476 1464 // Misc … … 1493 1481 end; 1494 1482 end; 1495 1496 1483 1497 1484 //------------------------------------------------------------------------------ -
trunk/Database.pas
r328 r442 171 171 function DoSpyMission(p, pCity, cix, Mission: integer): Cardinal; 172 172 173 173 174 implementation 174 175 … … 247 248 if Tiles and (1 shl V21) <> 0 then 248 249 assert(UsedByCity[Radius[V21]] = Loc); 249 end 250 end; 250 251 {$ENDIF} 251 252 end; 252 end; // CompactLists253 end; 253 254 254 255 { … … 265 266 result := $10000000 266 267 else 267 result := trunc(c0) 268 result := trunc(c0); 268 269 end; 269 270 … … 281 282 else 282 283 result := result * 4; 283 end 284 end; 284 285 end; 285 286 … … 363 364 end; 364 365 inc(RW[p].nModel); 365 end 366 end; 366 367 end; 367 368 end; … … 380 381 Built := 0; 381 382 Lost := 0; 382 ID := p shl 12 + nModel 383 ID := p shl 12 + nModel; 383 384 end; 384 385 inc(nModel); 385 inc(Researched[p]) 386 end 386 inc(Researched[p]); 387 end; 387 388 end; 388 389 … … 392 393 RW[p].Tech[ad] := tsSeen; 393 394 // inc(nTech[p]); 394 inc(Researched[p]) 395 inc(Researched[p]); 395 396 end; 396 397 … … 403 404 for uix := 0 to RW[p1].nUn - 1 do 404 405 if RW[p1].Model[RW[p1].Un[uix].mix].Kind = mkSlaves then 405 RW[p1].Un[uix].Job := jNone 406 RW[p1].Un[uix].Job := jNone; 406 407 end; 407 408 … … 475 476 GWonder[Wonder].EffectiveOwner := -1; 476 477 if Wonder = woPyramids then 477 FreeSlaves 478 end 478 FreeSlaves; 479 end; 479 480 end; 480 481 … … 542 543 inc(VicinityLoc[2], lx0); 543 544 inc(VicinityLoc[4], lx0); 544 end 545 end 545 end; 546 end; 546 547 end 547 548 else … … 552 553 dec(VicinityLoc[0], lx0); 553 554 dec(VicinityLoc[6], lx0); 554 end 555 end; 555 556 end; 556 557 end; … … 612 613 if (MapSize + 1) mod i = 0 then 613 614 primitive := 0; 614 inc(i) 615 inc(i); 615 616 end; 616 617 … … 622 623 repeat 623 624 inc(j); 624 i := i * primitive mod (MapSize + 1) 625 i := i * primitive mod (MapSize + 1); 625 626 until (i = 1) or (j = MapSize + 1); 626 627 until j = MapSize; … … 629 630 function MapGeneratorAvailable: boolean; 630 631 begin 631 result := (primitive > 0) and (lx >= 20) and (ly >= 40) 632 result := (primitive > 0) and (lx >= 20) and (ly >= 40); 632 633 end; 633 634 … … 666 667 ca[x] := cos(v) / ly; 667 668 f1[x] := 2 * pi * exp(Detail * (x - 1)); 668 f2[x] := exp(-x * Smooth) 669 f2[x] := exp(-x * Smooth); 669 670 end; 670 671 … … 688 689 else 689 690 Elevation[x + lx * y] := Round((v + 4) * 20); 690 inc(ElCount[Elevation[x + lx * y]]) 691 inc(ElCount[Elevation[x + lx * y]]); 691 692 end; 692 693 end; … … 709 710 for i := a to Stop do 710 711 if Continent[i] = a then 711 Continent[i] := b 712 Continent[i] := b; 712 713 end; 713 714 … … 736 737 ReplaceCont(Continent[Loc - 1], Continent[Loc], Loc); 737 738 if Continent[Loc] = -1 then 738 Continent[Loc] := Loc 739 end 739 Continent[Loc] := Loc; 740 end; 740 741 end; 741 742 … … 754 755 Wrong := Continent[lx - 1 + lx * (y + 1)]; 755 756 if Wrong >= 0 then 756 ReplaceCont(Wrong, Continent[lx * y], MapSize - 1) 757 ReplaceCont(Wrong, Continent[lx * y], MapSize - 1); 757 758 end; 758 759 end; … … 797 798 inc(AreaCount[xBlock, yBlock]); 798 799 if DelphiRandom(AreaCount[xBlock, yBlock]) = 0 then 799 RareByArea[xBlock, yBlock] := Loc0 800 end 800 RareByArea[xBlock, yBlock] := Loc0; 801 end; 801 802 end; 802 803 end; 803 end 804 end; 804 805 end; 805 806 totalrare := 0; … … 848 849 inc(RareAdjacent[(x + 7) mod 8, y + 1]); 849 850 end; 850 end 851 end; 851 852 end; 852 853 xworst := 0; … … 862 863 xworst := x; 863 864 yworst := y; 864 Cnt := 1 865 Cnt := 1; 865 866 end 866 867 else if (RareAdjacent[x, y] = RareAdjacent[xworst, yworst]) then … … 871 872 xworst := x; 872 873 yworst := y; 873 end 874 end; 874 875 end; 875 876 end; 876 877 AreaCount[xworst, yworst] := 0; 877 dec(totalrare) 878 dec(totalrare); 878 879 end; 879 880 … … 884 885 begin 885 886 RareLoc[Cnt] := RareByArea[x, y]; 886 inc(Cnt) 887 inc(Cnt); 887 888 end; 888 889 for i := 0 to 11 do … … 897 898 if (Loc1 >= 0) and (RealMap[Loc1] and fTerrain = fMountains) then 898 899 RealMap[Loc1] := RealMap[Loc1] and not fTerrain or fHills; 899 end 900 end; 900 901 end; 901 902 for i := 0 to 11 do … … 921 922 begin 922 923 iBest := i; 923 jbest := j 924 end 925 end 924 jbest := j; 925 end; 926 end; 926 927 end 927 928 else if (Cnt = 0) or (Dist[i, j] > Dist[iBest, jbest]) then … … 938 939 RareLoc[jbest] := -1; 939 940 end; 940 end; // RarePositions941 end; 941 942 942 943 function CheckShore(Loc: integer): boolean; … … 1097 1098 begin 1098 1099 dec(bMountains); 1099 inc(plus, ElCount[bMountains]) 1100 inc(plus, ElCount[bMountains]); 1100 1101 end; 1101 1102 Count := plus; … … 1105 1106 begin 1106 1107 dec(bHills); 1107 inc(plus, ElCount[bHills]) 1108 inc(plus, ElCount[bHills]); 1108 1109 end; 1109 1110 inc(Count, plus); … … 1112 1113 begin 1113 1114 dec(bLand); 1114 inc(Count, ElCount[bLand]) 1115 inc(Count, ElCount[bLand]); 1115 1116 end; 1116 1117 … … 1138 1139 end; 1139 1140 if Count = 8 then 1140 RealMap[Loc0] := fOcean 1141 RealMap[Loc0] := fOcean; 1141 1142 end; 1142 1143 … … 1202 1203 Loc1 := CopyFrom[Loc1]; 1203 1204 RealMap[Loc0] := RealMap[Loc0] and not fTerrain or 1204 RealMap[Loc1] and fTerrain 1205 RealMap[Loc1] and fTerrain; 1205 1206 end; 1206 1207 … … 1225 1226 if Loc1 >= 0 then 1226 1227 if RealMap[Loc1] and fTerrain < fGrass then 1227 inc(Count, 2) 1228 inc(Count, 2); 1228 1229 end; 1229 1230 end; 1230 1231 if Count >= 4 then 1231 RealMap[Loc0] := RealMap[Loc0] and not fTerrain or fPrairie 1232 RealMap[Loc0] := RealMap[Loc0] and not fTerrain or fPrairie; 1232 1233 end; 1233 1234 … … 1241 1242 if Loc1 >= 0 then 1242 1243 if RealMap[Loc1] and fTerrain <> fDesert then 1243 inc(Count) 1244 inc(Count); 1244 1245 end; 1245 1246 if Count >= 4 then 1246 RealMap[Loc0] := RealMap[Loc0] and not fTerrain or fPrairie 1247 RealMap[Loc0] := RealMap[Loc0] and not fTerrain or fPrairie; 1247 1248 end; 1248 1249 … … 1257 1258 RealMap[x + lx * (ly - 2)] := RealMap[x + lx * (ly - 2)] and 1258 1259 not fTerrain or fTundra; 1259 RealMap[x + lx * (ly - 1)] := fArctic 1260 RealMap[x + lx * (ly - 1)] := fArctic; 1260 1261 end; 1261 1262 … … 1355 1356 if p1 < nAlive + 1 then 1356 1357 sc[p1] := sc[p1 - 1]; 1357 dec(p1) 1358 dec(p1); 1358 1359 end; 1359 1360 if p1 < nAlive + 1 then … … 1370 1371 Break; // even least crowded continent is more crowded than smallest 1371 1372 inc(sccount[c]); 1372 dec(nsc) 1373 dec(nsc); 1373 1374 until sccount[nsc] > 1; 1374 1375 … … 1380 1381 begin 1381 1382 inc(CountGood); 1382 MinGood := 6 1383 MinGood := 6; 1383 1384 end; 1384 1385 FillChar(nCityLoc, SizeOf(nCityLoc), 0); … … 1401 1402 Loc1 := Radius[V21]; 1402 1403 if (Loc1 >= 0) and (Loc1 < MapSize) and IsGoodTile(Loc1) then 1403 inc(CntGood) 1404 inc(CntGood); 1404 1405 end; 1405 1406 if CntGood >= MinGood then 1406 1407 begin 1407 1408 CityLoc[c, nCityLoc[c]] := Loc; 1408 inc(nCityLoc[c]) 1409 inc(nCityLoc[c]); 1409 1410 end; 1410 1411 end; … … 1449 1450 TestDist := Distance(TestStartLoc[i], TestStartLoc[j]); 1450 1451 if TestDist < MinDist then 1451 MinDist := TestDist 1452 MinDist := TestDist; 1452 1453 end; 1453 1454 if i = sccount[c] - 1 then … … 1595 1596 end; 1596 1597 end; 1597 end; { StartPositions }1598 end; 1598 1599 1599 1600 procedure PredefinedStartPositions(Human: integer); … … 1654 1655 end; 1655 1656 SaveMapCenterLoc := StartLoc[0]; 1656 end; { PredefinedStartPositions }1657 end; 1657 1658 1658 1659 procedure InitGame; … … 1768 1769 Model[nModel].ID := p shl 12 + nModel; 1769 1770 SetModelFlags(Model[nModel]); 1770 inc(nModel) 1771 inc(nModel); 1771 1772 end; 1772 1773 nUn := 0; … … 1790 1791 TerritoryCount[nPl] := MapSize; 1791 1792 // fillchar(NewContact, sizeof(NewContact), false); 1792 end; // InitGame1793 end; 1793 1794 1794 1795 procedure InitRandomGame; … … 1897 1898 if (NewTile and fTerImp = tiIrrigation) or (NewTile and fTerImp = tiFarm) 1898 1899 then 1899 NewTile := NewTile and not fTerImp 1900 NewTile := NewTile and not fTerImp; 1900 1901 end; 1901 1902 if (Terrain[NewTile and fTerrain].MineEff = 0) and … … 1921 1922 RealMap[Loc1] := RealMap[Loc1] or ($F shl 27); 1922 1923 RW[0].Map[Loc1] := RealMap[Loc1] and $07FFFFFF or fObserved; 1923 end 1924 end; 1924 1925 end; 1925 1926 // RealMap[Loc]:=RealMap[Loc] and not fSpecial; … … 2053 2054 end; 2054 2055 result := eOK; 2055 end; { GetTileInfo }2056 end; 2056 2057 2057 2058 procedure Strongest(Loc: integer; var uix, Strength, Bonus, Cnt: integer); … … 2136 2137 if Health < 100 then 2137 2138 result := ((result - 250) * Health div 5000) * 50 + 250; 2138 end 2139 end 2139 end; 2140 end; 2140 2141 end; 2141 2142 … … 2314 2315 (1 shl trPeace or 1 shl TrFriendlyContact) <> 0 then 2315 2316 AddFlags := AddFlags or fPeace; 2316 end 2317 end; 2317 2318 end; 2318 2319 … … 2363 2364 if (Loc1 >= 0) and (Loc1 < MapSize) then 2364 2365 Map[Loc1] := Map[Loc1] or fInEnemyZoC 2365 end 2366 end; 2366 2367 end; 2367 2368 if EnableContact and (mox.Domain = dGround) then … … 2437 2438 Cardinal(Level) shl (2 * pTell); 2438 2439 end; 2439 end; // DiscoverTile2440 end; 2440 2441 2441 2442 function Discover9(Loc, p, Level: integer; … … 2574 2575 begin 2575 2576 RW[pTell].EnemyCity[ecix].Loc := -1; 2576 RW[pTell].Map[Loc] := RW[pTell].Map[Loc] and not fCity 2577 RW[pTell].Map[Loc] := RW[pTell].Map[Loc] and not fCity; 2577 2578 end; 2578 2579 end; … … 2695 2696 begin 2696 2697 Tile1^ := Tile1^ or fInEnemyZoC; 2697 Break 2698 Break; 2698 2699 end; 2699 2700 end; … … 2725 2726 Loc1 := Adjacent[V8]; 2726 2727 if (Loc1 >= 0) and (Loc1 < MapSize) then 2727 RW[p].Map[Loc1] := RW[p].Map[Loc1] or fInEnemyZoC 2728 RW[p].Map[Loc1] := RW[p].Map[Loc1] or fInEnemyZoC; 2728 2729 end; 2729 2730 end; … … 2944 2945 {$IFOPT O-} if OriginLoc <> -2 then 2945 2946 CheckBorders(-2); {$ENDIF} // check: single pass should do! 2946 end; // CheckBorders2947 end; 2947 2948 2948 2949 procedure LogCheckBorders(p, cix, PlayerLosingCity: integer); … … 2976 2977 begin 2977 2978 Fuel := Model[mix].Cap[mcFuel]; 2978 Flags := Flags or unBombsLoaded 2979 Flags := Flags or unBombsLoaded; 2979 2980 end; 2980 2981 Job := jNone; … … 2999 3000 Job := jNone; 3000 3001 Flags := Flags and not(unFortified or unMountainDelay); 3001 Loc0 := Loc 3002 Loc0 := Loc; 3002 3003 end; 3003 3004 if Occupant[Loc0] >= 0 then … … 3014 3015 begin 3015 3016 ZoC := true; 3016 Break 3017 end 3017 Break; 3018 end; 3018 3019 end; 3019 3020 if not Occ then … … 3091 3092 if Enemy >= 0 then 3092 3093 CountLost(p, RW[p].Un[uix].mix, Enemy); 3093 RW[p].Un[uix].Loc := -1 3094 RW[p].Un[uix].Loc := -1; 3094 3095 end; 3095 3096 Occupant[Loc] := -1; … … 3141 3142 (fTerrain or fSpecial or fRiver or nPl shl 27) or fCity; 3142 3143 3143 ChangeTerritory(Loc, p) 3144 ChangeTerritory(Loc, p); 3144 3145 end; 3145 3146 end; … … 3179 3180 Distance(RW[p].City[nearest].Loc, Loc))) then 3180 3181 nearest := cix1; 3181 Home := nearest 3182 Home := nearest; 3182 3183 end 3183 3184 else … … 3374 3375 fPoll) or RealMap[Loc] and (fTerrain or fSpecial or fTerImp or 3375 3376 fRoad or fRR or fCanal or fPoll); 3376 end; // CompleteJob3377 end; 3377 3378 3378 3379 { … … 3595 3596 begin 3596 3597 if execute then 3597 GiveCivilReport(pTarget, pSender) 3598 GiveCivilReport(pTarget, pSender); 3598 3599 end 3599 3600 else if RW[pSender].EnemyReport[pSubject].TurnOfCivilReport < 0 then … … 3610 3611 begin 3611 3612 if execute then 3612 GiveMilReport(pTarget, pSender) 3613 GiveMilReport(pTarget, pSender); 3613 3614 end 3614 3615 else if RW[pSender].EnemyReport[pSubject].TurnOfMilReport < 0 then 3615 3616 result := false 3616 3617 else if execute then 3617 CopyMilReport(pSender, pTarget, pSubject) 3618 CopyMilReport(pSender, pTarget, pSubject); 3618 3619 end; 3619 3620 opMap: … … 3628 3629 begin // agreed treaty end 3629 3630 if execute then 3630 CancelTreaty(pSender, pTarget, false) 3631 CancelTreaty(pSender, pTarget, false); 3631 3632 end 3632 3633 else … … 3732 3733 begin 3733 3734 if execute then 3734 CopyModel(pSender, pTarget, Price - opModel) 3735 CopyModel(pSender, pTarget, Price - opModel); 3735 3736 end 3736 3737 else … … 3747 3748 result:=false 3748 3749 end; } 3749 end 3750 end; 3750 3751 end; 3751 3752 … … 3895 3896 begin // make p1 and p2 know each other 3896 3897 if RW[p1].Treaty[p2] = trNoContact then 3897 IntroduceEnemy(p1, p2) 3898 IntroduceEnemy(p1, p2); 3898 3899 end; 3899 3900 … … 3941 3942 var 3942 3943 i, p1: integer; 3943 3944 3944 begin 3945 3945 if Mode = moPlaying then … … 4032 4032 DiscoverViewAreas(Player); 4033 4033 DiscoverViewAreas(Subject); 4034 Break 4035 end 4034 Break; 4035 end; 4036 4036 end; 4037 4037 4038 4038 sIntSetDevModel: 4039 4039 if Mode < moPlaying then 4040 move(Data, RW[Player].DevModel.Kind, sIntSetDevModel and $F * 4);4040 Move(Data, RW[Player].DevModel.Kind, sIntSetDevModel and $F * 4); 4041 4041 4042 4042 sIntSetModelStatus: … … 4071 4071 RW[Player].EnemyCity[Subject].Status := integer(Data); 4072 4072 end; 4073 4074 end; { case command } 4075 end; { IntServer } 4073 end; 4074 end; 4076 4075 4077 4076 end. -
trunk/GameServer.pas
r435 r442 958 958 if Mode >= moMovie then 959 959 Notify(ntEndInfo); 960 end; { StartGame }960 end; 961 961 962 962 procedure EndGame; … … 1324 1324 Inform(pTurn); 1325 1325 ChangeClientWhenDone(cResume, 0, nil^, 0); 1326 end; // LoadGame1326 end; 1327 1327 1328 1328 procedure InsertTerritoryUpdateCommands; … … 1908 1908 end; 1909 1909 // CheckContact; 1910 end; { BeforeTurn }1910 end; 1911 1911 1912 1912 procedure AfterTurn; … … 2035 2035 CheckWin(p1); 2036 2036 end; 2037 end; // Afterturn2037 end; 2038 2038 2039 2039 procedure NextPlayer; … … 2289 2289 end; 2290 2290 end; 2291 end; // ExecuteMove2291 end; 2292 2292 2293 2293 function ExecuteAttack(p, uix, ToLoc: integer; var MoveInfo: TMoveInfo; … … 2559 2559 end; 2560 2560 end; 2561 end; // ExecuteAttack2561 end; 2562 2562 2563 2563 function MoveUnit(p, uix, dx, dy: integer; TestOnly: boolean): integer; … … 4490 4490 LastEndClientCommand := Command; 4491 4491 {$IFOPT O-}dec(nHandoverStack, 2); {$ENDIF} 4492 end; { <<<server }4492 end; 4493 4493 4494 4494 -
trunk/IPQ.pas
r290 r442 8 8 9 9 type 10 11 10 TIntegerArray = array [0 .. $40000000 div sizeof(integer)] of integer; 12 11 PIntegerArray = ^TIntegerArray; … … 158 157 Ix[last.Item] := i; 159 158 end; 160 result := True 159 result := True; 161 160 end; 162 161 -
trunk/Inp.pas
r408 r442 26 26 var 27 27 InputDlg: TInputDlg; 28 28 29 29 30 implementation -
trunk/LocalPlayer/Battle.pas
r437 r442 200 200 IsoMap.PaintUnit(1, 0, UnitInfo, 0); 201 201 BitBltCanvas(ca, xm - 8 - 4 - 66, ym + 8 + 12, 66, 48, Buffer.Canvas, 0, 0); 202 end; { PaintBattleOutcome }202 end; 203 203 204 204 procedure TBattleDlg.FormCreate(Sender: TObject); -
trunk/LocalPlayer/CityScreen.pas
r432 r442 1027 1027 1028 1028 MarkUsedOffscreen(ClientWidth, ClientHeight); 1029 end; { OffscreenPaint }1029 end; 1030 1030 1031 1031 procedure TCityDlg.FormShow(Sender: TObject); … … 1408 1408 end; 1409 1409 end; 1410 end; { FormMouseDown }1410 end; 1411 1411 1412 1412 procedure TCityDlg.ChooseProject; -
trunk/LocalPlayer/CityType.pas
r432 r442 189 189 end; 190 190 MarkUsedOffscreen(InnerWidth, InnerHeight); 191 end; { MainPaint }191 end; 192 192 193 193 procedure TCityTypeDlg.LoadType(NewType: integer); -
trunk/LocalPlayer/ClientTools.pas
r397 r442 316 316 UnitInfo := MyRO.EnemyUn[uix]; 317 317 end; 318 end; { GetUnitInfo }318 end; 319 319 320 320 procedure GetCityInfo(Loc: integer; var cix: integer; var CityInfo: TCityInfo); … … 756 756 initialization 757 757 758 759 758 Assert(nImp < 128); 759 CalculateAdvValues; 760 760 761 761 end. -
trunk/LocalPlayer/Diagram.pas
r431 r442 273 273 end; 274 274 MarkUsedOffscreen(InnerWidth, InnerHeight); 275 end; // OffscreenPaint275 end; 276 276 277 277 procedure TDiaDlg.FormPaint(Sender: TObject); -
trunk/LocalPlayer/Draft.pas
r437 r442 5 5 6 6 uses 7 Protocol, ClientTools, Term, ScreenTools, BaseWin, 8 9 LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls, 10 ButtonA, 11 ButtonB, Area; 7 Protocol, ClientTools, Term, ScreenTools, BaseWin, LCLIntf, LCLType, SysUtils, 8 Classes, Graphics, Controls, Forms, ExtCtrls, ButtonA, ButtonB, Area; 12 9 13 10 type -
trunk/LocalPlayer/Enhance.pas
r432 r442 5 5 6 6 uses 7 ScreenTools, BaseWin, Protocol, ClientTools, Term, LCLIntf, LCLType, 8 9 SysUtils, Classes, Graphics, Controls, Forms, IsoEngine, 10 ButtonB, ButtonC, Menus; 7 ScreenTools, BaseWin, Protocol, ClientTools, Term, LCLIntf, LCLType, SysUtils, 8 Classes, Graphics, Controls, Forms, IsoEngine, ButtonB, ButtonC, Menus; 11 9 12 10 type … … 299 297 300 298 MarkUsedOffscreen(InnerWidth, InnerHeight); 301 end; { OffscreenPaint }299 end; 302 300 303 301 procedure TEnhanceDlg.CloseBtnClick(Sender: TObject); -
trunk/LocalPlayer/IsoEngine.pas
r401 r442 5 5 6 6 uses 7 Protocol, ClientTools, ScreenTools, Tribes, 8 LCLIntf, LCLType, SysUtils,Classes, Graphics, UPixelPointer, UGraphicSet;7 Protocol, ClientTools, ScreenTools, Tribes, LCLIntf, LCLType, SysUtils, 8 Classes, Graphics, UPixelPointer, UGraphicSet; 9 9 10 10 const … … 719 719 end; 720 720 end; 721 end; { PaintUnit }721 end; 722 722 723 723 procedure TIsoMap.PaintCity(x, y: integer; const CityInfo: TCityInfo; … … 804 804 Textout(xShield + 2, yShield - 1, LabelTextColor, s); 805 805 end; 806 end; { PaintCity }806 end; 807 807 808 808 function PoleTile(Loc: integer): integer; … … 1300 1300 Textout(x + xxt - 16, y + yyt - 9, $00E0FF, 1301 1301 IntToStr(integer(DebugMap[Loc]))) 1302 end; { PaintTileObjects }1302 end; 1303 1303 1304 1304 procedure TIsoMap.PaintGrid(x, y, nx, ny: integer); … … 1687 1687 1688 1688 // frame(FOutput.Canvas,x+1,y+1,x+nx*33+33-2,y+ny*16+32-2,$FFFF,$FFFF); 1689 end; { Paint }1689 end; 1690 1690 1691 1691 procedure TIsoMap.AttackBegin(const ShowMove: TShowMove); -
trunk/LocalPlayer/MessgEx.pas
r438 r442 5 5 6 6 uses 7 Messg, Protocol, ScreenTools, Platform, DateUtils, 8 LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics, Controls, Forms, ButtonA,9 ButtonB, StdCtrls,DrawDlg;7 Messg, Protocol, ScreenTools, Platform, DateUtils, LCLIntf, LCLType, Messages, 8 SysUtils, Classes, Graphics, Controls, Forms, ButtonA, ButtonB, StdCtrls, 9 DrawDlg; 10 10 11 11 type -
trunk/LocalPlayer/NatStat.pas
r431 r442 48 48 NatStatDlg: TNatStatDlg; 49 49 50 50 51 implementation 51 52 … … 394 395 395 396 MarkUsedOffscreen(ClientWidth, ClientHeight); 396 end; { OffscreenPaint }397 end; 397 398 398 399 procedure TNatStatDlg.CloseBtnClick(Sender: TObject); -
trunk/LocalPlayer/Nego.pas
r432 r442 96 96 NegoDlg: TNegoDlg; 97 97 98 98 99 implementation 99 100 … … 476 477 (ButtonPrice[Tag and $FF] shr 24 in MyAllowed); 477 478 Lit := Delivers[Tag and $FF] <> $FFFFFFFF; 478 end 479 end; 479 480 end; 480 481 end; … … 630 631 631 632 MarkUsedOffscreen(ClientWidth, ClientHeight); 632 end; { OffscreenPaint }633 end; 633 634 634 635 procedure TNegoDlg.Initiate; … … 784 785 if a > MaxShipPartPrice then 785 786 a := MaxShipPartPrice; 786 inc(Price, a) 787 inc(Price, a); 787 788 end; 788 789 opAllTech: … … 843 844 begin 844 845 SimpleMessage(Phrases.Lookup('MAX2OFFERS')); 845 exit 846 exit; 846 847 end; 847 848 Price := ButtonPrice[TButtonN(Sender).Tag and $FF]; … … 886 887 if a > MaxShipPartPrice then 887 888 a := MaxShipPartPrice; 888 inc(Price, a) 889 inc(Price, a); 889 890 end; 890 891 opAllTech: … … 906 907 Price := opAllModel 907 908 else 908 Price := OpModel + ModalSelectDlg.result 909 Price := OpModel + ModalSelectDlg.result; 909 910 end; 910 911 opTreaty: -
trunk/LocalPlayer/PVSB.pas
r346 r442 5 5 6 6 uses 7 {$IFDEF WINDOWS} 8 Windows, 9 {$ENDIF} 7 {$IFDEF WINDOWS}Windows,{$ENDIF} 10 8 Classes, Controls, Forms, LCLIntf, LCLType, LMessages, Messages, SysUtils, 11 9 StdCtrls, Math; -
trunk/LocalPlayer/Rates.pas
r431 r442 5 5 6 6 uses 7 Protocol, ScreenTools, BaseWin, LCLIntf, LCLType, 8 9 SysUtils, Classes, Graphics, Controls, Forms, 10 ButtonB, ButtonC; 7 Protocol, ScreenTools, BaseWin, LCLIntf, LCLType, SysUtils, Classes, Graphics, 8 Controls, Forms, ButtonB, ButtonC; 11 9 12 10 type … … 28 26 var 29 27 RatesDlg: TRatesDlg; 28 30 29 31 30 implementation -
trunk/LocalPlayer/Select.pas
r439 r442 1519 1519 Lines[2] := 0; 1520 1520 end; 1521 end; // InitLines1521 end; 1522 1522 1523 1523 function TListDlg.OnlyChoice(TestKind: TListKind): integer; -
trunk/LocalPlayer/Term.pas
r441 r442 2082 2082 s := Tribe[me].TPhrase('AGE0'); 2083 2083 MessgText := 2084 Format(s, [TurnToString(MyRO.Turn), CityName(MyCity[0].ID)]) 2084 Format(s, [TurnToString(MyRO.Turn), CityName(MyCity[0].ID)]); 2085 2085 end 2086 2086 else … … 2088 2088 s := Tribe[me].TString(Phrases2.Lookup('AGE0')); 2089 2089 MessgText := Format(s, [TurnToString(MyRO.Turn)]); 2090 end 2090 end; 2091 2091 end 2092 2092 else … … 8302 8302 end; 8303 8303 8304 initialization8305 8306 8304 end. 8307 8305 -
trunk/LocalPlayer/UnitStat.pas
r431 r442 695 695 (ClientWidth - BiColorTextWidth(offscreen.Canvas, Caption)) div 2, 696 696 yCaption, Caption); 697 end; { OffscreenPaint }697 end; 698 698 699 699 procedure TUnitStatDlg.ModelBoxChange(Sender: TObject); -
trunk/LocalPlayer/Wonders.pas
r432 r442 281 281 282 282 MarkUsedOffscreen(ClientWidth, ClientHeight); 283 end; { OffscreenPaint }283 end; 284 284 285 285 procedure TWondersDlg.CloseBtnClick(Sender: TObject); -
trunk/Log.pas
r438 r442 110 110 s := s + Tribe[SlotNo[Y, X]].TPhrase('SHORTNAME') + ' | '; 111 111 end; 112 List.Lines.Add(s) 112 List.Lines.Add(s); 113 113 end; 114 114 PostMessage(List.Handle, WM_VSCROLL, SB_BOTTOM, 0); -
trunk/NoTerm.pas
r417 r442 52 52 procedure Client(Command, Player: integer; var Data); stdcall; 53 53 54 54 55 implementation 55 56 56 57 uses 57 GameServer, log;58 GameServer, Log; 58 59 59 60 {$R *.lfm} -
trunk/Packages/CevoComponents/BaseWin.pas
r440 r442 513 513 MainFormKeyDown := nil; 514 514 515 finalization516 517 515 end. -
trunk/Packages/CevoComponents/ScreenTools.pas
r424 r442 1644 1644 1645 1645 procedure Gtk2Fix; 1646 {$IFDEF UNIX} 1646 1647 var 1647 1648 I: Integer; 1649 {$ENDIF} 1648 1650 begin 1649 1651 {$IFDEF UNIX} -
trunk/Platform.pas
r423 r442 9 9 10 10 function NowPrecise: TDateTime; 11 11 12 12 13 implementation -
trunk/Start.pas
r429 r442 1928 1928 end; 1929 1929 1930 1931 1930 end. -
trunk/UBrain.pas
r424 r442 204 204 end; 205 205 206 207 206 end. 208 207 -
trunk/UMiniMap.pas
r381 r442 328 328 end; 329 329 330 331 330 end. 332 331 -
trunk/UnitProcessing.pas
r290 r442 43 43 procedure InitGame; 44 44 procedure ReleaseGame; 45 45 46 46 47 implementation … … 132 133 begin // p observes tile 133 134 result := coKnown or coTrue; 134 exit 135 exit; 135 136 end 136 137 else 137 138 result := coTrue; // p does not observe tile 138 139 end; 139 end 140 end; 140 141 end; 141 142 … … 187 188 MoveCost := Speed; 188 189 result := eMountains; 189 exit 190 exit; 190 191 end; 191 192 end; … … 207 208 dAir: 208 209 MoveCost := 50 * MoveLength; { always valid move } 209 end 210 end 210 end; 211 end; 211 212 end; 212 213 … … 266 267 begin 267 268 result := eTreaty; 268 exit 269 exit; 269 270 end; // keep peace treaty! 270 271 end; … … 280 281 begin 281 282 result := eNoCapturer; 282 exit 283 exit; 283 284 end; 284 285 MoveInfo.MoveType := mtCapture; … … 289 290 begin 290 291 result := eDomainMismatch; 291 exit 292 exit; 292 293 end 293 294 else if (PModel.Attack = 0) and … … 296 297 begin 297 298 result := eNoBombarder; 298 exit 299 exit; 299 300 end 300 301 else if Movement < 100 then 301 302 begin 302 303 result := eNoTime_Bombard; 303 exit 304 exit; 304 305 end; 305 306 MoveInfo.MoveType := mtBombard; 306 307 result := eBombarded; 307 end 308 end; 308 309 end; 309 310 … … 328 329 MoveInfo.EndHealth := BattleForecast.EndHealthAtt; 329 330 MoveInfo.EndHealthDef := BattleForecast.EndHealthDef; 330 end 331 end; 331 332 end 332 333 else // if MoveInfo.MoveType in [mtMove,mtCapture,mtSpyMission] then … … 382 383 then 383 384 Break; 384 end 385 end; 385 386 end; 386 387 if result < rExecuted then … … 401 402 begin 402 403 result := eZOC; 403 exit 404 exit; 404 405 end 405 406 else if not TestOnly and (DestControlled >= coTrue) then 406 407 begin 407 408 result := eZOC_EnemySpotted; 408 exit 409 end 409 exit; 410 end; 410 411 end; 411 412 if (Movement = 0) and (ServerVersion[p] >= $0100F1) or … … 414 415 begin 415 416 result := eNoTime_Load; 416 exit 417 exit; 417 418 end 418 419 else 419 420 begin 420 421 result := eNoTime_Move; 421 exit 422 exit; 422 423 end; 423 424 if (MoveInfo.EndHealth <= 0) or (MoveInfo.MoveType = mtSpyMission) then … … 433 434 MoveInfo.Defender := RealMap[ToLoc] shr 27; 434 435 SearchCity(ToLoc, MoveInfo.Defender, MoveInfo.Dcix); 435 end 436 end 437 end; // CalculateMove436 end; 437 end; 438 end; 438 439 439 440 function GetBattleForecast(Loc: integer; var BattleForecast: TBattleForecast; … … 449 450 begin 450 451 result := eOK; 451 exit 452 exit; 452 453 end; // no attack, simple move 453 454 … … 459 460 EndHealthDef := RW[Defender].Un[Duix].Health; 460 461 result := eOK; 461 exit 462 exit; 462 463 end; 463 464 … … 482 483 begin 483 484 result := eDomainMismatch; 484 exit 485 exit; 485 486 end; // can't attack plane 486 487 end; … … 492 493 begin 493 494 result := eDomainMismatch; 494 exit 495 exit; 495 496 end; 496 497 if (PModel.Attack = 0) and not((PModel.Cap[mcBombs] > 0) and … … 498 499 begin 499 500 result := eInvalid; 500 exit 501 exit; 501 502 end; 502 503 … … 504 505 begin 505 506 result := eNoTime_Attack; 506 exit 507 exit; 507 508 end; 508 509 … … 577 578 DBaseDamage := 1; 578 579 if DBaseDamage > RW[Defender].Un[Duix].Health then 579 DBaseDamage := RW[Defender].Un[Duix].Health 580 DBaseDamage := RW[Defender].Un[Duix].Health; 580 581 end; 581 582 … … 589 590 ABaseDamage := 1; 590 591 if ABaseDamage > HealthAtt then 591 ABaseDamage := HealthAtt 592 ABaseDamage := HealthAtt; 592 593 end; 593 594 … … 625 626 result := eWon 626 627 else 627 result := eBloody 628 end 629 end; // GetBattleForecast628 result := eBloody; 629 end; 630 end; 630 631 631 632 function LoadUnit(p, uix: integer; TestOnly: boolean): integer; … … 654 655 begin 655 656 ToMaster := uix1; 656 Break 657 Break; 657 658 end 658 659 else if ToMaster < 0 then … … 679 680 Master := ToMaster; 680 681 UpdateUnitMap(Loc); 681 end 682 end 683 end 684 end 682 end; 683 end; 684 end; 685 end; 685 686 end; 686 687 … … 721 722 UpdateUnitMap(Loc); 722 723 end; 723 end 724 end; 724 725 end; 725 726 … … 802 803 begin 803 804 result := eInvalid; 804 exit 805 exit; 805 806 end; 806 807 if (a.ToLoc <> maNextCity) and (Map[a.ToLoc] and fTerrain = fUNKNOWN) then 807 808 begin 808 809 result := eNoWay; 809 exit 810 exit; 810 811 end; 811 812 … … 816 817 begin 817 818 result := eDomainMismatch; 818 exit 819 exit; 819 820 end 820 821 else … … 843 844 begin 844 845 result := eDomainMismatch; 845 exit 846 exit; 846 847 end 847 848 else … … 859 860 maxmov := Speed; 860 861 initmov := 0; 861 end 862 end; 862 863 end; 863 864 … … 873 874 begin 874 875 Loc := -1; 875 Break 876 Break; 876 877 end; 877 878 FromTile := Map[Loc]; … … 1029 1030 From[Loc1] := Loc; 1030 1031 Damage[Loc1] := Damage[Loc] + AddDamage; 1031 end 1032 end 1033 end 1034 end 1035 end 1032 end; 1033 end; 1034 end; 1035 end; 1036 end; 1036 1037 end; 1037 1038 FreeAndNil(Q); … … 1074 1075 1075 1076 // QueryPerformanceCounter(tt);{time in s is: (tt-tt0)/PerfFreq} 1076 end; // GetMoveAdvice1077 end; 1077 1078 1078 1079 function CanPlaneReturn(p, uix: integer; … … 1129 1130 begin 1130 1131 result := false; 1131 Break 1132 Break; 1132 1133 end; 1133 1134 if MapFlags[Loc] and mfEnd <> 0 then 1134 1135 begin 1135 1136 result := true; 1136 Break 1137 Break; 1137 1138 end; 1138 1139 FromTile := Map[Loc]; … … 1161 1162 T1 := T + MoveCost shl 8; 1162 1163 Q.Put(Loc1, T1); 1163 end 1164 end 1165 end 1164 end; 1165 end; 1166 end; 1166 1167 end; 1167 1168 FreeAndNil(Q); 1168 end; // CanPlaneReturn1169 end; 1169 1170 1170 1171 { … … 1195 1196 inc(JobWork, RoadBridgeWork) { across river } 1196 1197 else 1197 result := eNoBridgeBuilding 1198 result := eNoBridgeBuilding; 1198 1199 end 1199 1200 else … … 1223 1224 if (IrrEff = 0) or (RealMap[Loc] and fTerImp = tiIrrigation) or 1224 1225 (RealMap[Loc] and fTerImp = tiFarm) then 1225 result := eInvalid 1226 result := eInvalid; 1226 1227 end; 1227 1228 jFarm: … … 1232 1233 JobWork := IrrClearWork * FarmWork; 1233 1234 if (JobWork <= 0) or (RealMap[Loc] and fTerImp = tiFarm) then 1234 result := eInvalid 1235 result := eInvalid; 1235 1236 end; 1236 1237 jAfforest: … … 1243 1244 JobWork := MineAfforestWork; 1244 1245 if (MineEff = 0) or (RealMap[Loc] and fTerImp = tiMine) then 1245 result := eInvalid 1246 result := eInvalid; 1246 1247 end; 1247 1248 jFort: … … 1260 1261 JobWork := TransWork; 1261 1262 if JobWork <= 0 then 1262 result := eInvalid 1263 result := eInvalid; 1263 1264 end; 1264 1265 jPoll: … … 1278 1279 result := eInvalid; 1279 1280 end; 1280 end; // CalculateJobWork1281 end; 1281 1282 1282 1283 function StartJob(p, uix, NewJob: integer; TestOnly: boolean): integer; … … 1291 1292 begin 1292 1293 result := eNotChanged; 1293 exit 1294 exit; 1294 1295 end; 1295 1296 if NewJob = jNone then … … 1297 1298 if not TestOnly then 1298 1299 Job := jNone; 1299 exit 1300 exit; 1300 1301 end; 1301 1302 Loc0 := Loc; … … 1304 1305 begin 1305 1306 result := eDeadLands; 1306 exit 1307 exit; 1307 1308 end; 1308 1309 TerrType := RealMap[Loc0] and fTerrain; … … 1314 1315 begin 1315 1316 result := eInvalid; 1316 exit 1317 exit; 1317 1318 end; 1318 1319 if (JobPreq[NewJob] <> preNone) and … … 1320 1321 begin 1321 1322 result := eNoPreq; 1322 exit 1323 exit; 1323 1324 end; 1324 1325 … … 1347 1348 begin 1348 1349 RemoveUnit_UpdateMap(p, uix); 1349 result := eCity 1350 result := eCity; 1350 1351 end 1351 1352 else if Health <= 0 then … … 1361 1362 Discover21(Loc0, p, lObserveUnhidden, true, true); 1362 1363 // CheckContact; 1363 end 1364 end 1365 end; // with1366 end; // StartJob1364 end; 1365 end; 1366 end; 1367 end; 1367 1368 1368 1369 function Work(p, uix: integer): boolean; … … 1422 1423 end 1423 1424 end 1424 end; // work1425 end; 1425 1426 1426 1427 function GetJobProgress(p, Loc: integer; … … 1438 1439 else 1439 1440 JobProgressData[Job].Done := JobProgressData[Job].Required - 1440 ToWork[Loc, Job] 1441 ToWork[Loc, Job]; 1441 1442 end 1442 1443 else
Note:
See TracChangeset
for help on using the changeset viewer.