Changeset 186 for trunk/Database.pas
- Timestamp:
- May 6, 2020, 8:48:39 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Database.pas
r144 r186 957 957 end; 958 958 if (RealMap[Loc] xor Cardinal(OldTile)) and fTerrain <> 0 then 959 result := true 959 result := true; 960 960 end; 961 961 end; … … 991 991 begin 992 992 z0 := 6 * y div ly; 993 ZPlus := 6 * y / ly - z0 993 ZPlus := 6 * y / ly - z0; 994 994 end 995 995 else 996 996 begin 997 997 z0 := 6 * (ly - 1 - y) div ly; 998 ZPlus := 6 * (ly - 1 - y) / ly - z0 998 ZPlus := 6 * (ly - 1 - y) / ly - z0; 999 999 end; 1000 1000 p0 := 1; … … 1006 1006 begin 1007 1007 RndLow := i; 1008 Break 1009 end; 1010 p0 := p0 - p 1008 Break; 1009 end; 1010 p0 := p0 - p; 1011 1011 end; 1012 1012 end; … … 1053 1053 Cost := 0; 1054 1054 if Q.Put(Loc1, T + Cost shl 8 + 1) then 1055 From[Loc1] := Loc 1056 end 1057 end 1055 From[Loc1] := Loc; 1056 end; 1057 end; 1058 1058 end; 1059 1059 Loc1 := Loc; … … 1075 1075 else if RealMap[Loc] and fTerrain >= fGrass then 1076 1076 RealMap[Loc] := RealMap[Loc] or fRiver; 1077 end 1077 end; 1078 1078 end 1079 1079 else 1080 1080 result := 0; 1081 Q.Free 1081 Q.Free; 1082 1082 end; 1083 1083 … … 1404 1404 CityLoc[c, nCityLoc[c]] := Loc; 1405 1405 inc(nCityLoc[c]) 1406 end 1407 end 1406 end; 1407 end; 1408 1408 end; 1409 1409 Loc := (Loc + 1) * primitive mod (MapSize + 1) - 1; … … 1537 1537 IrrLoc[j] := IrrLoc[nIrrLoc - 1]; 1538 1538 dec(nIrrLoc); 1539 dec(i) 1539 dec(i); 1540 1540 end; 1541 1541 end; … … 1590 1590 StartLoc2[p1] := Loc1; 1591 1591 end; 1592 end 1592 end; 1593 1593 end; 1594 1594 end; { StartPositions } … … 1795 1795 StartPositions; 1796 1796 InitGame; 1797 end; { InitRandomGame }1797 end; 1798 1798 1799 1799 procedure InitMapGame(Human: integer); … … 1803 1803 PredefinedStartPositions(Human); 1804 1804 InitGame; 1805 end; { InitMapGame }1805 end; 1806 1806 1807 1807 procedure ReleaseGame; … … 1824 1824 FreeMem(RW[p1].MapObservedLast); 1825 1825 FreeMem(RW[p1].Map); 1826 end 1826 end; 1827 1827 end; 1828 1828 … … 1944 1944 begin 1945 1945 result := eNoPreq; 1946 exit 1946 exit; 1947 1947 end; 1948 1948 end; … … 1958 1958 begin 1959 1959 result := eInvalid; 1960 exit 1960 exit; 1961 1961 end; // no city found here 1962 1962 … … 2114 2114 Det := TestDet; 2115 2115 Cost := TestCost; 2116 end 2117 end 2118 end 2116 end; 2117 end; 2118 end; 2119 2119 end; 2120 2120 end; … … 2178 2178 UnitReport.ReportFlags := UnitReport.ReportFlags or urfDeployed; 2179 2179 end; 2180 end 2180 end; 2181 2181 end; 2182 2182 end; … … 2373 2373 end 2374 2374 else 2375 AddFlags := AddFlags or Map[Loc] and (fStealthUnit or fHiddenUnit) 2376 end 2375 AddFlags := AddFlags or Map[Loc] and (fStealthUnit or fHiddenUnit); 2376 end; 2377 2377 end; // if Mode>moLoading_Fast 2378 2378 … … 2431 2431 ObserveLevel[Loc] := ObserveLevel[Loc] and not(3 shl (2 * pTell)) or 2432 2432 Cardinal(Level) shl (2 * pTell); 2433 end 2433 end; 2434 2434 end; // DiscoverTile 2435 2435 … … 2460 2460 result := DiscoverTile(Loc1, p, pTell, Level, EnableContact) 2461 2461 or result; 2462 end 2462 end; 2463 2463 end 2464 2464 else … … 2467 2467 if Level > OldLevel then 2468 2468 result := DiscoverTile(Loc1, p, p, Level, EnableContact) or result; 2469 end 2469 end; 2470 2470 end; 2471 2471 end; … … 2500 2500 result := DiscoverTile(Loc1, p, pTell, Level, EnableContact) 2501 2501 or result; 2502 end 2502 end; 2503 2503 end 2504 2504 else … … 2507 2507 if Level > OldLevel then 2508 2508 result := DiscoverTile(Loc1, p, p, Level, EnableContact) or result; 2509 end 2509 end; 2510 2510 end; 2511 2511 AdjacentFlags := AdjacentFlags shr 1; … … 2570 2570 RW[pTell].EnemyCity[ecix].Loc := -1; 2571 2571 RW[pTell].Map[Loc] := RW[pTell].Map[Loc] and not fCity 2572 end 2573 end 2574 end 2572 end; 2573 end; 2574 end; 2575 2575 end; 2576 2576 end; … … 2594 2594 RWemix[p, Occupant[Loc], unx.mix]; 2595 2595 inc(result); 2596 end 2597 end 2596 end; 2597 end; 2598 2598 end; 2599 2599 … … 2655 2655 ClearFlags := ClearFlags or fOwnZoCUnit; 2656 2656 RW[p].Map[Loc] := RW[p].Map[Loc] and not ClearFlags or AddFlags; 2657 end 2658 end 2659 end 2657 end; 2658 end; 2659 end; 2660 2660 end; 2661 2661 … … 2691 2691 Tile1^ := Tile1^ or fInEnemyZoC; 2692 2692 Break 2693 end 2694 end 2695 end; 2696 end 2697 end 2693 end; 2694 end; 2695 end; 2696 end; 2697 end; 2698 2698 end; 2699 2699 … … 2721 2721 if (Loc1 >= 0) and (Loc1 < MapSize) then 2722 2722 RW[p].Map[Loc1] := RW[p].Map[Loc1] or fInEnemyZoC 2723 end 2724 end 2725 end 2723 end; 2724 end; 2725 end; 2726 2726 end; 2727 2727 … … 2740 2740 for Loc := 0 to MapSize - 1 do 2741 2741 if PeacePlayer[RW[p].Territory[Loc]] then 2742 RW[p].Map[Loc] := RW[p].Map[Loc] or fPeace 2742 RW[p].Map[Loc] := RW[p].Map[Loc] or fPeace; 2743 2743 end; 2744 2744 … … 2754 2754 p1: integer; 2755 2755 begin 2756 assert(p >= 0); // no player's territory indicated by p=nPl2757 dec(TerritoryCount[RealMap[Loc] shr 27]);2758 inc(TerritoryCount[p]);2756 Assert(p >= 0); // no player's territory indicated by p=nPl 2757 Dec(TerritoryCount[RealMap[Loc] shr 27]); 2758 Inc(TerritoryCount[p]); 2759 2759 RealMap[Loc] := RealMap[Loc] and not($F shl 27) or Cardinal(p) shl 27; 2760 2760 if p = $F then … … 2770 2770 else 2771 2771 RW[p1].Map[Loc] := RW[p1].Map[Loc] and not fPeace; 2772 end 2772 end; 2773 2773 end; 2774 2774 … … 2797 2797 ChangeTerritory(Loc, NewOwner); 2798 2798 inc(i); 2799 end 2800 end 2799 end; 2800 end; 2801 2801 end; 2802 2802 … … 2839 2839 then 2840 2840 StolenDist[Loc1] := NewDist; 2841 end 2842 end 2841 end; 2842 end; 2843 2843 end; 2844 2844 end; … … 2875 2875 Country[Loc1] := FormerCountry[Loc]; 2876 2876 Dist[Loc1] := NewDist; 2877 end 2878 end 2879 end 2877 end; 2878 end; 2879 end; 2880 2880 end; 2881 2881 … … 3026 3026 if RW[p].Model[mix].Flags and mdZOC <> 0 then 3027 3027 ZoCMap[Loc] := 1; 3028 end 3028 end; 3029 3029 end; 3030 3030 3031 3031 procedure CountLost(p, mix, Enemy: integer); 3032 3032 begin 3033 inc(RW[p].Model[mix].Lost);3033 Inc(RW[p].Model[mix].Lost); 3034 3034 TellAboutModel(Enemy, p, mix); 3035 inc(Destroyed[Enemy, p, mix]);3035 Inc(Destroyed[Enemy, p, mix]); 3036 3036 end; 3037 3037 … … 3064 3064 if Enemy >= 0 then 3065 3065 CountLost(p, mix, Enemy); 3066 end 3067 end; { RemoveUnit }3066 end; 3067 end; 3068 3068 3069 3069 procedure RemoveUnit_UpdateMap(p, uix: integer); 3070 3070 var 3071 Loc0: integer;3071 Loc0: Integer; 3072 3072 begin 3073 3073 Loc0 := RW[p].Un[uix].Loc; … … 3138 3138 ChangeTerritory(Loc, p) 3139 3139 end; 3140 end; { FoundCity }3140 end; 3141 3141 3142 3142 procedure StealCity(p, cix: integer; SaveUnits: boolean); … … 3178 3178 else 3179 3179 RemoveUnit(p, uix1); // destroy supported units 3180 end; // StealCity3180 end; 3181 3181 3182 3182 procedure DestroyCity(p, cix: integer; SaveUnits: boolean); … … 3197 3197 RealMap[Loc] := RealMap[Loc] and not fCity; 3198 3198 Loc := -1 3199 end 3200 end; // DestroyCity3199 end; 3200 end; 3201 3201 3202 3202 procedure ChangeCityOwner(pOld, cixOld, pNew: integer); … … 3275 3275 ChangeTerritory(Loc, pNew); 3276 3276 end; 3277 end; // ChangeCityOwner3277 end; 3278 3278 3279 3279 procedure CompleteJob(p, Loc, Job: integer); … … 3411 3411 if RW[pAbout].Un[uix].Loc >= 0 then 3412 3412 inc(UnCount[RW[pAbout].Un[uix].mix]); 3413 end 3413 end; 3414 3414 end; 3415 3415 … … 3426 3426 begin 3427 3427 end; } 3428 end 3428 end; 3429 3429 end; 3430 3430 … … 3447 3447 rTarget.ResearchTech := rSender.ResearchTech; 3448 3448 rTarget.ResearchDone := rSender.ResearchDone; 3449 result := true 3449 result := true; 3450 3450 end; 3451 3451 for i := 0 to nAdv - 1 do … … 3453 3453 begin 3454 3454 rTarget.Tech[i] := rSender.Tech[i]; 3455 result := true 3456 end 3455 result := true; 3456 end; 3457 3457 end; 3458 3458 … … 3474 3474 for mix := 0 to rTarget.nModelCounted - 1 do 3475 3475 TellAboutModel(pTarget, pAbout, mix); 3476 result := true 3477 end 3476 result := true; 3477 end; 3478 3478 end; 3479 3479 … … 3491 3491 MakeModelInfo(pTarget, i, RW[pTarget].Model[i], miTarget); 3492 3492 if IsSameModel(miSender, miTarget) then 3493 ok := false 3493 ok := false; 3494 3494 end; 3495 3495 if ok then … … 3509 3509 inc(Researched[pTarget]); 3510 3510 TellAboutModel(pSender, pTarget, RW[pTarget].nModel - 1); 3511 end 3511 end; 3512 3512 end; 3513 3513 … … 3662 3662 RecalcPeaceMap(pSender); 3663 3663 RecalcPeaceMap(pTarget); 3664 end 3665 end 3664 end; 3665 end; 3666 3666 end; 3667 3667 opShipParts: // + number + part type shl 16 … … 3681 3681 RW[pSender].Ship[pTarget].Parts[i] := GShip[pTarget].Parts[i]; 3682 3682 RW[pTarget].Ship[pTarget].Parts[i] := GShip[pTarget].Parts[i]; 3683 end 3684 end 3683 end; 3684 end; 3685 3685 end 3686 3686 else … … 3695 3695 dec(RW[pSender].Money, Price - opMoney); 3696 3696 inc(RW[pTarget].Money, Price - opMoney); 3697 end 3697 end; 3698 3698 end 3699 3699 else … … 3710 3710 SeeTech(pTarget, Price - opTech); 3711 3711 RW[pSender].EnemyReport[pTarget].Tech[Price - opTech] := tsSeen; 3712 end 3712 end; 3713 3713 end 3714 3714 else … … 3807 3807 RecalcMapZoC(p); 3808 3808 RecalcMapZoC(pWith); 3809 end 3809 end; 3810 3810 end; 3811 3811 if OldTreaty in [trPeace, trAlliance] then … … 3813 3813 RecalcPeaceMap(p); 3814 3814 RecalcPeaceMap(pWith); 3815 end 3815 end; 3816 3816 end; 3817 3817 … … 3854 3854 if CopyMilReport(pCity, p, p1) then 3855 3855 result := result or (2 shl (2 * p1)); 3856 end 3856 end; 3857 3857 end; 3858 3858 end; … … 3911 3911 if RW[p2].EnemyReport[p1].Tech[AgePreq[i]] < tsApplicable then 3912 3912 RW[p2].EnemyReport[p1].Tech[AgePreq[i]] := tsCheat; 3913 end 3913 end; 3914 3914 end; 3915 3915 … … 3925 3925 GiveCivilReport(p, p1); 3926 3926 GiveMilReport(p, p1); 3927 end 3928 end 3927 end; 3928 end; 3929 3929 end; 3930 3930 end;
Note:
See TracChangeset
for help on using the changeset viewer.