Changeset 210 for branches/highdpi/Database.pas
- Timestamp:
- May 9, 2020, 4:02:07 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Database.pas
r144 r210 11 11 const 12 12 // additional test flags 13 FastContact = false;{ extra small world with railroad everywhere }13 //{$DEFINE FastContact} { extra small world with railroad everywhere } 14 14 15 15 neumax = 4096; … … 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 } … … 1657 1657 i, p, p1, uix, Loc1: integer; 1658 1658 begin 1659 if FastContact then { Railroad everywhere } 1659 {$IFDEF FastContact} 1660 { Railroad everywhere } 1660 1661 for Loc1 := 0 to MapSize - 1 do 1661 1662 if RealMap[Loc1] and fTerrain >= fGrass then 1662 1663 RealMap[Loc1] := RealMap[Loc1] or fRR; 1664 {$ENDIF} 1663 1665 1664 1666 { !!!for Loc1:=0 to MapSize-1 do … … 1795 1797 StartPositions; 1796 1798 InitGame; 1797 end; { InitRandomGame }1799 end; 1798 1800 1799 1801 procedure InitMapGame(Human: integer); … … 1803 1805 PredefinedStartPositions(Human); 1804 1806 InitGame; 1805 end; { InitMapGame }1807 end; 1806 1808 1807 1809 procedure ReleaseGame; … … 1824 1826 FreeMem(RW[p1].MapObservedLast); 1825 1827 FreeMem(RW[p1].Map); 1826 end 1828 end; 1827 1829 end; 1828 1830 … … 1944 1946 begin 1945 1947 result := eNoPreq; 1946 exit 1948 exit; 1947 1949 end; 1948 1950 end; … … 1958 1960 begin 1959 1961 result := eInvalid; 1960 exit 1962 exit; 1961 1963 end; // no city found here 1962 1964 … … 2114 2116 Det := TestDet; 2115 2117 Cost := TestCost; 2116 end 2117 end 2118 end 2118 end; 2119 end; 2120 end; 2119 2121 end; 2120 2122 end; … … 2178 2180 UnitReport.ReportFlags := UnitReport.ReportFlags or urfDeployed; 2179 2181 end; 2180 end 2182 end; 2181 2183 end; 2182 2184 end; … … 2373 2375 end 2374 2376 else 2375 AddFlags := AddFlags or Map[Loc] and (fStealthUnit or fHiddenUnit) 2376 end 2377 AddFlags := AddFlags or Map[Loc] and (fStealthUnit or fHiddenUnit); 2378 end; 2377 2379 end; // if Mode>moLoading_Fast 2378 2380 … … 2431 2433 ObserveLevel[Loc] := ObserveLevel[Loc] and not(3 shl (2 * pTell)) or 2432 2434 Cardinal(Level) shl (2 * pTell); 2433 end 2435 end; 2434 2436 end; // DiscoverTile 2435 2437 … … 2460 2462 result := DiscoverTile(Loc1, p, pTell, Level, EnableContact) 2461 2463 or result; 2462 end 2464 end; 2463 2465 end 2464 2466 else … … 2467 2469 if Level > OldLevel then 2468 2470 result := DiscoverTile(Loc1, p, p, Level, EnableContact) or result; 2469 end 2471 end; 2470 2472 end; 2471 2473 end; … … 2500 2502 result := DiscoverTile(Loc1, p, pTell, Level, EnableContact) 2501 2503 or result; 2502 end 2504 end; 2503 2505 end 2504 2506 else … … 2507 2509 if Level > OldLevel then 2508 2510 result := DiscoverTile(Loc1, p, p, Level, EnableContact) or result; 2509 end 2511 end; 2510 2512 end; 2511 2513 AdjacentFlags := AdjacentFlags shr 1; … … 2570 2572 RW[pTell].EnemyCity[ecix].Loc := -1; 2571 2573 RW[pTell].Map[Loc] := RW[pTell].Map[Loc] and not fCity 2572 end 2573 end 2574 end 2574 end; 2575 end; 2576 end; 2575 2577 end; 2576 2578 end; … … 2594 2596 RWemix[p, Occupant[Loc], unx.mix]; 2595 2597 inc(result); 2596 end 2597 end 2598 end; 2599 end; 2598 2600 end; 2599 2601 … … 2655 2657 ClearFlags := ClearFlags or fOwnZoCUnit; 2656 2658 RW[p].Map[Loc] := RW[p].Map[Loc] and not ClearFlags or AddFlags; 2657 end 2658 end 2659 end 2659 end; 2660 end; 2661 end; 2660 2662 end; 2661 2663 … … 2691 2693 Tile1^ := Tile1^ or fInEnemyZoC; 2692 2694 Break 2693 end 2694 end 2695 end; 2696 end 2697 end 2695 end; 2696 end; 2697 end; 2698 end; 2699 end; 2698 2700 end; 2699 2701 … … 2721 2723 if (Loc1 >= 0) and (Loc1 < MapSize) then 2722 2724 RW[p].Map[Loc1] := RW[p].Map[Loc1] or fInEnemyZoC 2723 end 2724 end 2725 end 2725 end; 2726 end; 2727 end; 2726 2728 end; 2727 2729 … … 2740 2742 for Loc := 0 to MapSize - 1 do 2741 2743 if PeacePlayer[RW[p].Territory[Loc]] then 2742 RW[p].Map[Loc] := RW[p].Map[Loc] or fPeace 2744 RW[p].Map[Loc] := RW[p].Map[Loc] or fPeace; 2743 2745 end; 2744 2746 … … 2754 2756 p1: integer; 2755 2757 begin 2756 assert(p >= 0); // no player's territory indicated by p=nPl2757 dec(TerritoryCount[RealMap[Loc] shr 27]);2758 inc(TerritoryCount[p]);2758 Assert(p >= 0); // no player's territory indicated by p=nPl 2759 Dec(TerritoryCount[RealMap[Loc] shr 27]); 2760 Inc(TerritoryCount[p]); 2759 2761 RealMap[Loc] := RealMap[Loc] and not($F shl 27) or Cardinal(p) shl 27; 2760 2762 if p = $F then … … 2770 2772 else 2771 2773 RW[p1].Map[Loc] := RW[p1].Map[Loc] and not fPeace; 2772 end 2774 end; 2773 2775 end; 2774 2776 … … 2797 2799 ChangeTerritory(Loc, NewOwner); 2798 2800 inc(i); 2799 end 2800 end 2801 end; 2802 end; 2801 2803 end; 2802 2804 … … 2839 2841 then 2840 2842 StolenDist[Loc1] := NewDist; 2841 end 2842 end 2843 end; 2844 end; 2843 2845 end; 2844 2846 end; … … 2875 2877 Country[Loc1] := FormerCountry[Loc]; 2876 2878 Dist[Loc1] := NewDist; 2877 end 2878 end 2879 end 2879 end; 2880 end; 2881 end; 2880 2882 end; 2881 2883 … … 3026 3028 if RW[p].Model[mix].Flags and mdZOC <> 0 then 3027 3029 ZoCMap[Loc] := 1; 3028 end 3030 end; 3029 3031 end; 3030 3032 3031 3033 procedure CountLost(p, mix, Enemy: integer); 3032 3034 begin 3033 inc(RW[p].Model[mix].Lost);3035 Inc(RW[p].Model[mix].Lost); 3034 3036 TellAboutModel(Enemy, p, mix); 3035 inc(Destroyed[Enemy, p, mix]);3037 Inc(Destroyed[Enemy, p, mix]); 3036 3038 end; 3037 3039 … … 3064 3066 if Enemy >= 0 then 3065 3067 CountLost(p, mix, Enemy); 3066 end 3067 end; { RemoveUnit }3068 end; 3069 end; 3068 3070 3069 3071 procedure RemoveUnit_UpdateMap(p, uix: integer); 3070 3072 var 3071 Loc0: integer;3073 Loc0: Integer; 3072 3074 begin 3073 3075 Loc0 := RW[p].Un[uix].Loc; … … 3138 3140 ChangeTerritory(Loc, p) 3139 3141 end; 3140 end; { FoundCity }3142 end; 3141 3143 3142 3144 procedure StealCity(p, cix: integer; SaveUnits: boolean); … … 3178 3180 else 3179 3181 RemoveUnit(p, uix1); // destroy supported units 3180 end; // StealCity3182 end; 3181 3183 3182 3184 procedure DestroyCity(p, cix: integer; SaveUnits: boolean); … … 3197 3199 RealMap[Loc] := RealMap[Loc] and not fCity; 3198 3200 Loc := -1 3199 end 3200 end; // DestroyCity3201 end; 3202 end; 3201 3203 3202 3204 procedure ChangeCityOwner(pOld, cixOld, pNew: integer); … … 3275 3277 ChangeTerritory(Loc, pNew); 3276 3278 end; 3277 end; // ChangeCityOwner3279 end; 3278 3280 3279 3281 procedure CompleteJob(p, Loc, Job: integer); … … 3411 3413 if RW[pAbout].Un[uix].Loc >= 0 then 3412 3414 inc(UnCount[RW[pAbout].Un[uix].mix]); 3413 end 3415 end; 3414 3416 end; 3415 3417 … … 3426 3428 begin 3427 3429 end; } 3428 end 3430 end; 3429 3431 end; 3430 3432 … … 3447 3449 rTarget.ResearchTech := rSender.ResearchTech; 3448 3450 rTarget.ResearchDone := rSender.ResearchDone; 3449 result := true 3451 result := true; 3450 3452 end; 3451 3453 for i := 0 to nAdv - 1 do … … 3453 3455 begin 3454 3456 rTarget.Tech[i] := rSender.Tech[i]; 3455 result := true 3456 end 3457 result := true; 3458 end; 3457 3459 end; 3458 3460 … … 3474 3476 for mix := 0 to rTarget.nModelCounted - 1 do 3475 3477 TellAboutModel(pTarget, pAbout, mix); 3476 result := true 3477 end 3478 result := true; 3479 end; 3478 3480 end; 3479 3481 … … 3491 3493 MakeModelInfo(pTarget, i, RW[pTarget].Model[i], miTarget); 3492 3494 if IsSameModel(miSender, miTarget) then 3493 ok := false 3495 ok := false; 3494 3496 end; 3495 3497 if ok then … … 3509 3511 inc(Researched[pTarget]); 3510 3512 TellAboutModel(pSender, pTarget, RW[pTarget].nModel - 1); 3511 end 3513 end; 3512 3514 end; 3513 3515 … … 3662 3664 RecalcPeaceMap(pSender); 3663 3665 RecalcPeaceMap(pTarget); 3664 end 3665 end 3666 end; 3667 end; 3666 3668 end; 3667 3669 opShipParts: // + number + part type shl 16 … … 3681 3683 RW[pSender].Ship[pTarget].Parts[i] := GShip[pTarget].Parts[i]; 3682 3684 RW[pTarget].Ship[pTarget].Parts[i] := GShip[pTarget].Parts[i]; 3683 end 3684 end 3685 end; 3686 end; 3685 3687 end 3686 3688 else … … 3695 3697 dec(RW[pSender].Money, Price - opMoney); 3696 3698 inc(RW[pTarget].Money, Price - opMoney); 3697 end 3699 end; 3698 3700 end 3699 3701 else … … 3710 3712 SeeTech(pTarget, Price - opTech); 3711 3713 RW[pSender].EnemyReport[pTarget].Tech[Price - opTech] := tsSeen; 3712 end 3714 end; 3713 3715 end 3714 3716 else … … 3807 3809 RecalcMapZoC(p); 3808 3810 RecalcMapZoC(pWith); 3809 end 3811 end; 3810 3812 end; 3811 3813 if OldTreaty in [trPeace, trAlliance] then … … 3813 3815 RecalcPeaceMap(p); 3814 3816 RecalcPeaceMap(pWith); 3815 end 3817 end; 3816 3818 end; 3817 3819 … … 3854 3856 if CopyMilReport(pCity, p, p1) then 3855 3857 result := result or (2 shl (2 * p1)); 3856 end 3858 end; 3857 3859 end; 3858 3860 end; … … 3911 3913 if RW[p2].EnemyReport[p1].Tech[AgePreq[i]] < tsApplicable then 3912 3914 RW[p2].EnemyReport[p1].Tech[AgePreq[i]] := tsCheat; 3913 end 3915 end; 3914 3916 end; 3915 3917 … … 3925 3927 GiveCivilReport(p, p1); 3926 3928 GiveMilReport(p, p1); 3927 end 3928 end 3929 end; 3930 end; 3929 3931 end; 3930 3932 end;
Note:
See TracChangeset
for help on using the changeset viewer.